diff --git a/charts/studio/templates/_helpers.tpl b/charts/studio/templates/_helpers.tpl index 2a587af1..a802c1dd 100644 --- a/charts/studio/templates/_helpers.tpl +++ b/charts/studio/templates/_helpers.tpl @@ -176,6 +176,14 @@ Create the name of the service account to use {{- end }} {{- end }} +{{- define "studio-backend.serviceAccountName" -}} +{{- if .Values.studioWorker.serviceAccount.create }} +{{- default (printf "%s%s" (include "studio.fullname" .) "-backend") .Values.studioWorker.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.studioWorker.serviceAccount.name }} +{{- end }} +{{- end }} + {{- define "studio-worker.serviceAccountName" -}} {{- if .Values.studioWorker.serviceAccount.create }} {{- default (printf "%s%s" (include "studio.fullname" .) "-worker") .Values.studioWorker.serviceAccount.name }} diff --git a/charts/studio/templates/deployment-studio-backend.yaml b/charts/studio/templates/deployment-studio-backend.yaml index 7c5ca306..bf0d6aa6 100644 --- a/charts/studio/templates/deployment-studio-backend.yaml +++ b/charts/studio/templates/deployment-studio-backend.yaml @@ -32,7 +32,7 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "studio.serviceAccountName" . }} + serviceAccountName: {{ include "studio-backend.serviceAccountName" . }} securityContext: fsGroup: 103 fsGroupChangePolicy: "OnRootMismatch" diff --git a/charts/studio/templates/serviceaccount-backend.yaml b/charts/studio/templates/serviceaccount-backend.yaml new file mode 100644 index 00000000..eeb9e5e6 --- /dev/null +++ b/charts/studio/templates/serviceaccount-backend.yaml @@ -0,0 +1,12 @@ +{{- if .Values.studioBackend.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "studio-backend.serviceAccountName" . }} + labels: + {{- include "studio-backend.labels" . | nindent 4 }} + {{- with .Values.studioBackend.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }}