Simplify service account name in helm chart (#612)
* Simplify service account name in helm chart (#610)
This commit is contained in:
parent
7c19cf50db
commit
1c340c68c6
|
|
@ -24,6 +24,13 @@ If release name contains chart name it will be used as a full name.
|
|||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a service account name.
|
||||
*/}}
|
||||
{{- define "postgres-operator.serviceAccountName" -}}
|
||||
{{ default (include "postgres-operator.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{- if eq .Values.serviceAccount.name "" }}
|
||||
{{ template "postgres-operator.fullname" . }}
|
||||
{{- else }}
|
||||
{{ .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
name: {{ include "postgres-operator.serviceAccountName" . }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
|
||||
helm.sh/chart: {{ template "postgres-operator.chart" . }}
|
||||
|
|
@ -145,11 +141,7 @@ rules:
|
|||
verbs:
|
||||
- bind
|
||||
resourceNames:
|
||||
- {{- if eq .Values.serviceAccount.name "" }}
|
||||
{{ template "postgres-operator.fullname" . }}
|
||||
{{- else }}
|
||||
{{ .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
- {{ include "postgres-operator.serviceAccountName" . }}
|
||||
- apiGroups:
|
||||
- batch
|
||||
resources:
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{- if eq .Values.serviceAccount.name "" }}
|
||||
{{ template "postgres-operator.fullname" . }}
|
||||
{{- else }}
|
||||
{{ .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
name: {{ include "postgres-operator.serviceAccountName" . }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
|
||||
helm.sh/chart: {{ template "postgres-operator.chart" . }}
|
||||
|
|
@ -15,19 +11,11 @@ metadata:
|
|||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{- if eq .Values.serviceAccount.name "" }}
|
||||
{{ template "postgres-operator.fullname" . }}
|
||||
{{- else }}
|
||||
{{ .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
name: {{ include "postgres-operator.serviceAccountName" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
# note: the cluster role binding needs to be defined
|
||||
# for every namespace the operator service account lives in.
|
||||
name: {{- if eq .Values.serviceAccount.name "" }}
|
||||
{{ template "postgres-operator.fullname" . }}
|
||||
{{- else }}
|
||||
{{ .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
name: {{ include "postgres-operator.serviceAccountName" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{ end }}
|
||||
|
|
|
|||
|
|
@ -9,11 +9,7 @@ metadata:
|
|||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
data:
|
||||
pod_service_account_name: {{- if eq .Values.serviceAccount.name "" }}
|
||||
{{ template "postgres-operator.fullname" . }}
|
||||
{{- else }}
|
||||
{{ .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
pod_service_account_name: {{ include "postgres-operator.serviceAccountName" . }}
|
||||
{{ toYaml .Values.configGeneral | indent 2 }}
|
||||
{{ toYaml .Values.configUsers | indent 2 }}
|
||||
{{ toYaml .Values.configKubernetes | indent 2 }}
|
||||
|
|
|
|||
|
|
@ -31,11 +31,7 @@ spec:
|
|||
{{ toYaml .Values.podLabels | indent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceAccountName: {{- if eq .Values.serviceAccount.name "" }}
|
||||
{{ template "postgres-operator.fullname" . }}
|
||||
{{- else }}
|
||||
{{ .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "postgres-operator.serviceAccountName" . }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
|
|
|
|||
|
|
@ -2,11 +2,7 @@
|
|||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{- if eq .Values.serviceAccount.name "" }}
|
||||
{{ template "postgres-operator.fullname" . }}
|
||||
{{- else }}
|
||||
{{ .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
name: {{ include "postgres-operator.serviceAccountName" . }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
|
||||
helm.sh/chart: {{ template "postgres-operator.chart" . }}
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ serviceAccount:
|
|||
# If not set and create is true, a name is generated using the fullname template
|
||||
# When relying solely on the OperatorConfiguration CRD, set this value to "operator"
|
||||
# Otherwise, the operator tries to use the "default" service account which is forbidden
|
||||
name: "operator"
|
||||
name: operator
|
||||
|
||||
priorityClassName: ""
|
||||
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ serviceAccount:
|
|||
# If not set and create is true, a name is generated using the fullname template
|
||||
# When relying solely on the OperatorConfiguration CRD, set this value to "operator"
|
||||
# Otherwise, the operator tries to use the "default" service account which is forbidden
|
||||
name: ""
|
||||
name:
|
||||
|
||||
priorityClassName: ""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue