2021-01-17 01:09:41 +00:00
|
|
|
{{ if .Values.rbac.create }}
|
|
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
|
|
kind: ClusterRole
|
|
|
|
metadata:
|
|
|
|
name: {{ include "postgres-pod.serviceAccountName" . }}
|
|
|
|
labels:
|
|
|
|
app.kubernetes.io/name: {{ template "postgres-operator.name" . }}
|
|
|
|
helm.sh/chart: {{ template "postgres-operator.chart" . }}
|
|
|
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
|
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
|
|
rules:
|
|
|
|
# Patroni needs to watch and manage endpoints
|
2021-02-23 00:40:14 +00:00
|
|
|
{{- if toString .Values.configGeneral.kubernetes_use_configmaps | eq "true" }}
|
|
|
|
- apiGroups:
|
|
|
|
- ""
|
|
|
|
resources:
|
|
|
|
- configmaps
|
|
|
|
verbs:
|
|
|
|
- create
|
|
|
|
- delete
|
|
|
|
- deletecollection
|
|
|
|
- get
|
|
|
|
- list
|
|
|
|
- patch
|
|
|
|
- update
|
|
|
|
- watch
|
|
|
|
- apiGroups:
|
|
|
|
- ""
|
|
|
|
resources:
|
|
|
|
- endpoints
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
{{- else }}
|
2021-01-17 01:09:41 +00:00
|
|
|
- apiGroups:
|
|
|
|
- ""
|
|
|
|
resources:
|
|
|
|
- endpoints
|
|
|
|
verbs:
|
|
|
|
- create
|
|
|
|
- delete
|
|
|
|
- deletecollection
|
|
|
|
- get
|
|
|
|
- list
|
|
|
|
- patch
|
|
|
|
- update
|
|
|
|
- watch
|
2021-02-23 00:40:14 +00:00
|
|
|
{{- end }}
|
2021-01-17 01:09:41 +00:00
|
|
|
# Patroni needs to watch pods
|
|
|
|
- apiGroups:
|
|
|
|
- ""
|
|
|
|
resources:
|
|
|
|
- pods
|
|
|
|
verbs:
|
|
|
|
- get
|
|
|
|
- list
|
|
|
|
- patch
|
|
|
|
- update
|
|
|
|
- watch
|
|
|
|
# to let Patroni create a headless service
|
|
|
|
- apiGroups:
|
|
|
|
- ""
|
|
|
|
resources:
|
|
|
|
- services
|
|
|
|
verbs:
|
|
|
|
- create
|
2021-02-23 00:40:14 +00:00
|
|
|
{{- if toString .Values.configKubernetes.spilo_privileged | eq "true" }}
|
2021-01-17 01:09:41 +00:00
|
|
|
# to run privileged pods
|
|
|
|
- apiGroups:
|
|
|
|
- extensions
|
|
|
|
resources:
|
|
|
|
- podsecuritypolicies
|
|
|
|
resourceNames:
|
|
|
|
- privileged
|
|
|
|
verbs:
|
|
|
|
- use
|
2021-02-23 00:40:14 +00:00
|
|
|
{{- end }}
|
2021-01-17 01:09:41 +00:00
|
|
|
{{ end }}
|