Skip to content

feat(helm/gha-runner-scale-set-experimental): add $extra field passthrough for runner container in dind and kubernetes modes#4477

Open
stokkie90 wants to merge 3 commits intoactions:masterfrom
stokkie90:feat/runner-container-extra-fields
Open

feat(helm/gha-runner-scale-set-experimental): add $extra field passthrough for runner container in dind and kubernetes modes#4477
stokkie90 wants to merge 3 commits intoactions:masterfrom
stokkie90:feat/runner-container-extra-fields

Conversation

@stokkie90
Copy link
Copy Markdown

Summary

  • In dind and kubernetes modes, the runner container template now reads runner.container as a map and passes any fields not explicitly rendered (securityContext, resources, imagePullPolicy, args, etc.) through to the container spec via the $extra = omit ... | toYaml pattern.
  • This mirrors the behaviour already present in mode: "" (empty mode) via _mode_empty.tpl, and in the dind sidecar container in _mode_dind.tpl.
  • Input validation (wrong type guards) is included: runner.container must be a map, env/volumeMounts/args must be lists, securityContext must be a map, and volumes is rejected with a clear error pointing to runner.pod.spec.volumes.

Risks & rollout

  • Purely additive: existing values that don't set runner.container are unaffected (the map defaults to {}).
  • No breaking changes to existing behaviour; the name key in runner.container is silently ignored to preserve the hardcoded runner container name.

Validation

  • 14 new helm-unittest test cases added (7 per mode) covering: extra field passthrough, name-override suppression, and all validation failure paths.
  • Full test suite passes: 171 tests, 0 failures.
Charts:      1 passed, 1 total
Test Suites: 35 passed, 35 total
Tests:       171 passed, 171 total
Time:        427ms

… and kubernetes modes

Mirror the pattern already used in mode-empty and the dind sidecar container:
read runner.container as a map, validate known fields, and pass any
unrecognised keys (e.g. securityContext, resources, imagePullPolicy) through
to the rendered container spec via $extra = omit ... | toYaml.

Includes input validation (map/list/unsupported-key guards) and 14 new
helm-unittest test cases (7 per mode) covering passthrough, name-override
suppression, and validation failure paths.
Copilot AI review requested due to automatic review settings April 30, 2026 11:19
Add commented examples for env, volumeMounts, args, securityContext,
and resources under runner.container, mirroring the existing style
of the runner.dind.container section.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds runner.container “extra fields” passthrough for the runner container when using runner.mode: dind and runner.mode: kubernetes, aligning these modes with the existing “mode-empty” behavior and improving configurability of the runner container spec.

Changes:

  • Add omit ... | toYaml passthrough for non-explicitly-rendered runner.container fields in dind + kubernetes runner container templates (while ignoring runner.container.name).
  • Add type-guard validation for runner.container and selected fields (env, volumeMounts, args, securityContext, and disallow volumes) in both modes.
  • Add helm-unittest coverage for passthrough behavior + validation failure paths in both modes.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

File Description
charts/gha-runner-scale-set-experimental/templates/_mode_kubernetes.tpl Adds validation and $extra passthrough injection for the kubernetes-mode runner container.
charts/gha-runner-scale-set-experimental/templates/_mode_dind.tpl Adds validation and $extra passthrough injection for the dind-mode runner container.
charts/gha-runner-scale-set-experimental/tests/autoscaling_runner_set_kubernetes_mode_spec_test.yaml Adds unit tests covering kubernetes-mode passthrough, name-override suppression, and validation errors.
charts/gha-runner-scale-set-experimental/tests/autoscaling_runner_set_dind_mode_spec_test.yaml Adds unit tests covering dind-mode passthrough, name-override suppression, and validation errors.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread charts/gha-runner-scale-set-experimental/templates/_mode_dind.tpl Outdated
Comment thread charts/gha-runner-scale-set-experimental/templates/_mode_kubernetes.tpl Outdated
@gazab
Copy link
Copy Markdown

gazab commented Apr 30, 2026

We would love to be able to extends env and volumeMounts in the runner container when using mode dind as well!

Extract the six runner.container type-guard checks into a reusable
named template 'runner.container.validate' in _defaults.tpl.
Both _mode_dind.tpl and _mode_kubernetes.tpl now call this helper
instead of duplicating the block, preventing future drift.

Also fixes _mode_dind.tpl to use $runner := (.Values.runner | default dict)
before accessing runner.container, making the failure mode consistent
with kubernetes mode when runner itself is overridden to a non-map.
@stokkie90
Copy link
Copy Markdown
Author

Addressed both Copilot review comments:

  1. _mode_dind.tpl — use $runner intermediate variable: fixed by introducing $runner := (.Values.runner | default dict) before accessing runner.container, consistent with the kubernetes mode pattern.

  2. Duplicate validation block: extracted the six type-guard checks into a shared runner.container.validate helper in _defaults.tpl. Both _mode_dind.tpl and _mode_kubernetes.tpl now call {{- include "runner.container.validate" . -}} instead of duplicating the block.

All 171 tests continue to pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants