diff --git a/deploy/helm/hive-operator/templates/_helpers.tpl b/deploy/helm/hive-operator/templates/_helpers.tpl index 7d4d39da..e5354470 100644 --- a/deploy/helm/hive-operator/templates/_helpers.tpl +++ b/deploy/helm/hive-operator/templates/_helpers.tpl @@ -65,9 +65,9 @@ Create the name of the service account to use */}} {{- define "operator.serviceAccountName" -}} {{- if .Values.serviceAccount.create }} -{{- default (include "operator.fullname" .) .Values.serviceAccount.name }} +{{- default (printf "%s-serviceaccount" (include "operator.fullname" .)) .Values.serviceAccount.name }} {{- else }} -{{- default "default" .Values.serviceAccount.name }} +{{- required "serviceAccount.name is required when serviceAccount.create is false, because the chart then does not create a ServiceAccount for the operator to run as." .Values.serviceAccount.name }} {{- end }} {{- end }} diff --git a/deploy/helm/hive-operator/templates/deployment.yaml b/deploy/helm/hive-operator/templates/deployment.yaml index 06dde967..86be9ad2 100644 --- a/deploy/helm/hive-operator/templates/deployment.yaml +++ b/deploy/helm/hive-operator/templates/deployment.yaml @@ -29,7 +29,7 @@ spec: imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} - serviceAccountName: {{ include "operator.fullname" . }}-serviceaccount + serviceAccountName: {{ include "operator.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: diff --git a/deploy/helm/hive-operator/templates/serviceaccount.yaml b/deploy/helm/hive-operator/templates/serviceaccount.yaml index 8ba0d58c..10633e5f 100644 --- a/deploy/helm/hive-operator/templates/serviceaccount.yaml +++ b/deploy/helm/hive-operator/templates/serviceaccount.yaml @@ -3,7 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "operator.fullname" . }}-serviceaccount + name: {{ include "operator.serviceAccountName" . }} labels: {{- include "operator.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} @@ -20,7 +20,7 @@ metadata: {{- include "operator.labels" . | nindent 4 }} subjects: - kind: ServiceAccount - name: {{ include "operator.fullname" . }}-serviceaccount + name: {{ include "operator.serviceAccountName" . }} namespace: {{ .Release.Namespace }} roleRef: kind: ClusterRole