File tree Expand file tree Collapse file tree
packages/system/postgres-operator/charts/cloudnative-pg Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11apiVersion : v2
2- appVersion : 1.24 .0
2+ appVersion : 1.25 .0
33dependencies :
44- alias : monitoring
55 condition : monitoring.grafanaDashboard.create
@@ -22,4 +22,4 @@ name: cloudnative-pg
2222sources :
2323- https://github.com/cloudnative-pg/charts
2424type : application
25- version : 0.22 .0
25+ version : 0.23 .0
Load diff Large diffs are not rendered by default.
Original file line number Diff line number Diff line change 11
22CloudNativePG operator should be installed in namespace "{{ .Release.Namespace }}".
3- You can now create a PostgreSQL cluster with 3 nodes in the current namespace as follows:
3+ You can now create a PostgreSQL cluster with 3 nodes as follows:
44
55cat <<EOF | kubectl apply -f -
66# Example of PostgreSQL cluster
77apiVersion: postgresql.cnpg.io/v1
88kind: Cluster
99metadata:
1010 name: cluster-example
11+ {{if not .Values.config.clusterWide -}}
12+ namespace: {{ .Release.Namespace }}
13+ {{- end }}
1114spec:
1215 instances: 3
1316 storage:
1417 size: 1Gi
1518EOF
1619
17- kubectl get cluster
20+ kubectl get -A cluster
1821
Original file line number Diff line number Diff line change 1+ {{/*
2+ Allow the release namespace to be overridden for multi-namespace deployments in combined charts
3+ */ }}
4+ {{- define " cloudnative-pg.namespace" -}}
5+ {{- if .Values.namespaceOverride -}}
6+ {{- .Values.namespaceOverride -}}
7+ {{- else -}}
8+ {{- .Release.Namespace -}}
9+ {{- end -}}
10+ {{- end -}}
11+
112{{/*
213Expand the name of the chart.
314*/ }}
@@ -60,3 +71,231 @@ Create the name of the service account to use
6071{{- default " default" .Values.serviceAccount.name }}
6172{{- end }}
6273{{- end }}
74+
75+ {{/*
76+ Define the common set of rules that can be applied either with
77+ namespace scope or clusterwide
78+ */ }}
79+ {{- define " cloudnative-pg.commonRules" }}
80+ - apiGroups:
81+ - " "
82+ resources:
83+ - configmaps
84+ - secrets
85+ - services
86+ verbs:
87+ - create
88+ - delete
89+ - get
90+ - list
91+ - patch
92+ - update
93+ - watch
94+ - apiGroups:
95+ - " "
96+ resources:
97+ - configmaps/status
98+ - secrets/status
99+ verbs:
100+ - get
101+ - patch
102+ - update
103+ - apiGroups:
104+ - " "
105+ resources:
106+ - events
107+ verbs:
108+ - create
109+ - patch
110+ - apiGroups:
111+ - " "
112+ resources:
113+ - persistentvolumeclaims
114+ - pods
115+ - pods/exec
116+ verbs:
117+ - create
118+ - delete
119+ - get
120+ - list
121+ - patch
122+ - watch
123+ - apiGroups:
124+ - " "
125+ resources:
126+ - pods/status
127+ verbs:
128+ - get
129+ - apiGroups:
130+ - " "
131+ resources:
132+ - serviceaccounts
133+ verbs:
134+ - create
135+ - get
136+ - list
137+ - patch
138+ - update
139+ - watch
140+ - apiGroups:
141+ - apps
142+ resources:
143+ - deployments
144+ verbs:
145+ - create
146+ - delete
147+ - get
148+ - list
149+ - patch
150+ - update
151+ - watch
152+ - apiGroups:
153+ - batch
154+ resources:
155+ - jobs
156+ verbs:
157+ - create
158+ - delete
159+ - get
160+ - list
161+ - patch
162+ - watch
163+ - apiGroups:
164+ - coordination.k8s.io
165+ resources:
166+ - leases
167+ verbs:
168+ - create
169+ - get
170+ - update
171+ - apiGroups:
172+ - monitoring.coreos.com
173+ resources:
174+ - podmonitors
175+ verbs:
176+ - create
177+ - delete
178+ - get
179+ - list
180+ - patch
181+ - watch
182+ - apiGroups:
183+ - policy
184+ resources:
185+ - poddisruptionbudgets
186+ verbs:
187+ - create
188+ - delete
189+ - get
190+ - list
191+ - patch
192+ - update
193+ - watch
194+ - apiGroups:
195+ - postgresql.cnpg.io
196+ resources:
197+ - backups
198+ - clusters
199+ - databases
200+ - poolers
201+ - publications
202+ - scheduledbackups
203+ - subscriptions
204+ verbs:
205+ - create
206+ - delete
207+ - get
208+ - list
209+ - patch
210+ - update
211+ - watch
212+ - apiGroups:
213+ - postgresql.cnpg.io
214+ resources:
215+ - backups/status
216+ - databases/status
217+ - publications/status
218+ - scheduledbackups/status
219+ - subscriptions/status
220+ verbs:
221+ - get
222+ - patch
223+ - update
224+ - apiGroups:
225+ - postgresql.cnpg.io
226+ resources:
227+ - imagecatalogs
228+ verbs:
229+ - get
230+ - list
231+ - watch
232+ - apiGroups:
233+ - postgresql.cnpg.io
234+ resources:
235+ - clusters/finalizers
236+ - poolers/finalizers
237+ verbs:
238+ - update
239+ - apiGroups:
240+ - postgresql.cnpg.io
241+ resources:
242+ - clusters/status
243+ - poolers/status
244+ verbs:
245+ - get
246+ - patch
247+ - update
248+ - watch
249+ - apiGroups:
250+ - rbac.authorization.k8s.io
251+ resources:
252+ - rolebindings
253+ - roles
254+ verbs:
255+ - create
256+ - get
257+ - list
258+ - patch
259+ - update
260+ - watch
261+ - apiGroups:
262+ - snapshot.storage.k8s.io
263+ resources:
264+ - volumesnapshots
265+ verbs:
266+ - create
267+ - get
268+ - list
269+ - patch
270+ - watch
271+ {{- end }}
272+
273+ {{/*
274+ Define the set of rules that must be applied clusterwide
275+ */ }}
276+ {{- define " cloudnative-pg.clusterwideRules" }}
277+ - apiGroups:
278+ - " "
279+ resources:
280+ - nodes
281+ verbs:
282+ - get
283+ - list
284+ - watch
285+ - apiGroups:
286+ - admissionregistration.k8s.io
287+ resources:
288+ - mutatingwebhookconfigurations
289+ - validatingwebhookconfigurations
290+ verbs:
291+ - get
292+ - patch
293+ - apiGroups:
294+ - postgresql.cnpg.io
295+ resources:
296+ - clusterimagecatalogs
297+ verbs:
298+ - get
299+ - list
300+ - watch
301+ {{- end }}
Original file line number Diff line number Diff line change @@ -19,14 +19,21 @@ apiVersion: v1
1919kind : ConfigMap
2020metadata :
2121 name : {{ .Values.config.name }}
22+ namespace : {{ include "cloudnative-pg.namespace" . }}
2223 labels :
2324 {{- include "cloudnative-pg.labels" . | nindent 4 }}
2425 {{- with .Values.commonAnnotations }}
2526 annotations :
2627 {{- toYaml . | nindent 4 }}
2728 {{- end }}
2829data :
30+ {{- if .Values.config.clusterWide -}}
2931 {{- toYaml .Values.config.data | nindent 2 }}
32+ {{- else -}}
33+ {{- $watchNamespaceMap := dict "WATCH_NAMESPACE" .Release.Namespace -}}
34+ {{- $fullConfiguration := merge .Values.config.data $watchNamespaceMap -}}
35+ {{- toYaml $fullConfiguration | nindent 2 }}
36+ {{- end -}}
3037{{- else }}
3138apiVersion : v1
3239kind : Secret
@@ -40,6 +47,12 @@ metadata:
4047 {{- toYaml . | nindent 4 }}
4148 {{- end }}
4249stringData :
50+ {{- if .Values.config.clusterWide -}}
4351 {{- toYaml .Values.config.data | nindent 2 }}
52+ {{- else -}}
53+ {{- $watchNamespaceMap := dict "WATCH_NAMESPACE" .Release.Namespace -}}
54+ {{- $fullConfiguration := merge .Values.config.data $watchNamespaceMap -}}
55+ {{- toYaml $fullConfiguration | nindent 2 }}
56+ {{- end -}}
4457{{- end }}
4558{{- end }}
You can’t perform that action at this time.
0 commit comments