Add multi-label support to scalesets (#4408)
This commit is contained in:
@@ -83,6 +83,18 @@ spec:
|
||||
githubConfigSecret: {{ include "github-secret.name" . | quote }}
|
||||
runnerGroup: {{ .Values.scaleset.runnerGroup | quote }}
|
||||
runnerScaleSetName: {{ .Values.scaleset.name | quote }}
|
||||
{{- if and .Values.scaleset.labels (kindIs "slice" .Values.scaleset.labels) }}
|
||||
{{- range .Values.scaleset.labels }}
|
||||
{{- if empty . }}
|
||||
{{- fail "scaleset.labels contains an empty string, each label must be a non-empty string of less than 256 characters" }}
|
||||
{{- end }}
|
||||
{{- if ge (len .) 256 }}
|
||||
{{- fail "scaleset.labels 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.scaleset.labels | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.githubServerTLS }}
|
||||
githubServerTLS:
|
||||
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
suite: "AutoscalingRunnerSet scale set labels"
|
||||
templates:
|
||||
- autoscalingrunnserset.yaml
|
||||
tests:
|
||||
- it: should apply scaleset labels slice as runnerScaleSetLabels
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
scaleset.labels:
|
||||
- "linux"
|
||||
- "x64"
|
||||
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.runnerScaleSetLabels[0]
|
||||
value: "linux"
|
||||
- equal:
|
||||
path: spec.runnerScaleSetLabels[1]
|
||||
value: "x64"
|
||||
|
||||
- it: should fail when a scaleset label is empty
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
scaleset.labels:
|
||||
- "linux"
|
||||
- ""
|
||||
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: "scaleset.labels contains an empty string, each label must be a non-empty string of less than 256 characters"
|
||||
|
||||
- it: should fail when a scaleset label is 256 characters or more
|
||||
set:
|
||||
scaleset.name: "test"
|
||||
scaleset.labels:
|
||||
- "linux"
|
||||
- "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
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: "scaleset.labels contains a label that is 256 characters or more, each label must be a non-empty string of less than 256 characters"
|
||||
@@ -5,6 +5,10 @@ scaleset:
|
||||
# Name of the scaleset
|
||||
name: ""
|
||||
runnerGroup: "default"
|
||||
# Labels are optional list of strings that will be applied to the scaleset
|
||||
# allowing scaleset to be selected by the listener based on the labels specified in the workflow.
|
||||
# https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/apply-labels
|
||||
labels: []
|
||||
## 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
|
||||
|
||||
Reference in New Issue
Block a user