Skip to content

Commit 4b90809

Browse files
GottoxEnno Boland
andauthored
helm-chart: allow configmaps instead of endpoints for leader elections… (zalando#1037)
* helm-chart: allow configmaps instead of endpoints if leader elections uses the configmaps method * helm-chart: allow endpoints get even if config maps are used * helm-chart: allow configmaps instead of endpoints on the operator role too. Co-authored-by: Enno Boland <[email protected]>
1 parent fbd0489 commit 4b90809

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

charts/postgres-operator/templates/clusterrole-postgres-pod.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,27 @@ metadata:
1010
app.kubernetes.io/instance: {{ .Release.Name }}
1111
rules:
1212
# Patroni needs to watch and manage endpoints
13+
{{- if toString .Values.configGeneral.kubernetes_use_configmaps | eq "true" }}
14+
- apiGroups:
15+
- ""
16+
resources:
17+
- configmaps
18+
verbs:
19+
- create
20+
- delete
21+
- deletecollection
22+
- get
23+
- list
24+
- patch
25+
- update
26+
- watch
27+
- apiGroups:
28+
- ""
29+
resources:
30+
- endpoints
31+
verbs:
32+
- get
33+
{{- else }}
1334
- apiGroups:
1435
- ""
1536
resources:
@@ -23,6 +44,7 @@ rules:
2344
- patch
2445
- update
2546
- watch
47+
{{- end }}
2648
# Patroni needs to watch pods
2749
- apiGroups:
2850
- ""

charts/postgres-operator/templates/clusterrole.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,15 @@ rules:
6363
- patch
6464
- update
6565
- watch
66-
# to manage endpoints which are also used by Patroni
66+
# to manage endpoints/configmaps which are also used by Patroni
6767
- apiGroups:
6868
- ""
6969
resources:
70+
{{- if toString .Values.configGeneral.kubernetes_use_configmaps | eq "true" }}
71+
- configmaps
72+
{{- else }}
7073
- endpoints
74+
{{- end }}
7175
verbs:
7276
- create
7377
- delete

0 commit comments

Comments
 (0)