108 lines
4.5 KiB
YAML
108 lines
4.5 KiB
YAML
apiVersion: actions.github.com/v1alpha1
|
|
kind: AutoscalingRunnerSet
|
|
metadata:
|
|
name: {{ .Release.Name }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
{{- include "gha-runner-scale-set.labels" . | nindent 4 }}
|
|
spec:
|
|
githubConfigUrl: {{ required ".Values.githubConfigUrl is required" .Values.githubConfigUrl }}
|
|
githubConfigSecret: {{ include "gha-runner-scale-set.githubsecret" . }}
|
|
{{- with .Values.runnerGroup }}
|
|
runnerGroup: {{ . }}
|
|
{{- end }}
|
|
|
|
{{- if .Values.proxy }}
|
|
proxy:
|
|
{{- if .Values.proxy.http }}
|
|
http:
|
|
url: {{ .Values.proxy.http.url }}
|
|
credentialSecretRef: {{ .Values.proxy.http.credentialSecretRef }}
|
|
{{ end }}
|
|
{{- if .Values.proxy.https }}
|
|
https:
|
|
url: {{ .Values.proxy.https.url }}
|
|
credentialSecretRef: {{ .Values.proxy.https.credentialSecretRef }}
|
|
{{ end }}
|
|
{{- if and .Values.proxy.noProxy (kindIs "slice" .Values.proxy.noProxy) }}
|
|
noProxy: {{ .Values.proxy.noProxy | toYaml | nindent 6}}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{- if and (or (kindIs "int64" .Values.minRunners) (kindIs "float64" .Values.minRunners)) (or (kindIs "int64" .Values.maxRunners) (kindIs "float64" .Values.maxRunners)) }}
|
|
{{- if gt .Values.minRunners .Values.maxRunners }}
|
|
{{- fail "maxRunners has to be greater or equal to minRunners" }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
{{- if or (kindIs "int64" .Values.maxRunners) (kindIs "float64" .Values.maxRunners) }}
|
|
{{- if lt (.Values.maxRunners | int) 0 }}
|
|
{{- fail "maxRunners has to be greater or equal to 0" }}
|
|
{{- end }}
|
|
maxRunners: {{ .Values.maxRunners | int }}
|
|
{{- end }}
|
|
|
|
{{- if or (kindIs "int64" .Values.minRunners) (kindIs "float64" .Values.minRunners) }}
|
|
{{- if lt (.Values.minRunners | int) 0 }}
|
|
{{- fail "minRunners has to be greater or equal to 0" }}
|
|
{{- end }}
|
|
minRunners: {{ .Values.minRunners | int }}
|
|
{{- end }}
|
|
|
|
template:
|
|
{{- with .Values.template.metadata }}
|
|
metadata:
|
|
{{- with .labels }}
|
|
labels:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .annotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
spec:
|
|
{{- range $key, $val := .Values.template.spec }}
|
|
{{- if and (ne $key "containers") (ne $key "volumes") (ne $key "initContainers") (ne $key "serviceAccountName") }}
|
|
{{ $key }}: {{ $val | toYaml | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if eq .Values.containerMode.type "kubernetes" }}
|
|
serviceAccountName: {{ default (include "gha-runner-scale-set.kubeModeServiceAccountName" .) .Values.template.spec.serviceAccountName }}
|
|
{{- else }}
|
|
serviceAccountName: {{ default (include "gha-runner-scale-set.noPermissionServiceAccountName" .) .Values.template.spec.serviceAccountName }}
|
|
{{- end }}
|
|
{{- if or .Values.template.spec.initContainers (eq .Values.containerMode.type "dind") }}
|
|
initContainers:
|
|
{{- if eq .Values.containerMode.type "dind" }}
|
|
- name: init-dind-externals
|
|
{{- include "gha-runner-scale-set.dind-init-container" . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.template.spec.initContainers }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
containers:
|
|
{{- if eq .Values.containerMode.type "dind" }}
|
|
- name: runner
|
|
{{- 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 }}
|
|
{{- else if eq .Values.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 }}
|
|
{{- else }}
|
|
{{ .Values.template.spec.containers | toYaml | nindent 6 }}
|
|
{{- end }}
|
|
{{- if or .Values.template.spec.volumes (eq .Values.containerMode.type "dind") (eq .Values.containerMode.type "kubernetes") }}
|
|
volumes:
|
|
{{- if eq .Values.containerMode.type "dind" }}
|
|
{{- include "gha-runner-scale-set.dind-volume" . | nindent 6 }}
|
|
{{- include "gha-runner-scale-set.dind-work-volume" . | nindent 6 }}
|
|
{{- else if eq .Values.containerMode.type "kubernetes" }}
|
|
{{- include "gha-runner-scale-set.kubernetes-mode-work-volume" . | nindent 6 }}
|
|
{{- end }}
|
|
{{- include "gha-runner-scale-set.non-work-volumes" . | nindent 6 }}
|
|
{{- end }} |