File tree Expand file tree Collapse file tree 8 files changed +17
-42
lines changed Expand file tree Collapse file tree 8 files changed +17
-42
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ If release name contains chart name it will be used as a full name.
24
24
{ {- end -} }
25
25
{ {- end -} }
26
26
27
+ { {/*
28
+ Create a service account name.
29
+ */} }
30
+ { {- define " postgres-operator.serviceAccountName" -} }
31
+ { { default (include " postgres-operator.fullname" .) .Values.serviceAccount.name } }
32
+ { {- end -} }
33
+
27
34
{ {/*
28
35
Create chart name and version as used by the chart label.
29
36
*/} }
Original file line number Diff line number Diff line change 2
2
apiVersion : rbac.authorization.k8s.io/v1beta1
3
3
kind : ClusterRole
4
4
metadata :
5
- name : {{- if eq .Values.serviceAccount.name "" }}
6
- {{ template "postgres-operator.fullname" . }}
7
- {{- else }}
8
- {{ .Values.serviceAccount.name }}
9
- {{- end }}
5
+ name : {{ include "postgres-operator.serviceAccountName" . }}
10
6
labels :
11
7
app.kubernetes.io/name : {{ template "postgres-operator.name" . }}
12
8
helm.sh/chart : {{ template "postgres-operator.chart" . }}
@@ -145,11 +141,7 @@ rules:
145
141
verbs :
146
142
- bind
147
143
resourceNames :
148
- - {{- if eq .Values.serviceAccount.name "" }}
149
- {{ template "postgres-operator.fullname" . }}
150
- {{- else }}
151
- {{ .Values.serviceAccount.name }}
152
- {{- end }}
144
+ - {{ include "postgres-operator.serviceAccountName" . }}
153
145
- apiGroups :
154
146
- batch
155
147
resources :
Original file line number Diff line number Diff line change 2
2
apiVersion : rbac.authorization.k8s.io/v1
3
3
kind : ClusterRoleBinding
4
4
metadata :
5
- name : {{- if eq .Values.serviceAccount.name "" }}
6
- {{ template "postgres-operator.fullname" . }}
7
- {{- else }}
8
- {{ .Values.serviceAccount.name }}
9
- {{- end }}
5
+ name : {{ include "postgres-operator.serviceAccountName" . }}
10
6
labels :
11
7
app.kubernetes.io/name : {{ template "postgres-operator.name" . }}
12
8
helm.sh/chart : {{ template "postgres-operator.chart" . }}
@@ -15,19 +11,11 @@ metadata:
15
11
roleRef :
16
12
apiGroup : rbac.authorization.k8s.io
17
13
kind : ClusterRole
18
- name : {{- if eq .Values.serviceAccount.name "" }}
19
- {{ template "postgres-operator.fullname" . }}
20
- {{- else }}
21
- {{ .Values.serviceAccount.name }}
22
- {{- end }}
14
+ name : {{ include "postgres-operator.serviceAccountName" . }}
23
15
subjects :
24
16
- kind : ServiceAccount
25
17
# note: the cluster role binding needs to be defined
26
18
# for every namespace the operator service account lives in.
27
- name : {{- if eq .Values.serviceAccount.name "" }}
28
- {{ template "postgres-operator.fullname" . }}
29
- {{- else }}
30
- {{ .Values.serviceAccount.name }}
31
- {{- end }}
19
+ name : {{ include "postgres-operator.serviceAccountName" . }}
32
20
namespace : {{ .Release.Namespace }}
33
21
{{ end }}
Original file line number Diff line number Diff line change @@ -9,11 +9,7 @@ metadata:
9
9
app.kubernetes.io/managed-by : {{ .Release.Service }}
10
10
app.kubernetes.io/instance : {{ .Release.Name }}
11
11
data :
12
- pod_service_account_name : {{- if eq .Values.serviceAccount.name "" }}
13
- {{ template "postgres-operator.fullname" . }}
14
- {{- else }}
15
- {{ .Values.serviceAccount.name }}
16
- {{- end }}
12
+ pod_service_account_name : {{ include "postgres-operator.serviceAccountName" . }}
17
13
{{ toYaml .Values.configGeneral | indent 2 }}
18
14
{{ toYaml .Values.configUsers | indent 2 }}
19
15
{{ toYaml .Values.configKubernetes | indent 2 }}
Original file line number Diff line number Diff line change 31
31
{{ toYaml .Values.podLabels | indent 8 }}
32
32
{{- end }}
33
33
spec :
34
- serviceAccountName : {{- if eq .Values.serviceAccount.name "" }}
35
- {{ template "postgres-operator.fullname" . }}
36
- {{- else }}
37
- {{ .Values.serviceAccount.name }}
38
- {{- end }}
34
+ serviceAccountName : {{ include "postgres-operator.serviceAccountName" . }}
39
35
containers :
40
36
- name : {{ .Chart.Name }}
41
37
image : " {{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
Original file line number Diff line number Diff line change 2
2
apiVersion : v1
3
3
kind : ServiceAccount
4
4
metadata :
5
- name : {{- if eq .Values.serviceAccount.name "" }}
6
- {{ template "postgres-operator.fullname" . }}
7
- {{- else }}
8
- {{ .Values.serviceAccount.name }}
9
- {{- end }}
5
+ name : {{ include "postgres-operator.serviceAccountName" . }}
10
6
labels :
11
7
app.kubernetes.io/name : {{ template "postgres-operator.name" . }}
12
8
helm.sh/chart : {{ template "postgres-operator.chart" . }}
Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ serviceAccount:
245
245
# If not set and create is true, a name is generated using the fullname template
246
246
# When relying solely on the OperatorConfiguration CRD, set this value to "operator"
247
247
# Otherwise, the operator tries to use the "default" service account which is forbidden
248
- name : " operator"
248
+ name : operator
249
249
250
250
priorityClassName : " "
251
251
Original file line number Diff line number Diff line change @@ -226,7 +226,7 @@ serviceAccount:
226
226
# If not set and create is true, a name is generated using the fullname template
227
227
# When relying solely on the OperatorConfiguration CRD, set this value to "operator"
228
228
# Otherwise, the operator tries to use the "default" service account which is forbidden
229
- name : " "
229
+ name :
230
230
231
231
priorityClassName : " "
232
232
You can’t perform that action at this time.
0 commit comments