From 4347ea890e2892f04b8d1b84115b6a14f4da4227 Mon Sep 17 00:00:00 2001 From: Matthew Collins Date: Mon, 16 Dec 2024 11:46:12 +0000 Subject: [PATCH] feat: make DIND image configurable and remove non-runner-containers helper to avoid unintended DIND inclusion --- .../gha-runner-scale-set/templates/_helpers.tpl | 17 ++++++++--------- .../templates/autoscalingrunnerset.yaml | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/charts/gha-runner-scale-set/templates/_helpers.tpl b/charts/gha-runner-scale-set/templates/_helpers.tpl index bd71ed64c9..40e98750b8 100644 --- a/charts/gha-runner-scale-set/templates/_helpers.tpl +++ b/charts/gha-runner-scale-set/templates/_helpers.tpl @@ -96,7 +96,14 @@ volumeMounts: {{- end }} {{- define "gha-runner-scale-set.dind-container" -}} -image: docker:dind +{{- $dindImage := "docker:dind" -}} +{{- range $i, $val := .Values.template.spec.containers }} + {{- if eq $val.name "dind" }} + {{- $dindImage = $val.image }} + {{- end }} +{{- end }} + +image: {{ $dindImage }} args: - dockerd - --host=unix:///var/run/docker.sock @@ -170,14 +177,6 @@ volumeMounts: {{- end }} {{- end }} -{{- define "gha-runner-scale-set.non-runner-containers" -}} - {{- range $i, $container := .Values.template.spec.containers }} - {{- if ne $container.name "runner" }} -- {{ $container | toYaml | nindent 2 }} - {{- end }} - {{- end }} -{{- end }} - {{- define "gha-runner-scale-set.non-runner-non-dind-containers" -}} {{- range $i, $container := .Values.template.spec.containers }} {{- if and (ne $container.name "runner") (ne $container.name "dind") }} diff --git a/charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml b/charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml index 39ebfef800..f7d40b8247 100644 --- a/charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml +++ b/charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml @@ -141,7 +141,7 @@ spec: {{- else if eq $containerMode.type "kubernetes" }} - name: runner {{- include "gha-runner-scale-set.kubernetes-mode-runner-container" . | nindent 8 }} - {{- include "gha-runner-scale-set.non-runner-containers" . | nindent 6 }} + {{- include "gha-runner-scale-set.non-runner-non-dind-containers" . | nindent 6 }} {{- else }} {{- include "gha-runner-scale-set.default-mode-runner-containers" . | nindent 6 }} {{- end }}