mirror of
https://github.com/actions/actions-runner-controller.git
synced 2026-01-16 08:44:03 +08:00
Compare commits
7 Commits
dependabot
...
nikola-jok
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffcaa06b6a | ||
|
|
0bb603edc8 | ||
|
|
9e871b42d4 | ||
|
|
26f573fa80 | ||
|
|
1ce073b56e | ||
|
|
beef400c07 | ||
|
|
20e696b6c8 |
@@ -24,13 +24,13 @@ import (
|
||||
// AutoscalingListenerSpec defines the desired state of AutoscalingListener
|
||||
type AutoscalingListenerSpec struct {
|
||||
// Required
|
||||
GitHubConfigUrl string `json:"githubConfigUrl,omitempty"`
|
||||
GitHubConfigURL string `json:"githubConfigUrl,omitempty"`
|
||||
|
||||
// Required
|
||||
GitHubConfigSecret string `json:"githubConfigSecret,omitempty"`
|
||||
|
||||
// Required
|
||||
RunnerScaleSetId int `json:"runnerScaleSetId,omitempty"`
|
||||
RunnerScaleSetID int `json:"runnerScaleSetId,omitempty"`
|
||||
|
||||
// Required
|
||||
AutoscalingRunnerSetNamespace string `json:"autoscalingRunnerSetNamespace,omitempty"`
|
||||
|
||||
@@ -46,16 +46,16 @@ import (
|
||||
// AutoscalingRunnerSet is the Schema for the autoscalingrunnersets API
|
||||
type AutoscalingRunnerSet struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
Spec AutoscalingRunnerSetSpec `json:"spec,omitempty"`
|
||||
Status AutoscalingRunnerSetStatus `json:"status,omitempty"`
|
||||
Spec AutoscalingRunnerSetSpec `json:"spec"`
|
||||
Status AutoscalingRunnerSetStatus `json:"status"`
|
||||
}
|
||||
|
||||
// AutoscalingRunnerSetSpec defines the desired state of AutoscalingRunnerSet
|
||||
type AutoscalingRunnerSetSpec struct {
|
||||
// Required
|
||||
GitHubConfigUrl string `json:"githubConfigUrl,omitempty"`
|
||||
GitHubConfigURL string `json:"githubConfigUrl,omitempty"`
|
||||
|
||||
// Required
|
||||
GitHubConfigSecret string `json:"githubConfigSecret,omitempty"`
|
||||
@@ -76,7 +76,7 @@ type AutoscalingRunnerSetSpec struct {
|
||||
VaultConfig *VaultConfig `json:"vaultConfig,omitempty"`
|
||||
|
||||
// Required
|
||||
Template corev1.PodTemplateSpec `json:"template,omitempty"`
|
||||
Template corev1.PodTemplateSpec `json:"template"`
|
||||
|
||||
// +optional
|
||||
ListenerMetrics *MetricsConfig `json:"listenerMetrics,omitempty"`
|
||||
@@ -152,9 +152,9 @@ func (c *ProxyConfig) ToHTTPProxyConfig(secretFetcher func(string) (*corev1.Secr
|
||||
}
|
||||
|
||||
if c.HTTP != nil {
|
||||
u, err := url.Parse(c.HTTP.Url)
|
||||
u, err := url.Parse(c.HTTP.URL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse proxy http url %q: %w", c.HTTP.Url, err)
|
||||
return nil, fmt.Errorf("failed to parse proxy http url %q: %w", c.HTTP.URL, err)
|
||||
}
|
||||
|
||||
if c.HTTP.CredentialSecretRef != "" {
|
||||
@@ -177,9 +177,9 @@ func (c *ProxyConfig) ToHTTPProxyConfig(secretFetcher func(string) (*corev1.Secr
|
||||
}
|
||||
|
||||
if c.HTTPS != nil {
|
||||
u, err := url.Parse(c.HTTPS.Url)
|
||||
u, err := url.Parse(c.HTTPS.URL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse proxy https url %q: %w", c.HTTPS.Url, err)
|
||||
return nil, fmt.Errorf("failed to parse proxy https url %q: %w", c.HTTPS.URL, err)
|
||||
}
|
||||
|
||||
if c.HTTPS.CredentialSecretRef != "" {
|
||||
@@ -233,7 +233,7 @@ func (c *ProxyConfig) ProxyFunc(secretFetcher func(string) (*corev1.Secret, erro
|
||||
|
||||
type ProxyServerConfig struct {
|
||||
// Required
|
||||
Url string `json:"url,omitempty"`
|
||||
URL string `json:"url,omitempty"`
|
||||
|
||||
// +optional
|
||||
CredentialSecretRef string `json:"credentialSecretRef,omitempty"`
|
||||
@@ -313,8 +313,8 @@ func (ars *AutoscalingRunnerSet) GitHubConfigSecret() string {
|
||||
return ars.Spec.GitHubConfigSecret
|
||||
}
|
||||
|
||||
func (ars *AutoscalingRunnerSet) GitHubConfigUrl() string {
|
||||
return ars.Spec.GitHubConfigUrl
|
||||
func (ars *AutoscalingRunnerSet) GitHubConfigURL() string {
|
||||
return ars.Spec.GitHubConfigURL
|
||||
}
|
||||
|
||||
func (ars *AutoscalingRunnerSet) GitHubProxy() *ProxyConfig {
|
||||
@@ -338,7 +338,7 @@ func (ars *AutoscalingRunnerSet) VaultProxy() *ProxyConfig {
|
||||
|
||||
func (ars *AutoscalingRunnerSet) RunnerSetSpecHash() string {
|
||||
type runnerSetSpec struct {
|
||||
GitHubConfigUrl string
|
||||
GitHubConfigURL string
|
||||
GitHubConfigSecret string
|
||||
RunnerGroup string
|
||||
RunnerScaleSetName string
|
||||
@@ -347,7 +347,7 @@ func (ars *AutoscalingRunnerSet) RunnerSetSpecHash() string {
|
||||
Template corev1.PodTemplateSpec
|
||||
}
|
||||
spec := &runnerSetSpec{
|
||||
GitHubConfigUrl: ars.Spec.GitHubConfigUrl,
|
||||
GitHubConfigURL: ars.Spec.GitHubConfigURL,
|
||||
GitHubConfigSecret: ars.Spec.GitHubConfigSecret,
|
||||
RunnerGroup: ars.Spec.RunnerGroup,
|
||||
RunnerScaleSetName: ars.Spec.RunnerScaleSetName,
|
||||
@@ -363,7 +363,7 @@ func (ars *AutoscalingRunnerSet) RunnerSetSpecHash() string {
|
||||
// AutoscalingRunnerSetList contains a list of AutoscalingRunnerSet
|
||||
type AutoscalingRunnerSetList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
Items []AutoscalingRunnerSet `json:"items"`
|
||||
}
|
||||
|
||||
|
||||
@@ -41,10 +41,10 @@ const EphemeralRunnerContainerName = "runner"
|
||||
// EphemeralRunner is the Schema for the ephemeralrunners API
|
||||
type EphemeralRunner struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
Spec EphemeralRunnerSpec `json:"spec,omitempty"`
|
||||
Status EphemeralRunnerStatus `json:"status,omitempty"`
|
||||
Spec EphemeralRunnerSpec `json:"spec"`
|
||||
Status EphemeralRunnerStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (er *EphemeralRunner) IsDone() bool {
|
||||
@@ -76,8 +76,8 @@ func (er *EphemeralRunner) GitHubConfigSecret() string {
|
||||
return er.Spec.GitHubConfigSecret
|
||||
}
|
||||
|
||||
func (er *EphemeralRunner) GitHubConfigUrl() string {
|
||||
return er.Spec.GitHubConfigUrl
|
||||
func (er *EphemeralRunner) GitHubConfigURL() string {
|
||||
return er.Spec.GitHubConfigURL
|
||||
}
|
||||
|
||||
func (er *EphemeralRunner) GitHubProxy() *ProxyConfig {
|
||||
@@ -102,7 +102,7 @@ func (er *EphemeralRunner) VaultProxy() *ProxyConfig {
|
||||
// EphemeralRunnerSpec defines the desired state of EphemeralRunner
|
||||
type EphemeralRunnerSpec struct {
|
||||
// +required
|
||||
GitHubConfigUrl string `json:"githubConfigUrl,omitempty"`
|
||||
GitHubConfigURL string `json:"githubConfigUrl,omitempty"`
|
||||
|
||||
// +required
|
||||
GitHubConfigSecret string `json:"githubConfigSecret,omitempty"`
|
||||
@@ -111,7 +111,7 @@ type EphemeralRunnerSpec struct {
|
||||
GitHubServerTLS *TLSConfig `json:"githubServerTLS,omitempty"`
|
||||
|
||||
// +required
|
||||
RunnerScaleSetId int `json:"runnerScaleSetId,omitempty"`
|
||||
RunnerScaleSetID int `json:"runnerScaleSetId,omitempty"`
|
||||
|
||||
// +optional
|
||||
Proxy *ProxyConfig `json:"proxy,omitempty"`
|
||||
@@ -147,7 +147,7 @@ type EphemeralRunnerStatus struct {
|
||||
Message string `json:"message,omitempty"`
|
||||
|
||||
// +optional
|
||||
RunnerId int `json:"runnerId,omitempty"`
|
||||
RunnerID int `json:"runnerId,omitempty"`
|
||||
// +optional
|
||||
RunnerName string `json:"runnerName,omitempty"`
|
||||
|
||||
@@ -155,7 +155,7 @@ type EphemeralRunnerStatus struct {
|
||||
Failures map[string]metav1.Time `json:"failures,omitempty"`
|
||||
|
||||
// +optional
|
||||
JobRequestId int64 `json:"jobRequestId,omitempty"`
|
||||
JobRequestID int64 `json:"jobRequestId,omitempty"`
|
||||
|
||||
// +optional
|
||||
JobID string `json:"jobId,omitempty"`
|
||||
@@ -167,7 +167,7 @@ type EphemeralRunnerStatus struct {
|
||||
JobWorkflowRef string `json:"jobWorkflowRef,omitempty"`
|
||||
|
||||
// +optional
|
||||
WorkflowRunId int64 `json:"workflowRunId,omitempty"`
|
||||
WorkflowRunID int64 `json:"workflowRunId,omitempty"`
|
||||
|
||||
// +optional
|
||||
JobDisplayName string `json:"jobDisplayName,omitempty"`
|
||||
@@ -192,7 +192,7 @@ func (s *EphemeralRunnerStatus) LastFailure() metav1.Time {
|
||||
// EphemeralRunnerList contains a list of EphemeralRunner
|
||||
type EphemeralRunnerList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
Items []EphemeralRunner `json:"items"`
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ type EphemeralRunnerSetSpec struct {
|
||||
// PatchID is the unique identifier for the patch issued by the listener app
|
||||
PatchID int `json:"patchID"`
|
||||
// EphemeralRunnerSpec is the spec of the ephemeral runner
|
||||
EphemeralRunnerSpec EphemeralRunnerSpec `json:"ephemeralRunnerSpec,omitempty"`
|
||||
EphemeralRunnerSpec EphemeralRunnerSpec `json:"ephemeralRunnerSpec"`
|
||||
}
|
||||
|
||||
// EphemeralRunnerSetStatus defines the observed state of EphemeralRunnerSet
|
||||
@@ -54,18 +54,18 @@ type EphemeralRunnerSetStatus struct {
|
||||
// EphemeralRunnerSet is the Schema for the ephemeralrunnersets API
|
||||
type EphemeralRunnerSet struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
metav1.ObjectMeta `json:"metadata"`
|
||||
|
||||
Spec EphemeralRunnerSetSpec `json:"spec,omitempty"`
|
||||
Status EphemeralRunnerSetStatus `json:"status,omitempty"`
|
||||
Spec EphemeralRunnerSetSpec `json:"spec"`
|
||||
Status EphemeralRunnerSetStatus `json:"status"`
|
||||
}
|
||||
|
||||
func (ers *EphemeralRunnerSet) GitHubConfigSecret() string {
|
||||
return ers.Spec.EphemeralRunnerSpec.GitHubConfigSecret
|
||||
}
|
||||
|
||||
func (ers *EphemeralRunnerSet) GitHubConfigUrl() string {
|
||||
return ers.Spec.EphemeralRunnerSpec.GitHubConfigUrl
|
||||
func (ers *EphemeralRunnerSet) GitHubConfigURL() string {
|
||||
return ers.Spec.EphemeralRunnerSpec.GitHubConfigURL
|
||||
}
|
||||
|
||||
func (ers *EphemeralRunnerSet) GitHubProxy() *ProxyConfig {
|
||||
@@ -91,7 +91,7 @@ func (ers *EphemeralRunnerSet) VaultProxy() *ProxyConfig {
|
||||
// +kubebuilder:object:root=true
|
||||
type EphemeralRunnerSetList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
metav1.ListMeta `json:"metadata"`
|
||||
Items []EphemeralRunnerSet `json:"items"`
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
// Package v1 contains API Schema definitions for the batch v1 API group
|
||||
// Package v1alpha1 contains API Schema definitions for the batch v1 API group
|
||||
// +kubebuilder:object:generate=true
|
||||
// +groupName=actions.github.com
|
||||
package v1alpha1
|
||||
|
||||
@@ -14,11 +14,11 @@ import (
|
||||
func TestProxyConfig_ToSecret(t *testing.T) {
|
||||
config := &v1alpha1.ProxyConfig{
|
||||
HTTP: &v1alpha1.ProxyServerConfig{
|
||||
Url: "http://proxy.example.com:8080",
|
||||
URL: "http://proxy.example.com:8080",
|
||||
CredentialSecretRef: "my-secret",
|
||||
},
|
||||
HTTPS: &v1alpha1.ProxyServerConfig{
|
||||
Url: "https://proxy.example.com:8080",
|
||||
URL: "https://proxy.example.com:8080",
|
||||
CredentialSecretRef: "my-secret",
|
||||
},
|
||||
NoProxy: []string{
|
||||
@@ -48,11 +48,11 @@ func TestProxyConfig_ToSecret(t *testing.T) {
|
||||
func TestProxyConfig_ProxyFunc(t *testing.T) {
|
||||
config := &v1alpha1.ProxyConfig{
|
||||
HTTP: &v1alpha1.ProxyServerConfig{
|
||||
Url: "http://proxy.example.com:8080",
|
||||
URL: "http://proxy.example.com:8080",
|
||||
CredentialSecretRef: "my-secret",
|
||||
},
|
||||
HTTPS: &v1alpha1.ProxyServerConfig{
|
||||
Url: "https://proxy.example.com:8080",
|
||||
URL: "https://proxy.example.com:8080",
|
||||
CredentialSecretRef: "my-secret",
|
||||
},
|
||||
NoProxy: []string{
|
||||
|
||||
@@ -16323,6 +16323,8 @@ spec:
|
||||
It is used to identify which vault integration should be used to resolve secrets.
|
||||
type: string
|
||||
type: object
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
status:
|
||||
description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet
|
||||
@@ -16338,6 +16340,10 @@ spec:
|
||||
state:
|
||||
type: string
|
||||
type: object
|
||||
required:
|
||||
- metadata
|
||||
- spec
|
||||
- status
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
|
||||
@@ -8271,6 +8271,10 @@ spec:
|
||||
format: int64
|
||||
type: integer
|
||||
type: object
|
||||
required:
|
||||
- metadata
|
||||
- spec
|
||||
- status
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
|
||||
@@ -8223,6 +8223,7 @@ spec:
|
||||
description: Replicas is the number of desired EphemeralRunner resources in the k8s namespace.
|
||||
type: integer
|
||||
required:
|
||||
- ephemeralRunnerSpec
|
||||
- patchID
|
||||
type: object
|
||||
status:
|
||||
@@ -8240,6 +8241,10 @@ spec:
|
||||
required:
|
||||
- currentReplicas
|
||||
type: object
|
||||
required:
|
||||
- metadata
|
||||
- spec
|
||||
- status
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
|
||||
24
charts/gha-runner-scale-set-dev/.helmignore
Normal file
24
charts/gha-runner-scale-set-dev/.helmignore
Normal file
@@ -0,0 +1,24 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
tests/
|
||||
33
charts/gha-runner-scale-set-dev/Chart.yaml
Normal file
33
charts/gha-runner-scale-set-dev/Chart.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
apiVersion: v2
|
||||
name: gha-runner-scale-set
|
||||
description: A Helm chart for deploying an AutoScalingRunnerSet
|
||||
|
||||
# A chart can be either an 'application' or a 'library' chart.
|
||||
#
|
||||
# Application charts are a collection of templates that can be packaged into versioned archives
|
||||
# to be deployed.
|
||||
#
|
||||
# Library charts provide useful utilities or functions for the chart developer. They're included as
|
||||
# a dependency of application charts to inject those utilities and functions into the rendering
|
||||
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
|
||||
type: application
|
||||
|
||||
# This is the chart version. This version number should be incremented each time you make changes
|
||||
# to the chart and its templates, including the app version.
|
||||
# Versions are expected to follow Semantic Versioning (https://semver.org/)
|
||||
version: "0.14.0"
|
||||
|
||||
# This is the version number of the application being deployed. This version number should be
|
||||
# incremented each time you make changes to the application. Versions are not expected to
|
||||
# follow Semantic Versioning. They should reflect the version the application is using.
|
||||
# It is recommended to use it with quotes.
|
||||
appVersion: "0.14.0"
|
||||
|
||||
home: https://github.com/actions/actions-runner-controller
|
||||
|
||||
sources:
|
||||
- "https://github.com/actions/actions-runner-controller"
|
||||
|
||||
maintainers:
|
||||
- name: actions
|
||||
url: https://github.com/actions
|
||||
87
charts/gha-runner-scale-set-dev/templates/_helpers.tpl
Normal file
87
charts/gha-runner-scale-set-dev/templates/_helpers.tpl
Normal file
@@ -0,0 +1,87 @@
|
||||
|
||||
{{- define "autoscaling-runner-set.name" -}}
|
||||
{{- $name := .Values.runnerScaleSetName | default .Release.Name | replace "_" "-" | trimSuffix "-" }}
|
||||
{{- if or (empty $name) (gt (len $name) 45) }}
|
||||
{{ fail "Autoscaling runner set name must have up to 45 characters" }}
|
||||
{{- end }}
|
||||
{{- $name }}
|
||||
{{- end }}
|
||||
|
||||
{{- define "autoscaling-runner-set.namespace" -}}
|
||||
{{- .Values.namespaceOverride | default .Release.Namespace -}}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
The name of the GitHub secret used for authentication.
|
||||
*/}}
|
||||
{{- define "github-secret.name" -}}
|
||||
{{- if not (empty .Values.auth.secretName) }}
|
||||
{{- quote .Values.auth.secretName }}
|
||||
{{- else }}
|
||||
{{- include "autoscaling-runner-set.name" . }}-github-secret
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{/*
|
||||
Create the labels for the autoscaling runner set.
|
||||
*/}}
|
||||
{{- define "autoscaling-runner-set.labels" -}}
|
||||
{{- $resourceLabels := dict "app.kubernetes.io/component" "autoscaling-runner-set" -}}
|
||||
{{- $commonLabels := include "gha-common-labels" . | fromYaml -}}
|
||||
{{- $userLabels := include "gha-process-labels" (.Values.resource.autoscalingRunnerSet.metadata.labels | default (dict)) | fromYaml -}}
|
||||
{{- $global := include "gha-process-labels" (.Values.resource.all.metadata.labels | default (dict)) | fromYaml -}}
|
||||
{{- toYaml (mergeOverwrite $global $userLabels $resourceLabels $commonLabels) }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the common labels used across all resources.
|
||||
*/}}
|
||||
{{- define "gha-common-labels" -}}
|
||||
helm.sh/chart: {{ include "gha-runner-scale-set.chart" . }}
|
||||
app.kubernetes.io/name: {{ include "autoscaling-runner-set.name" . }}
|
||||
app.kubernetes.io/instance: {{ include "autoscaling-runner-set.name" . }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/part-of: "gha-rs"
|
||||
actions.github.com/scale-set-name: {{ include "autoscaling-runner-set.name" . }}
|
||||
actions.github.com/scale-set-namespace: {{ include "autoscaling-runner-set.namespace" . }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{/*
|
||||
Takes a map of user labels and removes the ones with "actions.github.com/" prefix
|
||||
*/}}
|
||||
{{- define "gha-process-labels" -}}
|
||||
{{- $userLabels := . -}}
|
||||
{{- $processed := dict -}}
|
||||
{{- range $key, $value := $userLabels -}}
|
||||
{{- if not (hasPrefix $key "actions.github.com/") -}}
|
||||
{{- $_ := set $processed $key $value -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- $processed | toYaml -}}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "gha-runner-scale-set.chart" -}}
|
||||
{{- printf "gha-rs-%s" .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Container spec that is expanded for the runner container
|
||||
*/}}
|
||||
{{- define "container-spec.runner" -}}
|
||||
|
||||
{{- if not .Values.runner.container }}
|
||||
{{ fail "You must provide a runner container specification in values.runner.container" }}
|
||||
{{- end }}
|
||||
|
||||
{{- $tlsConfig := (default (dict) .Values.githubServerTLS) -}}
|
||||
name: runner
|
||||
image: {{ .Values.runner.container.image | default "ghcr.io/actions/runner:latest" }}
|
||||
command: {{ toJson (default (list "/home/runner/run.sh") .Values.runner.container.command) }}
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
apiVersion: actions.github.com/v1alpha1
|
||||
kind: AutoscalingRunnerSet
|
||||
metadata:
|
||||
name: {{ include "autoscaling-runner-set.name" . | quote }}
|
||||
namespace: {{ include "autoscaling-runner-set.namespace" . | quote }}
|
||||
labels:
|
||||
{{- include "autoscaling-runner-set.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- $globalAnnotations := (default (dict) .Values.resource.all.metadata.annotations) }}
|
||||
{{- $resourceAnnotations := (default (dict) .Values.resource.autoscalingRunnerSet.metadata.annotations) }}
|
||||
{{- $annotations := mergeOverwrite $globalAnnotations $resourceAnnotations }}
|
||||
{{- range $k, $v := $annotations }}
|
||||
{{ $k }}: {{ $v | quote }}
|
||||
{{- end }}
|
||||
actions.github.com/values-hash: {{ toJson .Values | sha256sum | trunc 63 }}
|
||||
|
||||
spec:
|
||||
githubConfigUrl: {{ required ".Values.auth.url is required" (trimSuffix "/" .Values.auth.url) | quote }}
|
||||
githubConfigSecret: {{ include "github-secret.name" . | quote }}
|
||||
runnerGroup: {{ .Values.scaleset.runnerGroup | quote }}
|
||||
runnerScaleSetName: {{ .Values.scaleset.name | quote }}
|
||||
|
||||
{{- if .Values.githubServerTLS }}
|
||||
githubServerTLS:
|
||||
{{- with .Values.githubServerTLS.certificateFrom }}
|
||||
certificateFrom:
|
||||
configMapKeyRef:
|
||||
name: {{ .configMapKeyRef.name }}
|
||||
key: {{ .configMapKeyRef.key }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and .Values.secretResolution (ne .Values.secretResolution.type "kubernetes") }}
|
||||
vaultConfig:
|
||||
type: {{ .Values.secretResolution.type }}
|
||||
{{- if .Values.secretResolution.proxy }}
|
||||
proxy: {{- toYaml .Values.secretResolution.proxy | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- if eq .Values.secretResolution.type "azureKeyVault" }}
|
||||
azureKeyVault:
|
||||
url: {{ .Values.secretResolution.azureKeyVault.url }}
|
||||
tenantId: {{ .Values.secretResolution.azureKeyVault.tenantId }}
|
||||
clientId: {{ .Values.secretResolution.azureKeyVault.clientId }}
|
||||
certificatePath: {{ .Values.secretResolution.azureKeyVault.certificatePath }}
|
||||
secretKey: {{ .Values.secretResolution.azureKeyVault.secretKey }}
|
||||
{{- else }}
|
||||
{{- fail "Unsupported keyVault type: " .Values.secretResolution.type }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.proxy }}
|
||||
proxy:
|
||||
{{- if .Values.proxy.http }}
|
||||
http:
|
||||
url: {{ .Values.proxy.http.url }}
|
||||
{{- if .Values.proxy.http.credentialSecretRef }}
|
||||
credentialSecretRef: {{ .Values.proxy.http.credentialSecretRef }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.proxy.https }}
|
||||
https:
|
||||
url: {{ .Values.proxy.https.url }}
|
||||
{{- if .Values.proxy.https.credentialSecretRef }}
|
||||
credentialSecretRef: {{ .Values.proxy.https.credentialSecretRef }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and .Values.proxy.noProxy (kindIs "slice" .Values.proxy.noProxy) }}
|
||||
noProxy: {{ .Values.proxy.noProxy | toYaml | nindent 6}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if and (or (kindIs "int64" .Values.scaleset.minRunners) (kindIs "float64" .Values.scaleset.minRunners)) (or (kindIs "int64" .Values.scaleset.maxRunners) (kindIs "float64" .Values.scaleset.maxRunners)) }}
|
||||
{{- if gt .Values.scaleset.minRunners .Values.scaleset.maxRunners }}
|
||||
{{- fail "maxRunners has to be greater or equal to minRunners" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if or (kindIs "int64" .Values.scaleset.maxRunners) (kindIs "float64" .Values.scaleset.maxRunners)}}
|
||||
{{- if lt (.Values.scaleset.maxRunners | int) 0 }}
|
||||
{{- fail "maxRunners has to be greater or equal to 0" }}
|
||||
{{- end }}
|
||||
maxRunners: {{ .Values.scaleset.maxRunners | int }}
|
||||
{{- end }}
|
||||
|
||||
{{- if or (kindIs "int64" .Values.scaleset.minRunners) (kindIs "float64" .Values.scaleset.minRunners) }}
|
||||
{{- if lt (.Values.scaleset.minRunners | int) 0 }}
|
||||
{{- fail "minRunners has to be greater or equal to 0" }}
|
||||
{{- end }}
|
||||
minRunners: {{ .Values.scaleset.minRunners | int }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.listenerPodTemplate }}
|
||||
listenerTemplate:
|
||||
{{- toYaml . | nindent 4}}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.listenerMetrics }}
|
||||
listenerMetrics:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
template:
|
||||
spec:
|
||||
containers:
|
||||
# {{- include "container-spec.runner" . | nindent 8 }}
|
||||
@@ -0,0 +1,245 @@
|
||||
suite: "Test AutoscalingRunnerSet Authentication & Configuration"
|
||||
templates:
|
||||
- autoscalingrunnserset.yaml
|
||||
tests:
|
||||
- it: should require githubConfigUrl
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: ".Values.auth.url is required"
|
||||
|
||||
- it: should render githubConfigUrl from auth.url
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.githubConfigUrl
|
||||
value: "https://github.com/org"
|
||||
|
||||
- it: should trim trailing slash from githubConfigUrl
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org/"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.githubConfigUrl
|
||||
value: "https://github.com/org"
|
||||
|
||||
- it: should render default githubConfigSecret from release name
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.githubConfigSecret
|
||||
value: "test-name-github-secret"
|
||||
|
||||
- it: should render custom githubConfigSecret when auth.secretName is provided
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
auth.secretName: "custom-github-secret"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.githubConfigSecret
|
||||
value: '"custom-github-secret"'
|
||||
|
||||
- it: should render default runnerGroup when not configured
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.runnerGroup
|
||||
value: "default"
|
||||
|
||||
- it: should render custom runnerGroup when configured
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
scaleset.runnerGroup: "custom-group"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.runnerGroup
|
||||
value: "custom-group"
|
||||
|
||||
- it: should render runnerGroup with special characters
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
scaleset.runnerGroup: "my-custom-runner-group-123"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.runnerGroup
|
||||
value: "my-custom-runner-group-123"
|
||||
|
||||
- it: should render runnerScaleSetName from scaleset.name
|
||||
set:
|
||||
scaleset.name: "my-runner-set"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.runnerScaleSetName
|
||||
value: "my-runner-set"
|
||||
|
||||
- it: should use release name as metadata name when runnerScaleSetName not provided
|
||||
set:
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "release-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: "release-name"
|
||||
|
||||
- it: should use scaleset.name for spec.runnerScaleSetName when provided
|
||||
set:
|
||||
scaleset.name: "spec-runner-name"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "release-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.runnerScaleSetName
|
||||
value: "spec-runner-name"
|
||||
|
||||
- it: should not normalize underscores in runnerScaleSetName (underscores are preserved)
|
||||
set:
|
||||
scaleset.name: "my_runner_set"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.runnerScaleSetName
|
||||
value: "my_runner_set"
|
||||
|
||||
- it: should reject metadata name exceeding 45 characters
|
||||
set:
|
||||
runnerScaleSetName: "this-is-a-very-long-name-that-exceeds-forty-five-characters-long"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "Autoscaling runner set name must have up to 45 characters"
|
||||
|
||||
- it: should handle githubConfigUrl with enterprise GitHub instance
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.enterprise.com/api/v3"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.githubConfigUrl
|
||||
value: "https://github.enterprise.com/api/v3"
|
||||
|
||||
- it: should render all configuration together
|
||||
set:
|
||||
runnerScaleSetName: "prod-runners"
|
||||
scaleset.name: "prod-spec-name"
|
||||
auth.url: "https://github.com/myorg"
|
||||
auth.githubToken: "gh_token12345"
|
||||
auth.secretName: "gh-token-secret"
|
||||
scaleset.runnerGroup: "prod-group"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "prod-scale-set"
|
||||
namespace: "arc"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.githubConfigUrl
|
||||
value: "https://github.com/myorg"
|
||||
- equal:
|
||||
path: spec.githubConfigSecret
|
||||
value: '"gh-token-secret"'
|
||||
- equal:
|
||||
path: spec.runnerGroup
|
||||
value: "prod-group"
|
||||
- equal:
|
||||
path: spec.runnerScaleSetName
|
||||
value: "prod-spec-name"
|
||||
- equal:
|
||||
path: metadata.name
|
||||
value: "prod-runners"
|
||||
- equal:
|
||||
path: metadata.namespace
|
||||
value: "arc"
|
||||
@@ -0,0 +1,295 @@
|
||||
suite: "Test AutoscalingRunnerSet Labels"
|
||||
templates:
|
||||
- autoscalingrunnserset.yaml
|
||||
tests:
|
||||
- it: should render base labels
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
chart:
|
||||
appVersion: "0.14.0"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels["helm.sh/chart"]
|
||||
value: "gha-rs-0.14.0"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/name"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/instance"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/component"]
|
||||
value: "autoscaling-runner-set"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/managed-by"]
|
||||
value: "Helm"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/part-of"]
|
||||
value: "gha-rs"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/version"]
|
||||
value: "0.14.0"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/scale-set-name"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/scale-set-namespace"]
|
||||
value: "test-namespace"
|
||||
|
||||
- it: should include user-defined labels
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
resource:
|
||||
autoscalingRunnerSet:
|
||||
metadata:
|
||||
labels:
|
||||
team: "backend"
|
||||
environment: "production"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels["team"]
|
||||
value: "backend"
|
||||
- equal:
|
||||
path: metadata.labels["environment"]
|
||||
value: "production"
|
||||
- equal:
|
||||
path: metadata.labels["helm.sh/chart"]
|
||||
value: "gha-rs-0.14.0"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/name"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/instance"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/component"]
|
||||
value: "autoscaling-runner-set"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/managed-by"]
|
||||
value: "Helm"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/part-of"]
|
||||
value: "gha-rs"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/version"]
|
||||
value: "0.14.0"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/scale-set-name"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/scale-set-namespace"]
|
||||
value: "test-namespace"
|
||||
|
||||
- it: should include global labels
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
resource:
|
||||
all:
|
||||
metadata:
|
||||
labels:
|
||||
global-team: "platform"
|
||||
owner: "devops"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels["global-team"]
|
||||
value: "platform"
|
||||
- equal:
|
||||
path: metadata.labels["owner"]
|
||||
value: "devops"
|
||||
- equal:
|
||||
path: metadata.labels["helm.sh/chart"]
|
||||
value: "gha-rs-0.14.0"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/name"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/instance"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/component"]
|
||||
value: "autoscaling-runner-set"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/managed-by"]
|
||||
value: "Helm"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/part-of"]
|
||||
value: "gha-rs"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/version"]
|
||||
value: "0.14.0"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/scale-set-name"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/scale-set-namespace"]
|
||||
value: "test-namespace"
|
||||
|
||||
- it: should merge both user and global labels
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
resource:
|
||||
autoscalingRunnerSet:
|
||||
metadata:
|
||||
labels:
|
||||
team: "backend"
|
||||
environment: "staging"
|
||||
all:
|
||||
metadata:
|
||||
labels:
|
||||
global-team: "platform"
|
||||
environment: "production"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels["team"]
|
||||
value: "backend"
|
||||
- equal:
|
||||
path: metadata.labels["global-team"]
|
||||
value: "platform"
|
||||
- equal:
|
||||
path: metadata.labels["environment"]
|
||||
value: "staging"
|
||||
- equal:
|
||||
path: metadata.labels["helm.sh/chart"]
|
||||
value: "gha-rs-0.14.0"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/name"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/instance"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/component"]
|
||||
value: "autoscaling-runner-set"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/managed-by"]
|
||||
value: "Helm"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/part-of"]
|
||||
value: "gha-rs"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/version"]
|
||||
value: "0.14.0"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/scale-set-name"]
|
||||
value: "test-name"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/scale-set-namespace"]
|
||||
value: "test-namespace"
|
||||
|
||||
- it: should allow user labels to override global labels
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
resource:
|
||||
autoscalingRunnerSet:
|
||||
metadata:
|
||||
labels:
|
||||
tier: "frontend"
|
||||
cost-center: "100"
|
||||
all:
|
||||
metadata:
|
||||
labels:
|
||||
tier: "backend"
|
||||
environment: "staging"
|
||||
cost-center: "200"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels["tier"]
|
||||
value: "frontend"
|
||||
- equal:
|
||||
path: metadata.labels["cost-center"]
|
||||
value: "100"
|
||||
- equal:
|
||||
path: metadata.labels["environment"]
|
||||
value: "staging"
|
||||
- equal:
|
||||
path: metadata.labels["app.kubernetes.io/name"]
|
||||
value: "test-name"
|
||||
|
||||
- it: should preserve actions.github.com custom labels from user config
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
resource:
|
||||
autoscalingRunnerSet:
|
||||
metadata:
|
||||
labels:
|
||||
team: "backend"
|
||||
actions.github.com/custom-label: "user-value"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels["team"]
|
||||
value: "backend"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/custom-label"]
|
||||
value: "user-value"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/scale-set-name"]
|
||||
value: "test-name"
|
||||
|
||||
- it: should preserve actions.github.com custom labels from global config
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
resource:
|
||||
all:
|
||||
metadata:
|
||||
labels:
|
||||
owner: "devops"
|
||||
actions.github.com/global-custom: "global-value"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: metadata.labels["owner"]
|
||||
value: "devops"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/global-custom"]
|
||||
value: "global-value"
|
||||
- equal:
|
||||
path: metadata.labels["actions.github.com/scale-set-name"]
|
||||
value: "test-name"
|
||||
@@ -0,0 +1,71 @@
|
||||
suite: "Test AutoscalingRunnerSet MinMax Runners"
|
||||
templates:
|
||||
- autoscalingrunnserset.yaml
|
||||
tests:
|
||||
- it: should set minRunners and maxRunners correctly
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
scaleset.minRunners: 2
|
||||
scaleset.maxRunners: 5
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.minRunners
|
||||
value: 2
|
||||
- equal:
|
||||
path: spec.maxRunners
|
||||
value: 5
|
||||
- it: should fail when minRunners is greater than maxRunners
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
scaleset.minRunners: 6
|
||||
scaleset.maxRunners: 5
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- failedTemplate: {}
|
||||
- it: should work when minRunners equals maxRunners
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
scaleset.minRunners: 5
|
||||
scaleset.maxRunners: 5
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.minRunners
|
||||
value: 5
|
||||
- equal:
|
||||
path: spec.maxRunners
|
||||
value: 5
|
||||
- it: should not set minRunners and maxRunners when not provided
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- notExists:
|
||||
path: spec.minRunners
|
||||
- notExists:
|
||||
path: spec.maxRunners
|
||||
@@ -0,0 +1,290 @@
|
||||
suite: "Test AutoscalingRunnerSet Proxy Configuration"
|
||||
templates:
|
||||
- autoscalingrunnserset.yaml
|
||||
tests:
|
||||
- it: should not render proxy section when not configured
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- notExists:
|
||||
path: spec.proxy
|
||||
|
||||
- it: should render http proxy configuration
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy:
|
||||
http:
|
||||
url: "http://proxy.example.com:3128"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.proxy.http.url
|
||||
value: "http://proxy.example.com:3128"
|
||||
- notExists:
|
||||
path: spec.proxy.https
|
||||
|
||||
- it: should render https proxy configuration
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy:
|
||||
https:
|
||||
url: "https://secure-proxy.example.com:3128"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.proxy.https.url
|
||||
value: "https://secure-proxy.example.com:3128"
|
||||
- notExists:
|
||||
path: spec.proxy.http
|
||||
|
||||
- it: should render both http and https proxy configuration
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy:
|
||||
http:
|
||||
url: "http://proxy.example.com:3128"
|
||||
https:
|
||||
url: "https://secure-proxy.example.com:3128"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.proxy.http.url
|
||||
value: "http://proxy.example.com:3128"
|
||||
- equal:
|
||||
path: spec.proxy.https.url
|
||||
value: "https://secure-proxy.example.com:3128"
|
||||
|
||||
- it: should render http proxy with credential secret reference
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy:
|
||||
http:
|
||||
url: "http://proxy.example.com:3128"
|
||||
credentialSecretRef: "proxy-credentials"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.proxy.http.url
|
||||
value: "http://proxy.example.com:3128"
|
||||
- equal:
|
||||
path: spec.proxy.http.credentialSecretRef
|
||||
value: "proxy-credentials"
|
||||
|
||||
- it: should render https proxy with credential secret reference
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy:
|
||||
https:
|
||||
url: "https://secure-proxy.example.com:3128"
|
||||
credentialSecretRef: "secure-proxy-creds"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.proxy.https.url
|
||||
value: "https://secure-proxy.example.com:3128"
|
||||
- equal:
|
||||
path: spec.proxy.https.credentialSecretRef
|
||||
value: "secure-proxy-creds"
|
||||
|
||||
- it: should render proxy with noProxy list
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy:
|
||||
http:
|
||||
url: "http://proxy.example.com:3128"
|
||||
noProxy:
|
||||
- "localhost"
|
||||
- "127.0.0.1"
|
||||
- ".example.local"
|
||||
- "10.0.0.0/8"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.proxy.http.url
|
||||
value: "http://proxy.example.com:3128"
|
||||
- contains:
|
||||
path: spec.proxy.noProxy
|
||||
content: "localhost"
|
||||
- contains:
|
||||
path: spec.proxy.noProxy
|
||||
content: "127.0.0.1"
|
||||
- contains:
|
||||
path: spec.proxy.noProxy
|
||||
content: ".example.local"
|
||||
- contains:
|
||||
path: spec.proxy.noProxy
|
||||
content: "10.0.0.0/8"
|
||||
|
||||
- it: should render complete proxy configuration with all options
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy:
|
||||
http:
|
||||
url: "http://proxy.example.com:3128"
|
||||
credentialSecretRef: "proxy-credentials"
|
||||
https:
|
||||
url: "https://secure-proxy.example.com:3128"
|
||||
credentialSecretRef: "secure-proxy-creds"
|
||||
noProxy:
|
||||
- "localhost"
|
||||
- "127.0.0.1"
|
||||
- ".local"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.proxy.http.url
|
||||
value: "http://proxy.example.com:3128"
|
||||
- equal:
|
||||
path: spec.proxy.http.credentialSecretRef
|
||||
value: "proxy-credentials"
|
||||
- equal:
|
||||
path: spec.proxy.https.url
|
||||
value: "https://secure-proxy.example.com:3128"
|
||||
- equal:
|
||||
path: spec.proxy.https.credentialSecretRef
|
||||
value: "secure-proxy-creds"
|
||||
- contains:
|
||||
path: spec.proxy.noProxy
|
||||
content: "localhost"
|
||||
- contains:
|
||||
path: spec.proxy.noProxy
|
||||
content: "127.0.0.1"
|
||||
- contains:
|
||||
path: spec.proxy.noProxy
|
||||
content: ".local"
|
||||
|
||||
- it: should render proxy configuration with empty noProxy list
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy:
|
||||
http:
|
||||
url: "http://proxy.example.com:3128"
|
||||
noProxy: []
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.proxy.http.url
|
||||
value: "http://proxy.example.com:3128"
|
||||
- notExists:
|
||||
path: spec.proxy.noProxy
|
||||
|
||||
- it: should not render proxy when configured as empty object
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy: {}
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- notExists:
|
||||
path: spec.proxy
|
||||
|
||||
- it: should render proxy with only http without credentials
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy:
|
||||
http:
|
||||
url: "http://unauthenticated-proxy.example.com:8080"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.proxy.http.url
|
||||
value: "http://unauthenticated-proxy.example.com:8080"
|
||||
- notExists:
|
||||
path: spec.proxy.http.credentialSecretRef
|
||||
- notExists:
|
||||
path: spec.proxy.https
|
||||
|
||||
- it: should render proxy with https and noProxy without http
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_token12345"
|
||||
controllerServiceAccount.name: "arc"
|
||||
controllerServiceAccount.namespace: "arc-system"
|
||||
proxy:
|
||||
https:
|
||||
url: "https://secure-proxy.example.com:3128"
|
||||
noProxy:
|
||||
- "internal.example.com"
|
||||
- "*.local"
|
||||
release:
|
||||
name: "test-name"
|
||||
namespace: "test-namespace"
|
||||
asserts:
|
||||
- equal:
|
||||
path: spec.proxy.https.url
|
||||
value: "https://secure-proxy.example.com:3128"
|
||||
- notExists:
|
||||
path: spec.proxy.http
|
||||
- contains:
|
||||
path: spec.proxy.noProxy
|
||||
content: "internal.example.com"
|
||||
- contains:
|
||||
path: spec.proxy.noProxy
|
||||
content: "*.local"
|
||||
310
charts/gha-runner-scale-set-dev/values.yaml
Normal file
310
charts/gha-runner-scale-set-dev/values.yaml
Normal file
@@ -0,0 +1,310 @@
|
||||
## By default .Release.namespace is used
|
||||
namespaceOverride: ""
|
||||
|
||||
scaleset:
|
||||
# Name of the scaleset
|
||||
name: ""
|
||||
runnerGroup: "default"
|
||||
## minRunners is the min number of idle runners. The target number of runners created will be
|
||||
## calculated as a sum of minRunners and the number of jobs assigned to the scale set.
|
||||
# minRunners: 0
|
||||
## maxRunners is the max number of runners the autoscaling runner set will scale up to.
|
||||
# maxRunners: 5
|
||||
|
||||
# Auth object provides authorization parameters.
|
||||
# You should apply either:
|
||||
# 1) secretName referencing the secret containing authorization parameters in the same namespace where the scale set is being installed in
|
||||
# 2) app object parameters
|
||||
# 3) github_tokne
|
||||
#
|
||||
# If multiple of them are set, only single one will be applied based on the above mentioned order.
|
||||
auth:
|
||||
url: "" # Required
|
||||
githubToken: ""
|
||||
secretName: ""
|
||||
app:
|
||||
clientId: ""
|
||||
installationId: ""
|
||||
privateKey: ""
|
||||
|
||||
# secretResolution configures how secrets are resolved for this scale set.
|
||||
# By default, secrets are resolved using Kubernetes secrets. When Kubernetes
|
||||
# secrets are used, no proxy config will be applied.
|
||||
#
|
||||
# If you decide to use secret integrations with vaults, you can configure
|
||||
# proxy settings for the vault communication here.
|
||||
secretResolution:
|
||||
# Name of the secret resolver to use.
|
||||
# Available values:
|
||||
# - "kubernetes" - use Kubernetes secrets
|
||||
# - "azureKeyVault" - use Azure Key Vault
|
||||
type: "kubernetes"
|
||||
|
||||
## Proxy settings when type is NOT "kubernetes"
|
||||
# proxy:
|
||||
# http:
|
||||
# url: http://proxy.com:1234
|
||||
# credentialSecretRef: proxy-auth # a secret with `username` and `password` keys
|
||||
# https:
|
||||
# url: http://proxy.com:1234
|
||||
# credentialSecretRef: proxy-auth # a secret with `username` and `password` keys
|
||||
# noProxy:
|
||||
# - example.com
|
||||
# - example.org
|
||||
|
||||
## Configuration for Azure Key Vault integration
|
||||
# azureKeyVault:
|
||||
# url: ""
|
||||
# client_id: ""
|
||||
# tenant_id: ""
|
||||
# certificate_path: ""
|
||||
|
||||
## Proxy can be used to define proxy settings that will be used by the
|
||||
## controller, the listener and the runner of this scale set.
|
||||
# proxy:
|
||||
# http:
|
||||
# url: http://proxy.com:1234
|
||||
# credentialSecretRef: proxy-auth # a secret with `username` and `password` keys
|
||||
# https:
|
||||
# url: http://proxy.com:1234
|
||||
# credentialSecretRef: proxy-auth # a secret with `username` and `password` keys
|
||||
# noProxy:
|
||||
# - example.com
|
||||
# - example.org
|
||||
|
||||
## listenerTemplate is the PodSpec for each listener Pod
|
||||
## For reference: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodSpec
|
||||
# listenerPodTemplate:
|
||||
# spec:
|
||||
# containers:
|
||||
# # Use this section to append additional configuration to the listener container.
|
||||
# # If you change the name of the container, the configuration will not be applied to the listener,
|
||||
# # and it will be treated as a side-car container.
|
||||
# - name: listener
|
||||
# securityContext:
|
||||
# runAsUser: 1000
|
||||
# # Use this section to add the configuration of a side-car container.
|
||||
# # Comment it out or remove it if you don't need it.
|
||||
# # Spec for this container will be applied as is without any modifications.
|
||||
# - name: side-car
|
||||
# image: example-sidecar
|
||||
|
||||
## Resource object allows modifying resources created by the chart itself
|
||||
resource:
|
||||
# Specifies metadata that will be applied to all resources managed by ARC
|
||||
all:
|
||||
metadata:
|
||||
labels: {}
|
||||
annotations: {}
|
||||
|
||||
# Specifies metadata that will be applied to the AutoscalingRunnerSet resource
|
||||
autoscalingRunnerSet:
|
||||
metadata:
|
||||
labels: {}
|
||||
annotations: {}
|
||||
|
||||
# TODO: Add more resource customizations when needed
|
||||
|
||||
# Template applied for the runner container
|
||||
runner:
|
||||
# metadata:
|
||||
# labels: []
|
||||
# annotations: []
|
||||
|
||||
# Mode can be used to automatically add required configuration for the selected mode
|
||||
mode: "" # Available modes: "", "kubernetes", "dind"
|
||||
|
||||
# container field is applied to the container named "runner". You cannot override the name of the runner container
|
||||
container:
|
||||
image: "ghcr.io/actions/actions-runner:latest"
|
||||
command: ["/home/runner/run.sh"]
|
||||
|
||||
dind:
|
||||
# If default is set to true, we will expand the default spec for the `dind` container, and you can provide fields to override them
|
||||
default: true
|
||||
|
||||
kubernetesMode:
|
||||
default: true
|
||||
serviceAccountName: ""
|
||||
extraPermissions: []
|
||||
extension: {}
|
||||
## A self-signed CA certificate for communication with the GitHub server can be
|
||||
## provided using a config map key selector. If `runnerMountPath` is set, for
|
||||
## each runner pod ARC will:
|
||||
## - create a `github-server-tls-cert` volume containing the certificate
|
||||
## specified in `certificateFrom`
|
||||
## - mount that volume on path `runnerMountPath`/{certificate name}
|
||||
## - set NODE_EXTRA_CA_CERTS environment variable to that same path
|
||||
## - set RUNNER_UPDATE_CA_CERTS environment variable to "1" (as of version
|
||||
## 2.303.0 this will instruct the runner to reload certificates on the host)
|
||||
##
|
||||
## If any of the above had already been set by the user in the runner pod
|
||||
## template, ARC will observe those and not overwrite them.
|
||||
## Example configuration:
|
||||
#
|
||||
# githubServerTLS:
|
||||
# certificateFrom:
|
||||
# configMapKeyRef:
|
||||
# name: config-map-name
|
||||
# key: ca.crt
|
||||
# runnerMountPath: /usr/local/share/ca-certificates/
|
||||
|
||||
## controllerServiceAccount is the service account of the controller
|
||||
controllerServiceAccount:
|
||||
namespace: ""
|
||||
name: ""
|
||||
## listenerMetrics are configurable metrics applied to the listener.
|
||||
## In order to avoid helm merging these fields, we left the metrics commented out.
|
||||
## When configuring metrics, please uncomment the listenerMetrics object below.
|
||||
## You can modify the configuration to remove the label or specify custom buckets for histogram.
|
||||
##
|
||||
## If the buckets field is not specified, the default buckets will be applied. Default buckets are
|
||||
## provided here for documentation purposes
|
||||
# listenerMetrics:
|
||||
# counters:
|
||||
# gha_started_jobs_total:
|
||||
# labels:
|
||||
# ["repository", "organization", "enterprise", "job_name", "event_name", "job_workflow_ref", "job_workflow_name", "job_workflow_target"]
|
||||
# gha_completed_jobs_total:
|
||||
# labels:
|
||||
# [
|
||||
# "repository",
|
||||
# "organization",
|
||||
# "enterprise",
|
||||
# "job_name",
|
||||
# "event_name",
|
||||
# "job_result",
|
||||
# "job_workflow_ref",
|
||||
# "job_workflow_name",
|
||||
# "job_workflow_target",
|
||||
# ]
|
||||
# gauges:
|
||||
# gha_assigned_jobs:
|
||||
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
|
||||
# gha_running_jobs:
|
||||
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
|
||||
# gha_registered_runners:
|
||||
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
|
||||
# gha_busy_runners:
|
||||
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
|
||||
# gha_min_runners:
|
||||
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
|
||||
# gha_max_runners:
|
||||
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
|
||||
# gha_desired_runners:
|
||||
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
|
||||
# gha_idle_runners:
|
||||
# labels: ["name", "namespace", "repository", "organization", "enterprise"]
|
||||
# histograms:
|
||||
# gha_job_startup_duration_seconds:
|
||||
# labels:
|
||||
# ["repository", "organization", "enterprise", "job_name", "event_name","job_workflow_ref", "job_workflow_name", "job_workflow_target"]
|
||||
# buckets:
|
||||
# [
|
||||
# 0.01,
|
||||
# 0.05,
|
||||
# 0.1,
|
||||
# 0.5,
|
||||
# 1.0,
|
||||
# 2.0,
|
||||
# 3.0,
|
||||
# 4.0,
|
||||
# 5.0,
|
||||
# 6.0,
|
||||
# 7.0,
|
||||
# 8.0,
|
||||
# 9.0,
|
||||
# 10.0,
|
||||
# 12.0,
|
||||
# 15.0,
|
||||
# 18.0,
|
||||
# 20.0,
|
||||
# 25.0,
|
||||
# 30.0,
|
||||
# 40.0,
|
||||
# 50.0,
|
||||
# 60.0,
|
||||
# 70.0,
|
||||
# 80.0,
|
||||
# 90.0,
|
||||
# 100.0,
|
||||
# 110.0,
|
||||
# 120.0,
|
||||
# 150.0,
|
||||
# 180.0,
|
||||
# 210.0,
|
||||
# 240.0,
|
||||
# 300.0,
|
||||
# 360.0,
|
||||
# 420.0,
|
||||
# 480.0,
|
||||
# 540.0,
|
||||
# 600.0,
|
||||
# 900.0,
|
||||
# 1200.0,
|
||||
# 1800.0,
|
||||
# 2400.0,
|
||||
# 3000.0,
|
||||
# 3600.0,
|
||||
# ]
|
||||
# gha_job_execution_duration_seconds:
|
||||
# labels:
|
||||
# [
|
||||
# "repository",
|
||||
# "organization",
|
||||
# "enterprise",
|
||||
# "job_name",
|
||||
# "event_name",
|
||||
# "job_result",
|
||||
# "job_workflow_ref",
|
||||
# "job_workflow_name",
|
||||
# "job_workflow_target"
|
||||
# ]
|
||||
# buckets:
|
||||
# [
|
||||
# 0.01,
|
||||
# 0.05,
|
||||
# 0.1,
|
||||
# 0.5,
|
||||
# 1.0,
|
||||
# 2.0,
|
||||
# 3.0,
|
||||
# 4.0,
|
||||
# 5.0,
|
||||
# 6.0,
|
||||
# 7.0,
|
||||
# 8.0,
|
||||
# 9.0,
|
||||
# 10.0,
|
||||
# 12.0,
|
||||
# 15.0,
|
||||
# 18.0,
|
||||
# 20.0,
|
||||
# 25.0,
|
||||
# 30.0,
|
||||
# 40.0,
|
||||
# 50.0,
|
||||
# 60.0,
|
||||
# 70.0,
|
||||
# 80.0,
|
||||
# 90.0,
|
||||
# 100.0,
|
||||
# 110.0,
|
||||
# 120.0,
|
||||
# 150.0,
|
||||
# 180.0,
|
||||
# 210.0,
|
||||
# 240.0,
|
||||
# 300.0,
|
||||
# 360.0,
|
||||
# 420.0,
|
||||
# 480.0,
|
||||
# 540.0,
|
||||
# 600.0,
|
||||
# 900.0,
|
||||
# 1200.0,
|
||||
# 1800.0,
|
||||
# 2400.0,
|
||||
# 3000.0,
|
||||
# 3600.0,
|
||||
# ]
|
||||
@@ -21,3 +21,4 @@
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
tests/
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
suite: "AutoscalingRunnerSet"
|
||||
templates:
|
||||
- autoscalingrunnserset.yaml
|
||||
tests:
|
||||
- it: should render base labels
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
auth.url: "https://github.com/org"
|
||||
auth.githubToken: "gh_"
|
||||
@@ -403,7 +403,7 @@ func TestTemplateRenderedAutoScalingRunnerSet(t *testing.T) {
|
||||
assert.Equal(t, "autoscaling-runner-set", ars.Labels["app.kubernetes.io/component"])
|
||||
assert.NotEmpty(t, ars.Labels["app.kubernetes.io/version"])
|
||||
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
||||
|
||||
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
||||
@@ -456,7 +456,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_RunnerScaleSetName(t *testing.T) {
|
||||
assert.Equal(t, nameOverride, ars.Labels["actions.github.com/scale-set-name"])
|
||||
assert.Equal(t, namespaceName, ars.Labels["actions.github.com/scale-set-namespace"])
|
||||
assert.Equal(t, "gha-rs", ars.Labels["app.kubernetes.io/part-of"])
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||
assert.Equal(t, nameOverride+"-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
||||
assert.Equal(t, "test-runner-scale-set-name", ars.Spec.RunnerScaleSetName)
|
||||
|
||||
@@ -913,7 +913,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableDinD(t *testing.T) {
|
||||
|
||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
||||
|
||||
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
||||
@@ -1000,7 +1000,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableKubernetesMode(t *testing.T)
|
||||
|
||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
||||
|
||||
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
||||
@@ -1058,7 +1058,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableKubernetesModeNoVolume(t *te
|
||||
|
||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||
assert.Equal(t, "test-runners-gha-rs-github-secret", ars.Spec.GitHubConfigSecret)
|
||||
|
||||
assert.Empty(t, ars.Spec.RunnerGroup, "RunnerGroup should be empty")
|
||||
@@ -1160,7 +1160,7 @@ func TestTemplateRenderedAutoScalingRunnerSet_UsePredefinedSecret(t *testing.T)
|
||||
|
||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/name"])
|
||||
assert.Equal(t, "test-runners", ars.Labels["app.kubernetes.io/instance"])
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||
assert.Equal(t, "pre-defined-secrets", ars.Spec.GitHubConfigSecret)
|
||||
}
|
||||
|
||||
@@ -1224,11 +1224,11 @@ func TestTemplateRenderedWithProxy(t *testing.T) {
|
||||
|
||||
require.NotNil(t, ars.Spec.Proxy)
|
||||
require.NotNil(t, ars.Spec.Proxy.HTTP)
|
||||
assert.Equal(t, "http://proxy.example.com", ars.Spec.Proxy.HTTP.Url)
|
||||
assert.Equal(t, "http://proxy.example.com", ars.Spec.Proxy.HTTP.URL)
|
||||
assert.Equal(t, "http-secret", ars.Spec.Proxy.HTTP.CredentialSecretRef)
|
||||
|
||||
require.NotNil(t, ars.Spec.Proxy.HTTPS)
|
||||
assert.Equal(t, "https://proxy.example.com", ars.Spec.Proxy.HTTPS.Url)
|
||||
assert.Equal(t, "https://proxy.example.com", ars.Spec.Proxy.HTTPS.URL)
|
||||
assert.Equal(t, "https-secret", ars.Spec.Proxy.HTTPS.CredentialSecretRef)
|
||||
|
||||
require.NotNil(t, ars.Spec.Proxy.NoProxy)
|
||||
@@ -1803,7 +1803,7 @@ func TestTemplateRenderedGitHubConfigUrlEndsWIthSlash(t *testing.T) {
|
||||
|
||||
assert.Equal(t, namespaceName, ars.Namespace)
|
||||
assert.Equal(t, "test-runners", ars.Name)
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigUrl)
|
||||
assert.Equal(t, "https://github.com/actions", ars.Spec.GitHubConfigURL)
|
||||
}
|
||||
|
||||
func TestTemplate_CreateManagerRole(t *testing.T) {
|
||||
|
||||
@@ -114,10 +114,10 @@ func (w *Worker) HandleJobStarted(ctx context.Context, jobInfo *actions.JobStart
|
||||
patch, err := json.Marshal(
|
||||
&v1alpha1.EphemeralRunner{
|
||||
Status: v1alpha1.EphemeralRunnerStatus{
|
||||
JobRequestId: jobInfo.RunnerRequestID,
|
||||
JobRequestID: jobInfo.RunnerRequestID,
|
||||
JobRepositoryName: fmt.Sprintf("%s/%s", jobInfo.OwnerName, jobInfo.RepositoryName),
|
||||
JobID: jobInfo.JobID,
|
||||
WorkflowRunId: jobInfo.WorkflowRunID,
|
||||
WorkflowRunID: jobInfo.WorkflowRunID,
|
||||
JobWorkflowRef: jobInfo.JobWorkflowRef,
|
||||
JobDisplayName: jobInfo.JobDisplayName,
|
||||
},
|
||||
|
||||
@@ -16323,6 +16323,8 @@ spec:
|
||||
It is used to identify which vault integration should be used to resolve secrets.
|
||||
type: string
|
||||
type: object
|
||||
required:
|
||||
- template
|
||||
type: object
|
||||
status:
|
||||
description: AutoscalingRunnerSetStatus defines the observed state of AutoscalingRunnerSet
|
||||
@@ -16338,6 +16340,10 @@ spec:
|
||||
state:
|
||||
type: string
|
||||
type: object
|
||||
required:
|
||||
- metadata
|
||||
- spec
|
||||
- status
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
|
||||
@@ -8271,6 +8271,10 @@ spec:
|
||||
format: int64
|
||||
type: integer
|
||||
type: object
|
||||
required:
|
||||
- metadata
|
||||
- spec
|
||||
- status
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
|
||||
@@ -8223,6 +8223,7 @@ spec:
|
||||
description: Replicas is the number of desired EphemeralRunner resources in the k8s namespace.
|
||||
type: integer
|
||||
required:
|
||||
- ephemeralRunnerSpec
|
||||
- patchID
|
||||
type: object
|
||||
status:
|
||||
@@ -8240,6 +8241,10 @@ spec:
|
||||
required:
|
||||
- currentReplicas
|
||||
type: object
|
||||
required:
|
||||
- metadata
|
||||
- spec
|
||||
- status
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
|
||||
@@ -668,7 +668,7 @@ func (r *AutoscalingListenerReconciler) createRoleBindingForListener(ctx context
|
||||
}
|
||||
|
||||
func (r *AutoscalingListenerReconciler) publishRunningListener(autoscalingListener *v1alpha1.AutoscalingListener, isUp bool) error {
|
||||
githubConfigURL := autoscalingListener.Spec.GitHubConfigUrl
|
||||
githubConfigURL := autoscalingListener.Spec.GitHubConfigURL
|
||||
parsedURL, err := actions.ParseGitHubConfigFromURL(githubConfigURL)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -66,7 +66,7 @@ var _ = Describe("Test AutoScalingListener controller", func() {
|
||||
Namespace: autoscalingNS.Name,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
@@ -92,9 +92,9 @@ var _ = Describe("Test AutoScalingListener controller", func() {
|
||||
Namespace: autoscalingNS.Name,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
RunnerScaleSetId: 1,
|
||||
RunnerScaleSetID: 1,
|
||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||
EphemeralRunnerSetName: "test-ers",
|
||||
@@ -482,7 +482,7 @@ var _ = Describe("Test AutoScalingListener customization", func() {
|
||||
Namespace: autoscalingNS.Name,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
@@ -508,9 +508,9 @@ var _ = Describe("Test AutoScalingListener customization", func() {
|
||||
Namespace: autoscalingNS.Name,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
RunnerScaleSetId: 1,
|
||||
RunnerScaleSetID: 1,
|
||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||
EphemeralRunnerSetName: "test-ers",
|
||||
@@ -740,7 +740,7 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() {
|
||||
Namespace: autoscalingNS.Name,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
@@ -767,9 +767,9 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() {
|
||||
Namespace: autoscalingNS.Name,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
RunnerScaleSetId: 1,
|
||||
RunnerScaleSetID: 1,
|
||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||
EphemeralRunnerSetName: "test-ers",
|
||||
@@ -823,11 +823,11 @@ var _ = Describe("Test AutoScalingListener controller with proxy", func() {
|
||||
|
||||
proxy := &v1alpha1.ProxyConfig{
|
||||
HTTP: &v1alpha1.ProxyServerConfig{
|
||||
Url: "http://localhost:8080",
|
||||
URL: "http://localhost:8080",
|
||||
CredentialSecretRef: "proxy-credentials",
|
||||
},
|
||||
HTTPS: &v1alpha1.ProxyServerConfig{
|
||||
Url: "https://localhost:8443",
|
||||
URL: "https://localhost:8443",
|
||||
CredentialSecretRef: "proxy-credentials",
|
||||
},
|
||||
NoProxy: []string{
|
||||
@@ -942,7 +942,7 @@ var _ = Describe("Test AutoScalingListener controller with template modification
|
||||
Namespace: autoscalingNS.Name,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
@@ -969,9 +969,9 @@ var _ = Describe("Test AutoScalingListener controller with template modification
|
||||
Namespace: autoscalingNS.Name,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
RunnerScaleSetId: 1,
|
||||
RunnerScaleSetID: 1,
|
||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||
EphemeralRunnerSetName: "test-ers",
|
||||
@@ -1137,7 +1137,7 @@ var _ = Describe("Test GitHub Server TLS configuration", func() {
|
||||
Namespace: autoscalingNS.Name,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||
@@ -1173,7 +1173,7 @@ var _ = Describe("Test GitHub Server TLS configuration", func() {
|
||||
Namespace: autoscalingNS.Name,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||
@@ -1185,7 +1185,7 @@ var _ = Describe("Test GitHub Server TLS configuration", func() {
|
||||
},
|
||||
},
|
||||
},
|
||||
RunnerScaleSetId: 1,
|
||||
RunnerScaleSetID: 1,
|
||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||
EphemeralRunnerSetName: "test-ers",
|
||||
|
||||
@@ -468,7 +468,7 @@ func (r *AutoscalingRunnerSetReconciler) createRunnerScaleSet(ctx context.Contex
|
||||
obj.Annotations[AnnotationKeyGitHubRunnerScaleSetName] = runnerScaleSet.Name
|
||||
obj.Annotations[runnerScaleSetIDAnnotationKey] = strconv.Itoa(runnerScaleSet.Id)
|
||||
obj.Annotations[AnnotationKeyGitHubRunnerGroupName] = runnerScaleSet.RunnerGroupName
|
||||
if err := applyGitHubURLLabels(obj.Spec.GitHubConfigUrl, obj.Labels); err != nil { // should never happen
|
||||
if err := applyGitHubURLLabels(obj.Spec.GitHubConfigURL, obj.Labels); err != nil { // should never happen
|
||||
logger.Error(err, "Failed to apply GitHub URL labels")
|
||||
}
|
||||
}); err != nil {
|
||||
|
||||
@@ -90,7 +90,7 @@ var _ = Describe("Test AutoScalingRunnerSet controller", Ordered, func() {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
@@ -734,7 +734,7 @@ var _ = Describe("Test AutoScalingController updates", Ordered, func() {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
@@ -854,7 +854,7 @@ var _ = Describe("Test AutoscalingController creation failures", Ordered, func()
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
RunnerGroup: "testgroup",
|
||||
@@ -992,14 +992,14 @@ var _ = Describe("Test client optional configuration", Ordered, func() {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "http://example.com/org/repo",
|
||||
GitHubConfigURL: "http://example.com/org/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
RunnerGroup: "testgroup",
|
||||
Proxy: &v1alpha1.ProxyConfig{
|
||||
HTTP: &v1alpha1.ProxyServerConfig{
|
||||
Url: proxy.URL,
|
||||
URL: proxy.URL,
|
||||
},
|
||||
},
|
||||
Template: corev1.PodTemplateSpec{
|
||||
@@ -1071,14 +1071,14 @@ var _ = Describe("Test client optional configuration", Ordered, func() {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "http://example.com/org/repo",
|
||||
GitHubConfigURL: "http://example.com/org/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
RunnerGroup: "testgroup",
|
||||
Proxy: &v1alpha1.ProxyConfig{
|
||||
HTTP: &v1alpha1.ProxyServerConfig{
|
||||
Url: proxy.URL,
|
||||
URL: proxy.URL,
|
||||
CredentialSecretRef: "proxy-credentials",
|
||||
},
|
||||
},
|
||||
@@ -1198,7 +1198,7 @@ var _ = Describe("Test client optional configuration", Ordered, func() {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: server.ConfigURLForOrg("my-org"),
|
||||
GitHubConfigURL: server.ConfigURLForOrg("my-org"),
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||
@@ -1251,7 +1251,7 @@ var _ = Describe("Test client optional configuration", Ordered, func() {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||
@@ -1315,7 +1315,7 @@ var _ = Describe("Test client optional configuration", Ordered, func() {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||
@@ -1419,7 +1419,7 @@ var _ = Describe("Test external permissions cleanup", Ordered, func() {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
@@ -1583,7 +1583,7 @@ var _ = Describe("Test external permissions cleanup", Ordered, func() {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
RunnerGroup: "testgroup",
|
||||
@@ -1799,7 +1799,7 @@ var _ = Describe("Test resource version and build version mismatch", func() {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
MaxRunners: &max,
|
||||
MinRunners: &min,
|
||||
|
||||
@@ -202,7 +202,7 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
|
||||
}
|
||||
}
|
||||
|
||||
if ephemeralRunner.Status.RunnerId == 0 {
|
||||
if ephemeralRunner.Status.RunnerID == 0 {
|
||||
log.Info("Updating ephemeral runner status with runnerId and runnerName")
|
||||
runnerID, err := strconv.Atoi(string(secret.Data["runnerId"]))
|
||||
if err != nil {
|
||||
@@ -217,12 +217,12 @@ func (r *EphemeralRunnerReconciler) Reconcile(ctx context.Context, req ctrl.Requ
|
||||
|
||||
runnerName := string(secret.Data["runnerName"])
|
||||
if err := patchSubResource(ctx, r.Status(), ephemeralRunner, func(obj *v1alpha1.EphemeralRunner) {
|
||||
obj.Status.RunnerId = runnerID
|
||||
obj.Status.RunnerID = runnerID
|
||||
obj.Status.RunnerName = runnerName
|
||||
}); err != nil {
|
||||
return ctrl.Result{}, fmt.Errorf("failed to update runner status for RunnerId/RunnerName/RunnerJITConfig: %w", err)
|
||||
}
|
||||
ephemeralRunner.Status.RunnerId = runnerID
|
||||
ephemeralRunner.Status.RunnerID = runnerID
|
||||
ephemeralRunner.Status.RunnerName = runnerName
|
||||
log.Info("Updated ephemeral runner status with runnerId and runnerName")
|
||||
}
|
||||
@@ -391,7 +391,7 @@ func (r *EphemeralRunnerReconciler) deleteEphemeralRunnerOrPod(ctx context.Conte
|
||||
log.Error(err, "Failed to get actions client for removing the runner from the service")
|
||||
return nil
|
||||
}
|
||||
if err := actionsClient.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerId)); err != nil {
|
||||
if err := actionsClient.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerID)); err != nil {
|
||||
log.Error(err, "Failed to remove the runner from the service")
|
||||
return nil
|
||||
}
|
||||
@@ -618,7 +618,7 @@ func (r *EphemeralRunnerReconciler) createRunnerJitConfig(ctx context.Context, e
|
||||
}
|
||||
}
|
||||
|
||||
jitConfig, err := actionsClient.GenerateJitRunnerConfig(ctx, jitSettings, ephemeralRunner.Spec.RunnerScaleSetId)
|
||||
jitConfig, err := actionsClient.GenerateJitRunnerConfig(ctx, jitSettings, ephemeralRunner.Spec.RunnerScaleSetID)
|
||||
if err == nil { // if NO error
|
||||
log.Info("Created ephemeral runner JIT config", "runnerId", jitConfig.Runner.Id)
|
||||
return jitConfig, nil
|
||||
@@ -653,7 +653,7 @@ func (r *EphemeralRunnerReconciler) createRunnerJitConfig(ctx context.Context, e
|
||||
}
|
||||
|
||||
log.Info("Found the runner with the same name", "runnerId", existingRunner.Id, "runnerScaleSetId", existingRunner.RunnerScaleSetId)
|
||||
if existingRunner.RunnerScaleSetId == ephemeralRunner.Spec.RunnerScaleSetId {
|
||||
if existingRunner.RunnerScaleSetId == ephemeralRunner.Spec.RunnerScaleSetID {
|
||||
log.Info("Removing the runner with the same name")
|
||||
err := actionsClient.RemoveRunner(ctx, int64(existingRunner.Id))
|
||||
if err != nil {
|
||||
@@ -731,10 +731,10 @@ func (r *EphemeralRunnerReconciler) createPod(ctx context.Context, runner *v1alp
|
||||
}
|
||||
|
||||
log.Info("Created ephemeral runner pod",
|
||||
"runnerScaleSetId", runner.Spec.RunnerScaleSetId,
|
||||
"runnerScaleSetId", runner.Spec.RunnerScaleSetID,
|
||||
"runnerName", runner.Status.RunnerName,
|
||||
"runnerId", runner.Status.RunnerId,
|
||||
"configUrl", runner.Spec.GitHubConfigUrl,
|
||||
"runnerId", runner.Status.RunnerID,
|
||||
"configUrl", runner.Spec.GitHubConfigURL,
|
||||
"podName", newPod.Name)
|
||||
|
||||
return ctrl.Result{}, nil
|
||||
@@ -810,13 +810,13 @@ func (r *EphemeralRunnerReconciler) deleteRunnerFromService(ctx context.Context,
|
||||
return fmt.Errorf("failed to get actions client for runner: %w", err)
|
||||
}
|
||||
|
||||
log.Info("Removing runner from the service", "runnerId", ephemeralRunner.Status.RunnerId)
|
||||
err = client.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerId))
|
||||
log.Info("Removing runner from the service", "runnerId", ephemeralRunner.Status.RunnerID)
|
||||
err = client.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerID))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to remove runner from the service: %w", err)
|
||||
}
|
||||
|
||||
log.Info("Removed runner from the service", "runnerId", ephemeralRunner.Status.RunnerId)
|
||||
log.Info("Removed runner from the service", "runnerId", ephemeralRunner.Status.RunnerID)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,9 @@ func newExampleRunner(name, namespace, configSecretName string) *v1alpha1.Epheme
|
||||
Namespace: namespace,
|
||||
},
|
||||
Spec: v1alpha1.EphemeralRunnerSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecretName,
|
||||
RunnerScaleSetId: 1,
|
||||
RunnerScaleSetID: 1,
|
||||
PodTemplateSpec: corev1.PodTemplateSpec{
|
||||
Spec: corev1.PodSpec{
|
||||
Containers: []corev1.Container{
|
||||
@@ -667,7 +667,7 @@ var _ = Describe("EphemeralRunner", func() {
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return updatedEphemeralRunner.Status.RunnerId, nil
|
||||
return updatedEphemeralRunner.Status.RunnerID, nil
|
||||
},
|
||||
ephemeralRunnerTimeout,
|
||||
ephemeralRunnerInterval,
|
||||
@@ -1234,10 +1234,10 @@ var _ = Describe("EphemeralRunner", func() {
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to create secret credentials")
|
||||
|
||||
ephemeralRunner := newExampleRunner("test-runner", autoScalingNS.Name, configSecret.Name)
|
||||
ephemeralRunner.Spec.GitHubConfigUrl = "http://example.com/org/repo"
|
||||
ephemeralRunner.Spec.GitHubConfigURL = "http://example.com/org/repo"
|
||||
ephemeralRunner.Spec.Proxy = &v1alpha1.ProxyConfig{
|
||||
HTTP: &v1alpha1.ProxyServerConfig{
|
||||
Url: proxy.URL,
|
||||
URL: proxy.URL,
|
||||
CredentialSecretRef: "proxy-credentials",
|
||||
},
|
||||
}
|
||||
@@ -1258,10 +1258,10 @@ var _ = Describe("EphemeralRunner", func() {
|
||||
ephemeralRunner := newExampleRunner("test-runner", autoScalingNS.Name, configSecret.Name)
|
||||
ephemeralRunner.Spec.Proxy = &v1alpha1.ProxyConfig{
|
||||
HTTP: &v1alpha1.ProxyServerConfig{
|
||||
Url: "http://proxy.example.com:8080",
|
||||
URL: "http://proxy.example.com:8080",
|
||||
},
|
||||
HTTPS: &v1alpha1.ProxyServerConfig{
|
||||
Url: "http://proxy.example.com:8080",
|
||||
URL: "http://proxy.example.com:8080",
|
||||
},
|
||||
NoProxy: []string{"example.com"},
|
||||
}
|
||||
@@ -1398,7 +1398,7 @@ var _ = Describe("EphemeralRunner", func() {
|
||||
}
|
||||
|
||||
ephemeralRunner := newExampleRunner("test-runner", autoScalingNS.Name, configSecret.Name)
|
||||
ephemeralRunner.Spec.GitHubConfigUrl = server.ConfigURLForOrg("my-org")
|
||||
ephemeralRunner.Spec.GitHubConfigURL = server.ConfigURLForOrg("my-org")
|
||||
ephemeralRunner.Spec.GitHubServerTLS = &v1alpha1.TLSConfig{
|
||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||
ConfigMapKeyRef: &corev1.ConfigMapKeySelector{
|
||||
|
||||
@@ -167,7 +167,7 @@ func (r *EphemeralRunnerSetReconciler) Reconcile(ctx context.Context, req ctrl.R
|
||||
)
|
||||
|
||||
if r.PublishMetrics {
|
||||
githubConfigURL := ephemeralRunnerSet.Spec.EphemeralRunnerSpec.GitHubConfigUrl
|
||||
githubConfigURL := ephemeralRunnerSet.Spec.EphemeralRunnerSpec.GitHubConfigURL
|
||||
parsedURL, err := actions.ParseGitHubConfigFromURL(githubConfigURL)
|
||||
if err != nil {
|
||||
log.Error(err, "Github Config URL is invalid", "URL", githubConfigURL)
|
||||
@@ -448,7 +448,7 @@ func (r *EphemeralRunnerSetReconciler) deleteIdleEphemeralRunners(ctx context.Co
|
||||
for runners.next() {
|
||||
ephemeralRunner := runners.object()
|
||||
isDone := ephemeralRunner.IsDone()
|
||||
if !isDone && ephemeralRunner.Status.RunnerId == 0 {
|
||||
if !isDone && ephemeralRunner.Status.RunnerID == 0 {
|
||||
log.Info("Skipping ephemeral runner since it is not registered yet", "name", ephemeralRunner.Name)
|
||||
continue
|
||||
}
|
||||
@@ -457,7 +457,7 @@ func (r *EphemeralRunnerSetReconciler) deleteIdleEphemeralRunners(ctx context.Co
|
||||
log.Info(
|
||||
"Skipping ephemeral runner since it is running a job",
|
||||
"name", ephemeralRunner.Name,
|
||||
"workflowRunId", ephemeralRunner.Status.WorkflowRunId,
|
||||
"workflowRunId", ephemeralRunner.Status.WorkflowRunID,
|
||||
"jobId", ephemeralRunner.Status.JobID,
|
||||
)
|
||||
continue
|
||||
@@ -482,28 +482,28 @@ func (r *EphemeralRunnerSetReconciler) deleteIdleEphemeralRunners(ctx context.Co
|
||||
}
|
||||
|
||||
func (r *EphemeralRunnerSetReconciler) deleteEphemeralRunnerWithActionsClient(ctx context.Context, ephemeralRunner *v1alpha1.EphemeralRunner, actionsClient actions.ActionsService, log logr.Logger) (bool, error) {
|
||||
if err := actionsClient.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerId)); err != nil {
|
||||
if err := actionsClient.RemoveRunner(ctx, int64(ephemeralRunner.Status.RunnerID)); err != nil {
|
||||
actionsError := &actions.ActionsError{}
|
||||
if !errors.As(err, &actionsError) {
|
||||
log.Error(err, "failed to remove runner from the service", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerId)
|
||||
log.Error(err, "failed to remove runner from the service", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerID)
|
||||
return false, err
|
||||
}
|
||||
|
||||
if actionsError.StatusCode == http.StatusBadRequest &&
|
||||
actionsError.IsException("JobStillRunningException") {
|
||||
log.Info("Runner is still running a job, skipping deletion", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerId)
|
||||
log.Info("Runner is still running a job, skipping deletion", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerID)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return false, err
|
||||
}
|
||||
|
||||
log.Info("Deleting ephemeral runner after removing from the service", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerId)
|
||||
log.Info("Deleting ephemeral runner after removing from the service", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerID)
|
||||
if err := r.Delete(ctx, ephemeralRunner); err != nil && !kerrors.IsNotFound(err) {
|
||||
return false, err
|
||||
}
|
||||
|
||||
log.Info("Deleted ephemeral runner", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerId)
|
||||
log.Info("Deleted ephemeral runner", "name", ephemeralRunner.Name, "runnerId", ephemeralRunner.Status.RunnerID)
|
||||
return true, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -73,9 +73,9 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
||||
},
|
||||
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
||||
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
||||
GitHubConfigUrl: "https://github.com/owner/repo",
|
||||
GitHubConfigURL: "https://github.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
RunnerScaleSetId: 100,
|
||||
RunnerScaleSetID: 100,
|
||||
PodTemplateSpec: corev1.PodTemplateSpec{
|
||||
Spec: corev1.PodSpec{
|
||||
Containers: []corev1.Container{
|
||||
@@ -158,10 +158,10 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
||||
// Set status to simulate a configured EphemeralRunner
|
||||
refetch := false
|
||||
for i, runner := range runnerList.Items {
|
||||
if runner.Status.RunnerId == 0 {
|
||||
if runner.Status.RunnerID == 0 {
|
||||
updatedRunner := runner.DeepCopy()
|
||||
updatedRunner.Status.Phase = corev1.PodRunning
|
||||
updatedRunner.Status.RunnerId = i + 100
|
||||
updatedRunner.Status.RunnerID = i + 100
|
||||
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner))
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
||||
refetch = true
|
||||
@@ -218,10 +218,10 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
||||
// Set status to simulate a configured EphemeralRunner
|
||||
refetch := false
|
||||
for i, runner := range runnerList.Items {
|
||||
if runner.Status.RunnerId == 0 {
|
||||
if runner.Status.RunnerID == 0 {
|
||||
updatedRunner := runner.DeepCopy()
|
||||
updatedRunner.Status.Phase = corev1.PodRunning
|
||||
updatedRunner.Status.RunnerId = i + 100
|
||||
updatedRunner.Status.RunnerID = i + 100
|
||||
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner))
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
||||
refetch = true
|
||||
@@ -776,12 +776,12 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
||||
// Now, let's say ephemeral runner controller patched these ephemeral runners with the registration.
|
||||
|
||||
updatedRunner = runnerList.Items[0].DeepCopy()
|
||||
updatedRunner.Status.RunnerId = 1
|
||||
updatedRunner.Status.RunnerID = 1
|
||||
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runnerList.Items[0]))
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
||||
|
||||
updatedRunner = runnerList.Items[1].DeepCopy()
|
||||
updatedRunner.Status.RunnerId = 2
|
||||
updatedRunner.Status.RunnerID = 2
|
||||
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runnerList.Items[1]))
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
||||
|
||||
@@ -942,7 +942,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
||||
var failedOriginal *v1alpha1.EphemeralRunner
|
||||
var empty []*v1alpha1.EphemeralRunner
|
||||
for _, runner := range runnerList.Items {
|
||||
switch runner.Status.RunnerId {
|
||||
switch runner.Status.RunnerID {
|
||||
case 101:
|
||||
pendingOriginal = runner.DeepCopy()
|
||||
case 102:
|
||||
@@ -961,7 +961,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
||||
empty = empty[1:]
|
||||
|
||||
pending := pendingOriginal.DeepCopy()
|
||||
pending.Status.RunnerId = 101
|
||||
pending.Status.RunnerID = 101
|
||||
pending.Status.Phase = corev1.PodPending
|
||||
|
||||
err = k8sClient.Status().Patch(ctx, pending, client.MergeFrom(pendingOriginal))
|
||||
@@ -975,7 +975,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
||||
runningOriginal = empty[0]
|
||||
empty = empty[1:]
|
||||
running := runningOriginal.DeepCopy()
|
||||
running.Status.RunnerId = 102
|
||||
running.Status.RunnerID = 102
|
||||
running.Status.Phase = corev1.PodRunning
|
||||
|
||||
err = k8sClient.Status().Patch(ctx, running, client.MergeFrom(runningOriginal))
|
||||
@@ -989,7 +989,7 @@ var _ = Describe("Test EphemeralRunnerSet controller", func() {
|
||||
failedOriginal = empty[0]
|
||||
|
||||
failed := pendingOriginal.DeepCopy()
|
||||
failed.Status.RunnerId = 103
|
||||
failed.Status.RunnerID = 103
|
||||
failed.Status.Phase = corev1.PodFailed
|
||||
|
||||
err = k8sClient.Status().Patch(ctx, failed, client.MergeFrom(failedOriginal))
|
||||
@@ -1138,16 +1138,16 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func(
|
||||
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
||||
Replicas: 1,
|
||||
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
||||
GitHubConfigUrl: "http://example.com/owner/repo",
|
||||
GitHubConfigURL: "http://example.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
RunnerScaleSetId: 100,
|
||||
RunnerScaleSetID: 100,
|
||||
Proxy: &v1alpha1.ProxyConfig{
|
||||
HTTP: &v1alpha1.ProxyServerConfig{
|
||||
Url: "http://proxy.example.com",
|
||||
URL: "http://proxy.example.com",
|
||||
CredentialSecretRef: secretCredentials.Name,
|
||||
},
|
||||
HTTPS: &v1alpha1.ProxyServerConfig{
|
||||
Url: "https://proxy.example.com",
|
||||
URL: "https://proxy.example.com",
|
||||
CredentialSecretRef: secretCredentials.Name,
|
||||
},
|
||||
NoProxy: []string{"example.com", "example.org"},
|
||||
@@ -1224,10 +1224,10 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func(
|
||||
// Set status to simulate a configured EphemeralRunner
|
||||
refetch := false
|
||||
for i, runner := range runnerList.Items {
|
||||
if runner.Status.RunnerId == 0 {
|
||||
if runner.Status.RunnerID == 0 {
|
||||
updatedRunner := runner.DeepCopy()
|
||||
updatedRunner.Status.Phase = corev1.PodSucceeded
|
||||
updatedRunner.Status.RunnerId = i + 100
|
||||
updatedRunner.Status.RunnerID = i + 100
|
||||
err = k8sClient.Status().Patch(ctx, updatedRunner, client.MergeFrom(&runner))
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to update EphemeralRunner")
|
||||
refetch = true
|
||||
@@ -1317,12 +1317,12 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func(
|
||||
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
||||
Replicas: 1,
|
||||
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
||||
GitHubConfigUrl: "http://example.com/owner/repo",
|
||||
GitHubConfigURL: "http://example.com/owner/repo",
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
RunnerScaleSetId: 100,
|
||||
RunnerScaleSetID: 100,
|
||||
Proxy: &v1alpha1.ProxyConfig{
|
||||
HTTP: &v1alpha1.ProxyServerConfig{
|
||||
Url: proxy.URL,
|
||||
URL: proxy.URL,
|
||||
CredentialSecretRef: "proxy-credentials",
|
||||
},
|
||||
},
|
||||
@@ -1358,7 +1358,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with proxy settings", func(
|
||||
|
||||
runner := runnerList.Items[0].DeepCopy()
|
||||
runner.Status.Phase = corev1.PodRunning
|
||||
runner.Status.RunnerId = 100
|
||||
runner.Status.RunnerID = 100
|
||||
err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0]))
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status")
|
||||
|
||||
@@ -1460,7 +1460,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func(
|
||||
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
||||
Replicas: 1,
|
||||
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
||||
GitHubConfigUrl: server.ConfigURLForOrg("my-org"),
|
||||
GitHubConfigURL: server.ConfigURLForOrg("my-org"),
|
||||
GitHubConfigSecret: configSecret.Name,
|
||||
GitHubServerTLS: &v1alpha1.TLSConfig{
|
||||
CertificateFrom: &v1alpha1.TLSCertificateSource{
|
||||
@@ -1472,7 +1472,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func(
|
||||
},
|
||||
},
|
||||
},
|
||||
RunnerScaleSetId: 100,
|
||||
RunnerScaleSetID: 100,
|
||||
PodTemplateSpec: corev1.PodTemplateSpec{
|
||||
Spec: corev1.PodSpec{
|
||||
Containers: []corev1.Container{
|
||||
@@ -1508,7 +1508,7 @@ var _ = Describe("Test EphemeralRunnerSet controller with custom root CA", func(
|
||||
Expect(runner.Spec.GitHubServerTLS).To(BeEquivalentTo(ephemeralRunnerSet.Spec.EphemeralRunnerSpec.GitHubServerTLS), "runner tls config should be correct")
|
||||
|
||||
runner.Status.Phase = corev1.PodRunning
|
||||
runner.Status.RunnerId = 100
|
||||
runner.Status.RunnerID = 100
|
||||
err = k8sClient.Status().Patch(ctx, runner, client.MergeFrom(&runnerList.Items[0]))
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to update ephemeral runner status")
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ func (b *ResourceBuilder) newAutoScalingListener(autoscalingRunnerSet *v1alpha1.
|
||||
annotationKeyValuesHash: autoscalingRunnerSet.Annotations[annotationKeyValuesHash],
|
||||
}
|
||||
|
||||
if err := applyGitHubURLLabels(autoscalingRunnerSet.Spec.GitHubConfigUrl, labels); err != nil {
|
||||
if err := applyGitHubURLLabels(autoscalingRunnerSet.Spec.GitHubConfigURL, labels); err != nil {
|
||||
return nil, fmt.Errorf("failed to apply GitHub URL labels: %v", err)
|
||||
}
|
||||
|
||||
@@ -121,10 +121,10 @@ func (b *ResourceBuilder) newAutoScalingListener(autoscalingRunnerSet *v1alpha1.
|
||||
Annotations: annotations,
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingListenerSpec{
|
||||
GitHubConfigUrl: autoscalingRunnerSet.Spec.GitHubConfigUrl,
|
||||
GitHubConfigURL: autoscalingRunnerSet.Spec.GitHubConfigURL,
|
||||
GitHubConfigSecret: autoscalingRunnerSet.Spec.GitHubConfigSecret,
|
||||
VaultConfig: autoscalingRunnerSet.VaultConfig(),
|
||||
RunnerScaleSetId: runnerScaleSetID,
|
||||
RunnerScaleSetID: runnerScaleSetID,
|
||||
AutoscalingRunnerSetNamespace: autoscalingRunnerSet.Namespace,
|
||||
AutoscalingRunnerSetName: autoscalingRunnerSet.Name,
|
||||
EphemeralRunnerSetName: ephemeralRunnerSet.Name,
|
||||
@@ -174,12 +174,12 @@ func (b *ResourceBuilder) newScaleSetListenerConfig(autoscalingListener *v1alpha
|
||||
}
|
||||
|
||||
config := ghalistenerconfig.Config{
|
||||
ConfigureUrl: autoscalingListener.Spec.GitHubConfigUrl,
|
||||
ConfigureUrl: autoscalingListener.Spec.GitHubConfigURL,
|
||||
EphemeralRunnerSetNamespace: autoscalingListener.Spec.AutoscalingRunnerSetNamespace,
|
||||
EphemeralRunnerSetName: autoscalingListener.Spec.EphemeralRunnerSetName,
|
||||
MaxRunners: autoscalingListener.Spec.MaxRunners,
|
||||
MinRunners: autoscalingListener.Spec.MinRunners,
|
||||
RunnerScaleSetId: autoscalingListener.Spec.RunnerScaleSetId,
|
||||
RunnerScaleSetId: autoscalingListener.Spec.RunnerScaleSetID,
|
||||
RunnerScaleSetName: autoscalingListener.Spec.AutoscalingRunnerSetName,
|
||||
ServerRootCA: cert,
|
||||
LogLevel: scaleSetListenerLogLevel,
|
||||
@@ -509,7 +509,7 @@ func (b *ResourceBuilder) newEphemeralRunnerSet(autoscalingRunnerSet *v1alpha1.A
|
||||
LabelKeyGitHubScaleSetNamespace: autoscalingRunnerSet.Namespace,
|
||||
})
|
||||
|
||||
if err := applyGitHubURLLabels(autoscalingRunnerSet.Spec.GitHubConfigUrl, labels); err != nil {
|
||||
if err := applyGitHubURLLabels(autoscalingRunnerSet.Spec.GitHubConfigURL, labels); err != nil {
|
||||
return nil, fmt.Errorf("failed to apply GitHub URL labels: %v", err)
|
||||
}
|
||||
|
||||
@@ -540,8 +540,8 @@ func (b *ResourceBuilder) newEphemeralRunnerSet(autoscalingRunnerSet *v1alpha1.A
|
||||
Spec: v1alpha1.EphemeralRunnerSetSpec{
|
||||
Replicas: 0,
|
||||
EphemeralRunnerSpec: v1alpha1.EphemeralRunnerSpec{
|
||||
RunnerScaleSetId: runnerScaleSetID,
|
||||
GitHubConfigUrl: autoscalingRunnerSet.Spec.GitHubConfigUrl,
|
||||
RunnerScaleSetID: runnerScaleSetID,
|
||||
GitHubConfigURL: autoscalingRunnerSet.Spec.GitHubConfigURL,
|
||||
GitHubConfigSecret: autoscalingRunnerSet.Spec.GitHubConfigSecret,
|
||||
Proxy: autoscalingRunnerSet.Spec.Proxy,
|
||||
GitHubServerTLS: autoscalingRunnerSet.Spec.GitHubServerTLS,
|
||||
@@ -689,7 +689,7 @@ func scaleSetListenerName(autoscalingRunnerSet *v1alpha1.AutoscalingRunnerSet) s
|
||||
hashSuffix(
|
||||
autoscalingRunnerSet.Namespace,
|
||||
autoscalingRunnerSet.Spec.RunnerGroup,
|
||||
autoscalingRunnerSet.Spec.GitHubConfigUrl,
|
||||
autoscalingRunnerSet.Spec.GitHubConfigURL,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ func TestLabelPropagation(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/org/repo",
|
||||
GitHubConfigURL: "https://github.com/org/repo",
|
||||
},
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ func TestGitHubURLTrimLabelValues(t *testing.T) {
|
||||
t.Run("org/repo", func(t *testing.T) {
|
||||
autoscalingRunnerSet := autoscalingRunnerSet.DeepCopy()
|
||||
autoscalingRunnerSet.Spec = v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: fmt.Sprintf("https://github.com/%s/%s", organization, repository),
|
||||
GitHubConfigURL: fmt.Sprintf("https://github.com/%s/%s", organization, repository),
|
||||
}
|
||||
|
||||
var b ResourceBuilder
|
||||
@@ -157,7 +157,7 @@ func TestGitHubURLTrimLabelValues(t *testing.T) {
|
||||
t.Run("enterprise", func(t *testing.T) {
|
||||
autoscalingRunnerSet := autoscalingRunnerSet.DeepCopy()
|
||||
autoscalingRunnerSet.Spec = v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: fmt.Sprintf("https://github.com/enterprises/%s", enterprise),
|
||||
GitHubConfigURL: fmt.Sprintf("https://github.com/enterprises/%s", enterprise),
|
||||
}
|
||||
|
||||
var b ResourceBuilder
|
||||
@@ -196,7 +196,7 @@ func TestOwnershipRelationships(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Spec: v1alpha1.AutoscalingRunnerSetSpec{
|
||||
GitHubConfigUrl: "https://github.com/org/repo",
|
||||
GitHubConfigURL: "https://github.com/org/repo",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ func NewSecretResolver(k8sClient client.Client, multiClient actions.MultiClient,
|
||||
|
||||
type ActionsGitHubObject interface {
|
||||
client.Object
|
||||
GitHubConfigUrl() string
|
||||
GitHubConfigURL() string
|
||||
GitHubConfigSecret() string
|
||||
GitHubProxy() *v1alpha1.ProxyConfig
|
||||
GitHubServerTLS() *v1alpha1.TLSConfig
|
||||
@@ -85,9 +85,9 @@ func (sr *SecretResolver) GetActionsService(ctx context.Context, obj ActionsGitH
|
||||
}
|
||||
|
||||
if proxy.HTTP != nil {
|
||||
u, err := url.Parse(proxy.HTTP.Url)
|
||||
u, err := url.Parse(proxy.HTTP.URL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse proxy http url %q: %w", proxy.HTTP.Url, err)
|
||||
return nil, fmt.Errorf("failed to parse proxy http url %q: %w", proxy.HTTP.URL, err)
|
||||
}
|
||||
|
||||
if ref := proxy.HTTP.CredentialSecretRef; ref != "" {
|
||||
@@ -101,9 +101,9 @@ func (sr *SecretResolver) GetActionsService(ctx context.Context, obj ActionsGitH
|
||||
}
|
||||
|
||||
if proxy.HTTPS != nil {
|
||||
u, err := url.Parse(proxy.HTTPS.Url)
|
||||
u, err := url.Parse(proxy.HTTPS.URL)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse proxy https url %q: %w", proxy.HTTPS.Url, err)
|
||||
return nil, fmt.Errorf("failed to parse proxy https url %q: %w", proxy.HTTPS.URL, err)
|
||||
}
|
||||
|
||||
if ref := proxy.HTTPS.CredentialSecretRef; ref != "" {
|
||||
@@ -150,7 +150,7 @@ func (sr *SecretResolver) GetActionsService(ctx context.Context, obj ActionsGitH
|
||||
|
||||
return sr.multiClient.GetClientFor(
|
||||
ctx,
|
||||
obj.GitHubConfigUrl(),
|
||||
obj.GitHubConfigURL(),
|
||||
appConfig,
|
||||
obj.GetNamespace(),
|
||||
clientOptions...,
|
||||
|
||||
Reference in New Issue
Block a user