Skip to content

[Helm] Expose dind image - #4219

Closed
SheldonTsen wants to merge 2 commits into
actions:masterfrom
SheldonTsen:feature/update-helm-chart
Closed

SheldonTsen wants to merge 2 commits into
actions:masterfrom
SheldonTsen:feature/update-helm-chart

Conversation

@SheldonTsen

@SheldonTsen SheldonTsen commented Aug 19, 2025 •

Copy link
Copy Markdown

This image is not configurable. This seemed the simplest to expose this to be configurable.

All other images are configurable but this one. I need to use an internal container registry, and hit this issue.

Tried my best to come up with a sensible place to put this key and this is what I came up with.

See issue here: #4232

@SheldonTsen

Copy link
Copy Markdown
Author

Hello @mumoshu @toast-gear @rentziass @nikola-jokic, small bump!

@SheldonTsen SheldonTsen mentioned this pull request Aug 29, 2025
4 tasks done
@SheldonTsen

Copy link
Copy Markdown
Author

Hello @mumoshu @toast-gear @rentziass @nikola-jokic, small bump again! Thanks!

@nikola-jokic

Copy link
Copy Markdown
Collaborator

Hey @SheldonTsen,

As mentioned a few times now, we don't want to create a patch that will simply modify the dind image. The more reasonable path forward would be to rework our helm chart so it is better suited to handle these cases.

This PR looks much closer to what we need to do, instead of allowing top-level objects to modify inner objects.

Since modifying dind image is possible, you simply don't specify the containerMode and uncomment out the spec that would be applied if the containerMode is set to dind, I'll close this PR for now.

I admit that the charts could be better designed, but this is not the way to do it. And since it doesn't block users from modifying the spec, I would hesitate before applying the temporary patch.

@SheldonTsen

Copy link
Copy Markdown
Author

@nikola-jokic - no problem. Thanks for the response. I should have checked for other PRs first before creating this.

Since modifying dind image is possible, you simply don't specify the containerMode and uncomment out the spec that would be applied if the containerMode is set to dind, I'll close this PR for now.

Let me look at this more closely. I thought it was not currently possible.

Thanks!

@nikola-jokic

Copy link
Copy Markdown
Collaborator

No problem! You can see in the template section that we have commented out the spec that would be expanded if you pick the container mode dind for example. You just uncomment out that section and modify the fields you need in order to make it work ☺️

@SheldonTsen
SheldonTsen deleted the feature/update-helm-chart branch August 29, 2025 13:01
@SheldonTsen

SheldonTsen commented Sep 1, 2025 •

Copy link
Copy Markdown
Author

Actually, @nikola-jokic, I took a deeper look, it might not be possible.

So in _helpers.tpl we have:

{{- define "gha-runner-scale-set.dind-container" -}}
image: docker:dind
args:
  - dockerd
  - --host=unix:///var/run/docker.sock
  - --group=$(DOCKER_GROUP_GID)
 ...

In autoscalingrunnerset.yaml:

...
      initContainers:
        {{- if eq $containerMode.type "dind" }}
      - name: init-dind-externals
          {{- include "gha-runner-scale-set.dind-init-container" . | nindent 8 }}
          {{- if (ge (.Capabilities.KubeVersion.Minor | int) 29) }}
      - name: dind
          {{- include "gha-runner-scale-set.dind-container" . | nindent 8 }}
          {{- end }}
        {{- end }}
        {{- with .Values.template.spec.initContainers }}
      {{- toYaml . | nindent 6 }}
        {{- end }}
      {{- end }}
...

And in values.yaml if we do this:

   template:
     spec:
       initContainers:
       - name: init-dind-externals
         image: ghcr.io/actions/actions-runner:latest
         command: ["cp", "-r", "/home/runner/externals/.", "/home/runner/tmpDir/"]
         volumeMounts:
           - name: dind-externals
             mountPath: /home/runner/tmpDir
       - name: dind
         image: docker:dind
         args:
           - dockerd
           - --host=unix:///var/run/docker.sock
           - --group=$(DOCKER_GROUP_GID)
         ...

If I am not mistaken, we will have 4 containers under initContainers, 2x dind 2x init-dind-externals, which I think will throw an error. Because from here:

      - name: init-dind-externals
          {{- include "gha-runner-scale-set.dind-init-container" . | nindent 8 }}   #   ---> will give: name: init-dind-externals
          {{- if (ge (.Capabilities.KubeVersion.Minor | int) 29) }}
      - name: dind
          {{- include "gha-runner-scale-set.dind-container" . | nindent 8 }}          # ---> will give: name: dind
          {{- end }}
        {{- end }}
        {{- with .Values.template.spec.initContainers }}      # ---> will give: name: init-dind-externals and name: dind

A possible easy fix would be to add a flag to know when to take from _helpers vs values.yaml:

initContainers:
  {{- if .Values.template.spec.manualOverwrite }}
  {{- toYaml .Values.template.spec.initContainers | nindent 2 }}
  {{- else }}
  - name: init-dind-externals
    {{- include "gha-runner-scale-set.dind-init-container" . | nindent 4 }}
  - name: dind
    {{- include "gha-runner-scale-set.dind-container" . | nindent 4 }}
  {{- end }}

Or a more implicit version (without a flag):

{{- $containerMode := .Values.containerMode }}
{{- $userInit := default (list) .Values.template.spec.initContainers -}}

{{- if or (gt (len $userInit) 0) (eq $containerMode.type "dind") }}
initContainers:
  {{- if gt (len $userInit) 0 }}
  {{- toYaml $userInit | nindent 2 }}
  {{- else if eq $containerMode.type "dind" }}
  - name: init-dind-externals
    {{- include "gha-runner-scale-set.dind-init-container" . | nindent 4 }}
  {{- if (ge (.Capabilities.KubeVersion.Minor | int) 29) }}
  - name: dind
    {{- include "gha-runner-scale-set.dind-container" . | nindent 4 }}
  {{- end }}
  {{- end }}
{{- end }}

@nikola-jokic

Copy link
Copy Markdown
Collaborator

Please read this comment:

## If any customization is required for dind or kubernetes mode, containerMode should remain

@SheldonTsen

SheldonTsen commented Sep 2, 2025 •

Copy link
Copy Markdown
Author

Ah right, I need to disable even more things. Okay, yeah, then if I re-defined that again, then it's possible. Okay - my bad! Apologies! Thanks for the clarification.

Though in my case, it's basically introducing lots of lines, simply to change one line. Which is not the most ideal way to leverage values file where each line is intended to change something underlying. But I understand also the broader context from the other PR mentioning a nicer way to make things more configurable.

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.

2 participants