From a4f367cd9bd29754321587867b2a5b7d967cac4e Mon Sep 17 00:00:00 2001 From: Frank Bernhardt Date: Sat, 21 Mar 2026 17:09:14 +0100 Subject: [PATCH] fix: address review feedback on dindImage - Fix double-commenting on dindImage example in values.yaml - Update containerMode docs to clarify that dindImage is a supported customization while deeper changes still require using template - Add unit test for custom dindImage rendering --- .../tests/template_test.go | 33 +++++++++++++++++++ charts/gha-runner-scale-set/values.yaml | 8 +++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/charts/gha-runner-scale-set/tests/template_test.go b/charts/gha-runner-scale-set/tests/template_test.go index 806b3c6f..364bb3ad 100644 --- a/charts/gha-runner-scale-set/tests/template_test.go +++ b/charts/gha-runner-scale-set/tests/template_test.go @@ -999,6 +999,39 @@ func TestTemplateRenderedAutoScalingRunnerSet_EnableDinD(t *testing.T) { assert.NotNil(t, ars.Spec.Template.Spec.Volumes[2].EmptyDir, "Volume work should be an emptyDir") } +func TestTemplateRenderedAutoScalingRunnerSet_EnableDinD_CustomImage(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", + "containerMode.type": "dind", + "containerMode.dindImage": "my-registry/docker:dind-custom", + "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.Len(t, ars.Spec.Template.Spec.InitContainers, 2, "Template.Spec should have 2 init containers") + assert.Equal(t, "dind", ars.Spec.Template.Spec.InitContainers[1].Name) + assert.Equal(t, "my-registry/docker:dind-custom", ars.Spec.Template.Spec.InitContainers[1].Image, "DinD container should use the custom image") +} + func TestTemplateRenderedAutoScalingRunnerSet_EnableKubernetesMode(t *testing.T) { t.Parallel() diff --git a/charts/gha-runner-scale-set/values.yaml b/charts/gha-runner-scale-set/values.yaml index b05b5629..5cec5f4f 100644 --- a/charts/gha-runner-scale-set/values.yaml +++ b/charts/gha-runner-scale-set/values.yaml @@ -114,14 +114,16 @@ githubConfigSecret: ## for dind and kubernetes mode. Template will be modified as documented under the ## template object. ## -## If any customization is required for dind or kubernetes mode, containerMode should remain -## empty, and configuration should be applied to the template. +## For simple customizations like overriding the DinD image, use the dindImage field below. +## For deeper customization of dind or kubernetes mode (e.g., adding extra env vars, +## volume mounts, or security contexts), containerMode should remain empty, and +## configuration should be applied to the template. # containerMode: # type: "dind" ## type can be set to "dind", "kubernetes", or "kubernetes-novolume" # ## Optional: override the default docker:dind image used for the DinD sidecar container. # ## This is useful for using a custom image with pre-configured daemon.json # ## (e.g., registry mirrors, insecure registries) or other customizations. -# # dindImage: "docker:dind" +# dindImage: "docker:dind" # ## the following is required when containerMode.type=kubernetes # kubernetesModeWorkVolumeClaim: # accessModes: ["ReadWriteOnce"]