Skip to content

Commit 27b0f3f

Browse files
committed
fixes
1 parent ec4c4c2 commit 27b0f3f

File tree

2 files changed

+86
-11
lines changed

2 files changed

+86
-11
lines changed

charts/gha-runner-scale-set/templates/_helpers.tpl

Lines changed: 81 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ resources:
185185
{{- $filtered = append $filtered $volume -}}
186186
{{- end -}}
187187
{{- end -}}
188+
{{ if not (empty $filtered) }}
188189
{{- toYaml $filtered -}}
190+
{{- end }}
189191
{{- end }}
190192

191193
{{- define "gha-runner-scale-set.extra-containers" -}}
@@ -272,23 +274,25 @@ volumeMounts:
272274
{{- end }}
273275
{{- end }}
274276
{{- toYaml . | nindent 2 -}}
275-
{{- if $mountWork }}
277+
{{- end }}
278+
{{- if $mountWork }}
276279
- name: work
277280
mountPath: /home/runner/_work
278-
{{- end }}
279-
{{- if $mountDindCert }}
281+
{{- end }}
282+
{{- if $mountDindCert }}
280283
- name: dind-sock
281284
mountPath: /var/run
282-
{{- end }}
283-
{{- if $mountGitHubServerTLS }}
285+
{{- end }}
286+
{{- if $mountGitHubServerTLS }}
284287
- name: github-server-tls-cert
285288
mountPath: {{ clean (print $tlsConfig.runnerMountPath "/" $tlsConfig.certificateFrom.configMapKeyRef.key) }}
286289
subPath: {{ $tlsConfig.certificateFrom.configMapKeyRef.key }}
287-
{{- end }}
288290
{{- end }}
291+
{{ if not (empty .Values.runner.runnerContainer.resources) }}
289292
resources:
290293
{{- toYaml .Values.runner.dindInitContainer.resources | nindent 2 -}}
291294
{{- end }}
295+
{{- end }}
292296

293297
{{- define "gha-runner-scale-set.kubernetes-mode-runner-container" -}}
294298
image: {{ .Values.runner.runnerContainer.image }}
@@ -368,19 +372,86 @@ volumeMounts:
368372
{{- end }}
369373
{{- end }}
370374
{{- toYaml . | nindent 2 -}}
371-
{{- if $mountWork }}
375+
{{- end }}
376+
{{- if $mountWork }}
372377
- name: work
373378
mountPath: /home/runner/_work
374-
{{- end }}
375-
{{- if $mountGitHubServerTLS }}
379+
{{- end }}
380+
{{- if $mountGitHubServerTLS }}
376381
- name: github-server-tls-cert
377382
mountPath: {{ clean (print $tlsConfig.runnerMountPath "/" $tlsConfig.certificateFrom.configMapKeyRef.key) }}
378383
subPath: {{ $tlsConfig.certificateFrom.configMapKeyRef.key }}
379-
{{- end }}
380384
{{- end }}
385+
{{ if not (empty .Values.runner.runnerContainer.resources) }}
381386
resources:
382387
{{- toYaml .Values.runner.dindInitContainer.resources | nindent 2 -}}
383388
{{- end }}
389+
{{- end }}
390+
391+
{{- define "gha-runner-scale-set.default-mode-runner-containers" -}}
392+
image: {{ .Values.runner.runnerContainer.image }}
393+
command: ["/home/runner/run.sh"]
394+
{{ if not (empty .Values.runner.runnerContainer.extraArgs) }}
395+
args:
396+
{{- with .Values.runner.runnerContainer.extraArgs }}
397+
{{- toYaml . | nindent 2 }}
398+
{{- end }}
399+
{{- end }}
400+
{{- $tlsConfig := (default (dict) .Values.githubServerTLS) }}
401+
{{- $setNodeExtraCaCerts := 0 }}
402+
{{- $setRunnerUpdateCaCerts := 0 }}
403+
{{- if $tlsConfig.runnerMountPath }}
404+
{{- $setNodeExtraCaCerts = 1 }}
405+
{{- $setRunnerUpdateCaCerts = 1 }}
406+
{{- end }}
407+
{{- $mountGitHubServerTLS := 0 }}
408+
{{- if or .Values.runner.runnerContainer.extraEnv $setNodeExtraCaCerts $setRunnerUpdateCaCerts }}
409+
env:
410+
{{- with .Values.runner.runnerContainer.extraEnv }}
411+
{{- range $i, $env := . }}
412+
{{- if eq $env.name "NODE_EXTRA_CA_CERTS" }}
413+
{{- $setNodeExtraCaCerts = 0 }}
414+
{{- end }}
415+
{{- if eq $env.name "RUNNER_UPDATE_CA_CERTS" }}
416+
{{- $setRunnerUpdateCaCerts = 0 }}
417+
{{- end }}
418+
{{- end }}
419+
{{- toYaml . | nindent 2 -}}
420+
{{- end }}
421+
{{- if $setNodeExtraCaCerts }}
422+
- name: NODE_EXTRA_CA_CERTS
423+
value: {{ clean (print $tlsConfig.runnerMountPath "/" $tlsConfig.certificateFrom.configMapKeyRef.key) }}
424+
{{- end }}
425+
{{- if $setRunnerUpdateCaCerts }}
426+
- name: RUNNER_UPDATE_CA_CERTS
427+
value: "1"
428+
{{- end }}
429+
{{- if $tlsConfig.runnerMountPath }}
430+
{{- $mountGitHubServerTLS = 1 }}
431+
{{- end }}
432+
{{- end }}
433+
434+
{{- if or .Values.runner.runnerContainer.extraVolumeMounts $mountGitHubServerTLS }}
435+
volumeMounts:
436+
{{- with .Values.runner.runnerContainer.extraVolumeMounts }}
437+
{{- range $i, $volMount := . }}
438+
{{- if eq $volMount.name "github-server-tls-cert" }}
439+
{{- $mountGitHubServerTLS = 0 }}
440+
{{- end }}
441+
{{- end }}
442+
{{- toYaml . | nindent 2 -}}
443+
{{- end }}
444+
{{- if $mountGitHubServerTLS }}
445+
- name: github-server-tls-cert
446+
mountPath: {{ clean (print $tlsConfig.runnerMountPath "/" $tlsConfig.certificateFrom.configMapKeyRef.key) }}
447+
subPath: {{ $tlsConfig.certificateFrom.configMapKeyRef.key }}
448+
{{- end }}
449+
{{- end }}
450+
{{ if not (empty .Values.runner.runnerContainer.resources) }}
451+
resources:
452+
{{- toYaml .Values.runner.dindInitContainer.resources | nindent 2 -}}
453+
{{- end}}
454+
{{- end}}
384455

385456
{{- define "gha-runner-scale-set.managerRoleName" -}}
386457
{{- include "gha-runner-scale-set.fullname" . }}-manager

charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ spec:
107107
{{- end }}
108108
{{- end }}
109109
spec:
110-
restartPolicy: .Values.runner.restartPolicy
110+
restartPolicy: {{ .Values.runner.restartPolicy }}
111111
{{- $containerMode := .Values.containerMode }}
112112
{{- if eq $containerMode.type "kubernetes" }}
113113
serviceAccountName: {{ default (include "gha-runner-scale-set.kubeModeServiceAccountName" .) .Values.runner.serviceAccountName }}
@@ -133,6 +133,10 @@ spec:
133133
- name: runner
134134
{{- include "gha-runner-scale-set.kubernetes-mode-runner-container" . | nindent 8 }}
135135
{{- include "gha-runner-scale-set.extra-containers" . | nindent 4 }}
136+
{{- else }}
137+
- name: runner
138+
{{- include "gha-runner-scale-set.default-mode-runner-containers" . | nindent 8 }}
139+
{{- include "gha-runner-scale-set.extra-containers" . | nindent 4 }}
136140
{{- end }}
137141
{{- $tlsConfig := (default (dict) .Values.githubServerTLS) }}
138142
{{- if or .Values.runner.extraVolumes (eq $containerMode.type "dind") (eq $containerMode.type "kubernetes") $tlsConfig.runnerMountPath }}

0 commit comments

Comments
 (0)