actions-runner-controller icon indicating copy to clipboard operation
actions-runner-controller copied to clipboard

kubernetes-novolume mode renders volumes: null and volumeMounts: null causing validation error in gha-runner-scale-set 0.14.0

Open michielvha opened this issue 8 months ago • 2 comments

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:

  1. Remove (eq $containerMode.type "kubernetes-novolume") from the outer OR condition so volumes: is not rendered when no custom volumes exist, or
  2. Add an explicit empty list fallback when in kubernetes-novolume mode 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

michielvha avatar Mar 23 '26 11:03 michielvha

Hello! Thank you for filing an issue.

The maintainers will triage your issue shortly.

In the meantime, please take a look at the troubleshooting guide for bug reports.

If this is a feature request, please review our contribution guidelines.

github-actions[bot] avatar Mar 23 '26 11:03 github-actions[bot]

Duplicate of #4411

nikola-jokic avatar Apr 20 '26 16:04 nikola-jokic