Add multi-label support to scalesets (#4408)
This commit is contained in:
@@ -75,6 +75,18 @@ spec:
|
||||
{{- with .Values.runnerScaleSetName }}
|
||||
runnerScaleSetName: {{ . }}
|
||||
{{- end }}
|
||||
{{- if and .Values.scaleSetLabels (kindIs "slice" .Values.scaleSetLabels) }}
|
||||
{{- range .Values.scaleSetLabels }}
|
||||
{{- if empty . }}
|
||||
{{- fail "scaleSetLabels contains an empty string, each label must be a non-empty string of less than 256 characters" }}
|
||||
{{- end }}
|
||||
{{- if ge (len .) 256 }}
|
||||
{{- fail "scaleSetLabels contains a label that is 256 characters or more, each label must be a non-empty string of less than 256 characters" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
runnerScaleSetLabels:
|
||||
{{- toYaml .Values.scaleSetLabels | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.githubServerTLS }}
|
||||
githubServerTLS:
|
||||
|
||||
@@ -474,6 +474,37 @@ func TestTemplateRenderedAutoScalingRunnerSet_RunnerScaleSetName(t *testing.T) {
|
||||
assert.Equal(t, "ghcr.io/actions/actions-runner:latest", ars.Spec.Template.Spec.Containers[0].Image)
|
||||
}
|
||||
|
||||
func TestTemplateRenderedAutoScalingRunnerSet_ScaleSetLabels(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Path to the helm chart we will test
|
||||
helmChartPath, err := filepath.Abs("../../gha-runner-scale-set")
|
||||
require.NoError(t, err)
|
||||
|
||||
releaseName := "test-runners"
|
||||
namespaceName := "test-" + strings.ToLower(random.UniqueId())
|
||||
|
||||
options := &helm.Options{
|
||||
Logger: logger.Discard,
|
||||
SetValues: map[string]string{
|
||||
"githubConfigUrl": "https://github.com/actions",
|
||||
"githubConfigSecret.github_token": "gh_token12345",
|
||||
"scaleSetLabels[0]": "linux",
|
||||
"scaleSetLabels[1]": "x64",
|
||||
"controllerServiceAccount.name": "arc",
|
||||
"controllerServiceAccount.namespace": "arc-system",
|
||||
},
|
||||
KubectlOptions: k8s.NewKubectlOptions("", "", namespaceName),
|
||||
}
|
||||
|
||||
output := helm.RenderTemplate(t, options, helmChartPath, releaseName, []string{"templates/autoscalingrunnerset.yaml"})
|
||||
|
||||
var ars v1alpha1.AutoscalingRunnerSet
|
||||
helm.UnmarshalK8SYaml(t, output, &ars)
|
||||
|
||||
assert.Equal(t, []string{"linux", "x64"}, ars.Spec.RunnerScaleSetLabels)
|
||||
}
|
||||
|
||||
func TestTemplateRenderedAutoScalingRunnerSet_ProvideMetadata(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
## ex: https://github.com/myorg/myrepo or https://github.com/myorg or https://github.com/enterprises/myenterprise
|
||||
githubConfigUrl: ""
|
||||
|
||||
scaleSetLabels: []
|
||||
|
||||
## githubConfigSecret is the k8s secret information to use when authenticating via the GitHub API.
|
||||
## You can choose to supply:
|
||||
## A) a PAT token,
|
||||
|
||||
Reference in New Issue
Block a user