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
This commit is contained in:
parent
a46b8aaa7e
commit
a4f367cd9b
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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"]
|
||||
|
|
|
|||
Loading…
Reference in New Issue