-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Description
When using containerMode.type: "kubernetes-novolume" without defining custom volumes (as shown in the default values.yaml example), the rendered AutoscalingRunnerSet manifest contains volumes: null and volumeMounts: null, which fails Kubernetes API validation.
Error
AutoscalingRunnerSet.actions.github.com "arc-runner-set-data-prd-terraform" is invalid:
[spec.template.spec.containers[0].volumeMounts: Invalid value: "null": spec.template.spec.containers[0].volumeMounts in body must be of type array: "null",
spec.template.spec.volumes: Invalid value: "null": spec.template.spec.volumes in body must be of type array: "null"]
Chart version
gha-runner-scale-set 0.14.0
Values used (minimal repro)
containerMode:
type: "kubernetes-novolume"
template:
spec:
containers:
- name: runner
image: ghcr.io/actions/actions-runner:latest
command: ["/home/runner/run.sh"]This matches the commented-out example in the chart's default values.yaml for kubernetes-novolume mode, which shows no volumes are needed.
Root cause
In charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml, the volumes: key is gated by an OR condition that includes kubernetes-novolume:
{{- if or .Values.template.spec.volumes (eq $containerMode.type "dind") (eq $containerMode.type "kubernetes") (eq $containerMode.type "kubernetes-novolume") $tlsConfig.runnerMountPath }}
volumes:
...
{{- else }}
{{- with .Values.template.spec.volumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
{{- end }}
{{- end }}
Because kubernetes-novolume is in the outer OR, the volumes: key is always rendered. But the inner else branch uses with .Values.template.spec.volumes, which evaluates to false when no custom volumes are defined so nothing renders under volumes:, producing volumes: null in the final YAML.
The same issue applies to volumeMounts on the runner container.
Suggested fix
Either:
- Remove
(eq $containerMode.type "kubernetes-novolume")from the outer OR condition sovolumes:is not rendered when no custom volumes exist, or - Add an explicit empty list fallback when in
kubernetes-novolumemode and no user-defined volumes are present
Workaround
Provide an explicit volume and volumeMount in values to avoid the null:
template:
spec:
volumes:
- name: work
emptyDir: {}
containers:
- name: runner
volumeMounts:
- name: work
mountPath: /home/runner/_work