mirror of
https://github.com/actions/actions-runner-controller.git
synced 2026-01-24 21:50:06 +08:00
add listener pod expansion
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
{{- define "listener-template.pod" -}}
|
||||||
|
{{- $metadata := .Values.listenerPodTemplate.metadata | default dict -}}
|
||||||
|
{{- $spec := .Values.listenerPodTemplate.spec | default dict -}}
|
||||||
|
{{- if and (empty $metadata) (empty $spec) -}}
|
||||||
|
{{- fail "listenerPodTemplate must have at least metadata or spec defined" -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- with $metadata -}}
|
||||||
|
metadata:
|
||||||
|
{{- toYaml . | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with $spec -}}
|
||||||
|
spec:
|
||||||
|
{{- $containers := (index . "containers" | default (list)) -}}
|
||||||
|
{{- if empty $containers }}
|
||||||
|
containers:
|
||||||
|
- name: listener
|
||||||
|
{{- else }}
|
||||||
|
containers:
|
||||||
|
{{- toYaml $containers | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- $rest := (omit . "containers") -}}
|
||||||
|
{{- if gt (len $rest) 0 }}
|
||||||
|
{{- toYaml $rest | nindent 2 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end -}}
|
||||||
@@ -151,9 +151,9 @@ spec:
|
|||||||
minRunners: {{ .Values.scaleset.minRunners | int }}
|
minRunners: {{ .Values.scaleset.minRunners | int }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- with .Values.listenerPodTemplate }}
|
{{- if and .Values.listenerPodTemplate (or .Values.listenerPodTemplate.metadata .Values.listenerPodTemplate.spec) }}
|
||||||
listenerTemplate:
|
listenerTemplate:
|
||||||
{{- toYaml . | nindent 4}}
|
{{- include "listener-template.pod" . | nindent 4}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- with .Values.listenerMetrics }}
|
{{- with .Values.listenerMetrics }}
|
||||||
@@ -177,9 +177,6 @@ spec:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: {{ include "autoscaling-runner-set.template-service-account" . | quote }}
|
serviceAccountName: {{ include "autoscaling-runner-set.template-service-account" . | quote }}
|
||||||
{{- if gt (len $runnerPodSpecExtraFields) 0 }}
|
|
||||||
{{- toYaml $runnerPodSpecExtraFields | nindent 6 }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if $hasInitContainers }}
|
{{- if $hasInitContainers }}
|
||||||
initContainers:
|
initContainers:
|
||||||
{{- if and (eq $runnerMode "dind") $dind.copyExternals }}
|
{{- if and (eq $runnerMode "dind") $dind.copyExternals }}
|
||||||
@@ -216,4 +213,7 @@ spec:
|
|||||||
- {{ toYaml . | nindent 10 }}
|
- {{ toYaml . | nindent 10 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if gt (len $runnerPodSpecExtraFields) 0 }}
|
||||||
|
{{- toYaml $runnerPodSpecExtraFields | nindent 6 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -26,3 +26,21 @@ tests:
|
|||||||
- equal:
|
- equal:
|
||||||
path: spec.listenerTemplate.spec.containers[0].securityContext.runAsUser
|
path: spec.listenerTemplate.spec.containers[0].securityContext.runAsUser
|
||||||
value: 1000
|
value: 1000
|
||||||
|
|
||||||
|
- it: should default listenerTemplate containers when not specified
|
||||||
|
set:
|
||||||
|
scaleset.name: "test"
|
||||||
|
auth.url: "https://github.com/org"
|
||||||
|
auth.githubToken: "gh_token12345"
|
||||||
|
controllerServiceAccount.name: "arc"
|
||||||
|
controllerServiceAccount.namespace: "arc-system"
|
||||||
|
listenerPodTemplate:
|
||||||
|
spec:
|
||||||
|
restartPolicy: Always
|
||||||
|
release:
|
||||||
|
name: "test-name"
|
||||||
|
namespace: "test-namespace"
|
||||||
|
asserts:
|
||||||
|
- equal:
|
||||||
|
path: spec.listenerTemplate.spec.containers[0].name
|
||||||
|
value: listener
|
||||||
|
|||||||
Reference in New Issue
Block a user