Skip to content

Commit

Permalink
Use the custom service account name if present, even if serviceAccoun…
Browse files Browse the repository at this point in the history
…t.create

is set to false
  • Loading branch information
Stuart133 committed Dec 7, 2022
1 parent 52f81d6 commit fbbbfe4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ app.kubernetes.io/instance: {{ .Release.Name }}
RBAC names
*/}}
{{- define "container-agent.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "container-agent.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name}}
{{- end }}
{{- end }}

{{- define "container-agent.roleName" -}}
Expand Down
2 changes: 0 additions & 2 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ spec:
- {{ toYaml . }}
{{- end}}
{{- end }}
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ include "container-agent.serviceAccountName" . }}
{{- end }}
{{- if .Values.agent.podSecurityContext }}
securityContext: {{- toYaml .Values.agent.podSecurityContext | nindent 8 }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ roleRef:
kind: ClusterRole
name: {{ include "container-agent.clusterRoleName" . }}
{{- end }} # if .Values.agent.autodetectPlatform
{{- end }} # if rbac.create
{{- end }}
{{- if .Values.logging.rbac.create }}
---
apiVersion: rbac.authorization.k8s.io/v1
Expand Down

0 comments on commit fbbbfe4

Please sign in to comment.