Skip to content

Commit

Permalink
Ignore extra dind container when contaerinMode.type=dind. (#2418)
Browse files Browse the repository at this point in the history
  • Loading branch information
TingluoHuang authored Mar 17, 2023
1 parent e5d8d65 commit 064039a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/e2e-test-linux-vm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,9 @@ jobs:
--set githubConfigUrl="https://github.com/${{ steps.resolved_inputs.outputs.TARGET_ORG }}/${{steps.resolved_inputs.outputs.TARGET_REPO}}" \
--set githubConfigSecret.github_token="${{ steps.setup.outputs.token }}" \
--set containerMode.type="kubernetes" \
--set containerMode.kubernetesModeWorkVolumeClaim.accessModes={"ReadWriteOnce"} \
--set containerMode.kubernetesModeWorkVolumeClaim.storageClassName="openebs-hostpath" \
--set containerMode.kubernetesModeWorkVolumeClaim.resources.requests.storage="1Gi" \
./charts/gha-runner-scale-set \
--debug
echo "ARC_NAME=$ARC_NAME" >> $GITHUB_OUTPUT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ type AutoscalingRunnerSetStatus struct {
}

func (ars *AutoscalingRunnerSet) ListenerSpecHash() string {
type listenerSpec = AutoscalingRunnerSetSpec
arsSpec := ars.Spec.DeepCopy()
spec := arsSpec
return hash.ComputeTemplateHash(&spec)
Expand Down
8 changes: 8 additions & 0 deletions charts/gha-runner-scale-set/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ volumeMounts:
{{- 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") }}
- {{ $container | toYaml | nindent 2 }}
{{- end }}
{{- end }}
{{- end }}

{{- define "gha-runner-scale-set.dind-runner-container" -}}
{{- $tlsConfig := (default (dict) .Values.githubServerTLS) }}
{{- range $i, $container := .Values.template.spec.containers }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ spec:
{{- include "gha-runner-scale-set.dind-runner-container" . | nindent 8 }}
- name: dind
{{- include "gha-runner-scale-set.dind-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 if eq .Values.containerMode.type "kubernetes" }}
- name: runner
{{- include "gha-runner-scale-set.kubernetes-mode-runner-container" . | nindent 8 }}
Expand Down
26 changes: 13 additions & 13 deletions charts/gha-runner-scale-set/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ template:
## template:
## spec:
## initContainers:
## - name: initExternalsInternalVolume
## - name: init-dind-externals
## image: ghcr.io/actions/actions-runner:latest
## command: ["cp", "-r", "-v", "/home/runner/externals/.", "/home/runner/tmpDir/"]
## volumeMounts:
## - name: externalsInternal
## - name: dind-externals
## mountPath: /home/runner/tmpDir
## containers:
## - name: runner
Expand All @@ -103,28 +103,28 @@ template:
## - name: DOCKER_CERT_PATH
## value: /certs/client
## volumeMounts:
## - name: workingDirectoryInternal
## - name: work
## mountPath: /home/runner/_work
## - name: dinDInternal
## - name: dind-cert
## mountPath: /certs/client
## readOnly: true
## - name: dind
## image: docker:dind
## securityContext:
## privileged: true
## volumeMounts:
## - mountPath: /certs/client
## name: dinDInternal
## - mountPath: /home/runner/_work
## name: workingDirectoryInternal
## - mountPath: /home/runner/externals
## name: externalsInternal
## - name: work
## mountPath: /home/runner/_work
## - name: dind-cert
## mountPath: /certs/client
## - name: dind-externals
## mountPath: /home/runner/externals
## volumes:
## - name: dinDInternal
## - name: work
## emptyDir: {}
## - name: workingDirectoryInternal
## - name: dind-cert
## emptyDir: {}
## - name: externalsInternal
## - name: dind-externals
## emptyDir: {}
######################################################################################################
## with containerMode.type=kubernetes, we will populate the template.spec with following pod spec
Expand Down

0 comments on commit 064039a

Please sign in to comment.