diff --git a/charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml b/charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml index 455a7d0b..df43ffbb 100644 --- a/charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml +++ b/charts/gha-runner-scale-set/templates/autoscalingrunnerset.yaml @@ -91,14 +91,15 @@ spec: {{ $key }}: {{ $val | toYaml | nindent 8 }} {{- end }} {{- end }} - {{- if eq .Values.containerMode.type "kubernetes" }} + {{- $containerMode := .Values.containerMode }} + {{- if eq $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") }} + {{- if or .Values.template.spec.initContainers (eq $containerMode.type "dind") }} initContainers: - {{- if eq .Values.containerMode.type "dind" }} + {{- if eq $containerMode.type "dind" }} - name: init-dind-externals {{- include "gha-runner-scale-set.dind-init-container" . | nindent 8 }} {{- end }} @@ -107,13 +108,13 @@ spec: {{- end }} {{- end }} containers: - {{- if eq .Values.containerMode.type "dind" }} + {{- if eq $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-non-dind-containers" . | nindent 6 }} - {{- else if eq .Values.containerMode.type "kubernetes" }} + {{- else if eq $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 }} @@ -121,16 +122,16 @@ spec: {{- include "gha-runner-scale-set.default-mode-runner-containers" . | nindent 6 }} {{- end }} {{- $tlsConfig := (default (dict) .Values.githubServerTLS) }} - {{- if or .Values.template.spec.volumes (eq .Values.containerMode.type "dind") (eq .Values.containerMode.type "kubernetes") $tlsConfig.runnerMountPath }} + {{- if or .Values.template.spec.volumes (eq $containerMode.type "dind") (eq $containerMode.type "kubernetes") $tlsConfig.runnerMountPath }} volumes: {{- if $tlsConfig.runnerMountPath }} {{- include "gha-runner-scale-set.tls-volume" $tlsConfig | nindent 6 }} {{- end }} - {{- if eq .Values.containerMode.type "dind" }} + {{- if eq $containerMode.type "dind" }} {{- include "gha-runner-scale-set.dind-volume" . | nindent 6 }} {{- include "gha-runner-scale-set.dind-work-volume" . | nindent 6 }} {{- include "gha-runner-scale-set.non-work-volumes" . | nindent 6 }} - {{- else if eq .Values.containerMode.type "kubernetes" }} + {{- else if eq $containerMode.type "kubernetes" }} {{- include "gha-runner-scale-set.kubernetes-mode-work-volume" . | nindent 6 }} {{- include "gha-runner-scale-set.non-work-volumes" . | nindent 6 }} {{- else }} diff --git a/charts/gha-runner-scale-set/templates/kube_mode_role.yaml b/charts/gha-runner-scale-set/templates/kube_mode_role.yaml index ffc0c68e..9f98e0dc 100644 --- a/charts/gha-runner-scale-set/templates/kube_mode_role.yaml +++ b/charts/gha-runner-scale-set/templates/kube_mode_role.yaml @@ -1,4 +1,5 @@ -{{- if and (eq .Values.containerMode.type "kubernetes") (not .Values.template.spec.serviceAccountName) }} +{{- $containerMode := .Values.containerMode }} +{{- if and (eq $containerMode.type "kubernetes") (not .Values.template.spec.serviceAccountName) }} # default permission for runner pod service account in kubernetes mode (container hook) apiVersion: rbac.authorization.k8s.io/v1 kind: Role @@ -21,4 +22,4 @@ rules: - apiGroups: [""] resources: ["secrets"] verbs: ["get", "list", "create", "delete"] -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/gha-runner-scale-set/templates/kube_mode_role_binding.yaml b/charts/gha-runner-scale-set/templates/kube_mode_role_binding.yaml index bd1c634d..fb04e7a3 100644 --- a/charts/gha-runner-scale-set/templates/kube_mode_role_binding.yaml +++ b/charts/gha-runner-scale-set/templates/kube_mode_role_binding.yaml @@ -1,4 +1,5 @@ -{{- if and (eq .Values.containerMode.type "kubernetes") (not .Values.template.spec.serviceAccountName) }} +{{- $containerMode := .Values.containerMode }} +{{- if and (eq $containerMode.type "kubernetes") (not .Values.template.spec.serviceAccountName) }} apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: @@ -12,4 +13,4 @@ subjects: - kind: ServiceAccount name: {{ include "gha-runner-scale-set.kubeModeServiceAccountName" . }} namespace: {{ .Release.Namespace }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/gha-runner-scale-set/templates/kube_mode_serviceaccount.yaml b/charts/gha-runner-scale-set/templates/kube_mode_serviceaccount.yaml index 8f180f71..13b31ba2 100644 --- a/charts/gha-runner-scale-set/templates/kube_mode_serviceaccount.yaml +++ b/charts/gha-runner-scale-set/templates/kube_mode_serviceaccount.yaml @@ -1,4 +1,5 @@ -{{- if and (eq .Values.containerMode.type "kubernetes") (not .Values.template.spec.serviceAccountName) }} +{{- $containerMode := .Values.containerMode }} +{{- if and (eq $containerMode.type "kubernetes") (not .Values.template.spec.serviceAccountName) }} apiVersion: v1 kind: ServiceAccount metadata: @@ -6,4 +7,4 @@ metadata: namespace: {{ .Release.Namespace }} labels: {{- include "gha-runner-scale-set.labels" . | nindent 4 }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/gha-runner-scale-set/templates/no_permission_serviceaccount.yaml b/charts/gha-runner-scale-set/templates/no_permission_serviceaccount.yaml index 3aa2d0e2..8175c874 100644 --- a/charts/gha-runner-scale-set/templates/no_permission_serviceaccount.yaml +++ b/charts/gha-runner-scale-set/templates/no_permission_serviceaccount.yaml @@ -1,4 +1,5 @@ -{{- if and (ne .Values.containerMode.type "kubernetes") (not .Values.template.spec.serviceAccountName) }} +{{- $containerMode := .Values.containerMode }} +{{- if and (ne $containerMode.type "kubernetes") (not .Values.template.spec.serviceAccountName) }} apiVersion: v1 kind: ServiceAccount metadata: @@ -6,4 +7,4 @@ metadata: namespace: {{ .Release.Namespace }} labels: {{- include "gha-runner-scale-set.labels" . | nindent 4 }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/gha-runner-scale-set/values.yaml b/charts/gha-runner-scale-set/values.yaml index 40fb4661..dd6b5b89 100644 --- a/charts/gha-runner-scale-set/values.yaml +++ b/charts/gha-runner-scale-set/values.yaml @@ -68,16 +68,16 @@ githubConfigSecret: # key: ca.pem # runnerMountPath: /usr/local/share/ca-certificates/ -containerMode: - type: "" ## type can be set to dind or kubernetes - ## the following is required when containerMode.type=kubernetes - # kubernetesModeWorkVolumeClaim: - # accessModes: ["ReadWriteOnce"] - # # For local testing, use https://github.com/openebs/dynamic-localpv-provisioner/blob/develop/docs/quickstart.md to provide dynamic provision volume with storageClassName: openebs-hostpath - # storageClassName: "dynamic-blob-storage" - # resources: - # requests: - # storage: 1Gi +# containerMode: +# type: "dind" ## type can be set to dind or kubernetes +# ## the following is required when containerMode.type=kubernetes +# kubernetesModeWorkVolumeClaim: +# accessModes: ["ReadWriteOnce"] +# # For local testing, use https://github.com/openebs/dynamic-localpv-provisioner/blob/develop/docs/quickstart.md to provide dynamic provision volume with storageClassName: openebs-hostpath +# storageClassName: "dynamic-blob-storage" +# resources: +# requests: +# storage: 1Gi ## template is the PodSpec for each runner Pod template: @@ -161,7 +161,7 @@ template: image: ghcr.io/actions/actions-runner:latest command: ["/home/runner/run.sh"] -## Optional controller service account that needs to have required Role and RoleBinding +## Optional controller service account that needs to have required Role and RoleBinding ## to operate this gha-runner-scale-set installation. ## The helm chart will try to find the controller deployment and its service account at installation time. ## In case the helm chart can't find the right service account, you can explicitly pass in the following value @@ -169,4 +169,4 @@ template: ## Note: if your controller is installed to only watch a single namespace, you have to pass these values explicitly. # controllerServiceAccount: # namespace: arc-system -# name: test-arc-gha-runner-scale-set-controller \ No newline at end of file +# name: test-arc-gha-runner-scale-set-controller