Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions template/deploy/helm/[[operator]]/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, we don't need to include -serviceaccount in the name, because the kind already indicates what the object is, a ServiceAccount.

We also do this in various other places, like the Deployments the operator creates. It wastes valuable characters and also duplicates information.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true but that'd be a breaking change, no?
For now I just want to make it work, we can change it later/separately if needed.

{{- 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 }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "operator.fullname" . }}-serviceaccount
serviceAccountName: {{ include "operator.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand Down