Skip to content

Commit 151b188

Browse files
authored
Merge pull request #342 from percona/K8SPG-597-pg-240
K8SPG-597 - Update PG operator chart for 2.4.0 release
2 parents 44fac1d + 12b6e78 commit 151b188

File tree

9 files changed

+27603
-15753
lines changed

9 files changed

+27603
-15753
lines changed

charts/pg-db/Chart.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ apiVersion: v2
22
name: pg-db
33
description: 'A Helm chart to deploy the PostgreSQL database with the Percona Operator for PostgreSQL'
44
type: application
5-
version: 2.3.18
6-
appVersion: 2.3.1
5+
version: 2.4.0
6+
appVersion: 2.4.0
77
home: https://docs.percona.com/percona-operator-for-postgresql/2.0/
88
maintainers:
99
- name: tplavcic

charts/pg-db/README.md

+50-12
Large diffs are not rendered by default.

charts/pg-db/templates/_helpers.tpl

-24
Original file line numberDiff line numberDiff line change
@@ -44,30 +44,6 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
4444
app.kubernetes.io/managed-by: {{ .Release.Service }}
4545
{{- end -}}
4646

47-
{{- define "pg-database.postgres-image" -}}
48-
{{- if .Values.image }}
49-
{{- .Values.image }}
50-
{{- else }}
51-
{{- printf "%s:%s-ppg%d-postgres" .Values.repository .Chart.AppVersion (.Values.postgresVersion | int ) }}
52-
{{- end }}
53-
{{- end -}}
54-
55-
{{- define "pg-database.backup-image" -}}
56-
{{- if .Values.backups.pgbackrest.image }}
57-
{{- .Values.backups.pgbackrest.image }}
58-
{{- else }}
59-
{{- printf "%s:%s-ppg%d-pgbackrest" .Values.repository .Chart.AppVersion (.Values.postgresVersion | int ) }}
60-
{{- end }}
61-
{{- end -}}
62-
63-
{{- define "pg-database.pgbouncer-image" -}}
64-
{{- if .Values.proxy.pgBouncer.image }}
65-
{{- .Values.proxy.pgBouncer.image }}
66-
{{- else }}
67-
{{- printf "%s:%s-ppg%d-pgbouncer" .Values.repository .Chart.AppVersion (.Values.postgresVersion | int )}}
68-
{{- end }}
69-
{{- end -}}
70-
7147
{{- define "pg-database.backup-repos" -}}
7248
{{- if .Values.backups.pgbackrest.repos }}
7349
repos:

charts/pg-db/templates/cluster.yaml

+132-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ metadata:
1717
namespace: {{ .Release.Namespace }}
1818
spec:
1919
crVersion: {{ .Values.crVersion }}
20-
image: {{ include "pg-database.postgres-image" . }}
20+
image: {{ .Values.image }}
2121
imagePullPolicy: Always
2222
port: {{ default 5432 .Values.port }}
2323
postgresVersion: {{ .Values.postgresVersion }}
@@ -78,6 +78,10 @@ spec:
7878
{{- range $option := $postgresCluster.options }}
7979
- {{ $option }}
8080
{{- end }}
81+
{{- if $postgresCluster.tolerations }}
82+
tolerations:
83+
{{ $postgresCluster.tolerations | toYaml | indent 8 }}
84+
{{- end }}
8185
{{- end }}
8286
{{- if $pgbackrest := $dataSource.pgbackrest }}
8387
pgbackrest:
@@ -89,6 +93,10 @@ spec:
8993
options:
9094
{{- range $option := $pgbackrest.options }}
9195
- {{ $option }}
96+
{{- end }}
97+
{{- if $pgbackrest.tolerations }}
98+
tolerations:
99+
{{ $pgbackrest.tolerations | toYaml | indent 8 }}
92100
{{- end }}
93101
repo:
94102
name: {{ $pgbackrest.repo.name }}
@@ -107,6 +115,21 @@ spec:
107115
container: {{ $azure.container }}
108116
{{- end }}
109117
{{- end }}
118+
{{- if $volumes := $dataSource.volumes }}
119+
volumes:
120+
{{- if $pgDataVolume := $volumes.pgDataVolume }}
121+
pgDataVolume:
122+
{{ $pgDataVolume | toYaml | indent 8 }}
123+
{{- end }}
124+
{{- if $pgWALVolume := $volumes.pgWALVolume }}
125+
pgWALVolume:
126+
{{ $pgWALVolume | toYaml | indent 8 }}
127+
{{- end }}
128+
{{- if $pgBackRestVolume := $volumes.pgBackRestVolume }}
129+
pgBackRestVolume:
130+
{{ $pgBackRestVolume | toYaml | indent 8 }}
131+
{{- end }}
132+
{{- end }}
110133
{{- end }}
111134

112135
{{- if .Values.expose }}
@@ -125,6 +148,22 @@ spec:
125148
{{ .Values.expose.loadBalancerSourceRanges | toYaml | indent 6 }}
126149
{{- end }}
127150
{{- end }}
151+
{{- if .Values.exposeReplicas }}
152+
exposeReplicas:
153+
type: {{ .Values.exposeReplicas.type }}
154+
{{- if .Values.exposeReplicas.annotations }}
155+
annotations:
156+
{{ .Values.exposeReplicas.annotations | toYaml | indent 6 }}
157+
{{- end }}
158+
{{- if .Values.exposeReplicas.labels }}
159+
labels:
160+
{{ .Values.exposeReplicas.labels | toYaml | indent 6 }}
161+
{{- end }}
162+
{{- if .Values.exposeReplicas.loadBalancerSourceRanges }}
163+
loadBalancerSourceRanges:
164+
{{ .Values.exposeReplicas.loadBalancerSourceRanges | toYaml | indent 6 }}
165+
{{- end }}
166+
{{- end }}
128167

129168
instances:
130169
{{- range $instance := .Values.instances }}
@@ -147,6 +186,20 @@ spec:
147186
memory: {{ $instance.resources.limits.memory }}
148187
{{- end }}
149188
{{- end }}
189+
{{- if $instance.containers }}
190+
containers:
191+
{{- if $instance.containers.replicaCertCopy }}
192+
replicaCertCopy:
193+
{{- if $instance.containers.replicaCertCopy.resources }}
194+
resources:
195+
{{- if $instance.containers.replicaCertCopy.resources.limits }}
196+
limits:
197+
cpu: {{ $instance.containers.replicaCertCopy.resources.limits.cpu }}
198+
memory: {{ $instance.containers.replicaCertCopy.resources.limits.memory }}
199+
{{- end }}
200+
{{- end }}
201+
{{- end }}
202+
{{- end }}
150203
{{- if $instance.sidecars }}
151204
sidecars:
152205
{{- range $sidecar := $instance.sidecars }}
@@ -177,6 +230,10 @@ spec:
177230
{{- if $instance.priorityClassName }}
178231
priorityClassName: {{ $instance.priorityClassName }}
179232
{{- end }}
233+
{{- if $instance.securityContext }}
234+
securityContext:
235+
{{ $instance.securityContext | toYaml | indent 8 }}
236+
{{- end }}
180237

181238
{{- if $instance.walVolumeClaimSpec }}
182239
walVolumeClaimSpec:
@@ -202,7 +259,7 @@ spec:
202259

203260
proxy:
204261
pgBouncer:
205-
image: {{ include "pg-database.pgbouncer-image" .}}
262+
image: {{ .Values.proxy.pgBouncer.image }}
206263
replicas: {{ .Values.proxy.pgBouncer.replicas}}
207264
exposeSuperusers: {{ .Values.proxy.pgBouncer.exposeSuperusers | default true }}
208265
{{- if .Values.proxy.pgBouncer.resources }}
@@ -218,6 +275,20 @@ spec:
218275
memory: {{ .Values.proxy.pgBouncer.resources.limits.memory }}
219276
{{- end }}
220277
{{- end }}
278+
{{- if .Values.proxy.pgBouncer.containers }}
279+
containers:
280+
{{- if .Values.proxy.pgBouncer.containers.pgbouncerConfig }}
281+
pgbouncerConfig:
282+
{{- if .Values.proxy.pgBouncer.containers.pgbouncerConfig.resources }}
283+
resources:
284+
{{- if .Values.proxy.pgBouncer.containers.pgbouncerConfig.resources.limits }}
285+
limits:
286+
cpu: {{ .Values.proxy.pgBouncer.containers.pgbouncerConfig.resources.limits.cpu }}
287+
memory: {{ .Values.proxy.pgBouncer.containers.pgbouncerConfig.resources.limits.memory }}
288+
{{- end }}
289+
{{- end }}
290+
{{- end }}
291+
{{- end }}
221292
{{- if .Values.proxy.pgBouncer.expose }}
222293
expose:
223294
type: {{ .Values.proxy.pgBouncer.expose.type }}
@@ -273,6 +344,10 @@ spec:
273344
operator: {{ .Values.proxy.pgBouncer.tolerations.operator }}
274345
value: {{ .Values.proxy.pgBouncer.tolerations.value }}
275346
{{- end }}
347+
{{- if .Values.proxy.pgBouncer.securityContext }}
348+
securityContext:
349+
{{ .Values.proxy.pgBouncer.securityContext | toYaml | indent 8 }}
350+
{{- end }}
276351

277352
pmm:
278353
enabled: {{ .Values.pmm.enabled }}
@@ -282,11 +357,36 @@ spec:
282357

283358
backups:
284359
pgbackrest:
285-
image: {{ include "pg-database.backup-image" . }}
360+
image: {{ .Values.backups.pgbackrest.image }}
286361
{{- if .Values.backups.pgbackrest.configuration }}
287362
configuration:
288363
{{ .Values.backups.pgbackrest.configuration | toYaml | indent 6 }}
289364
{{- end }}
365+
{{- if .Values.backups.pgbackrest.containers }}
366+
containers:
367+
{{- if .Values.backups.pgbackrest.containers.pgbackrest }}
368+
pgbackrest:
369+
{{- if .Values.backups.pgbackrest.containers.pgbackrest.resources }}
370+
resources:
371+
{{- if .Values.backups.pgbackrest.containers.pgbackrest.resources.limits }}
372+
limits:
373+
cpu: {{ .Values.backups.pgbackrest.containers.pgbackrest.resources.limits.cpu }}
374+
memory: {{ .Values.backups.pgbackrest.containers.pgbackrest.resources.limits.memory }}
375+
{{- end }}
376+
{{- end }}
377+
{{- end }}
378+
{{- if .Values.backups.pgbackrest.containers.pgbackrestConfig }}
379+
pgbackrestConfig:
380+
{{- if .Values.backups.pgbackrest.containers.pgbackrestConfig.resources }}
381+
resources:
382+
{{- if .Values.backups.pgbackrest.containers.pgbackrestConfig.resources.limits }}
383+
limits:
384+
cpu: {{ .Values.backups.pgbackrest.containers.pgbackrestConfig.resources.limits.cpu }}
385+
memory: {{ .Values.backups.pgbackrest.containers.pgbackrestConfig.resources.limits.memory }}
386+
{{- end }}
387+
{{- end }}
388+
{{- end }}
389+
{{- end }}
290390
{{- if .Values.backups.pgbackrest.jobs }}
291391
jobs:
292392
priorityClassName: {{ .Values.backups.pgbackrest.jobs.priorityClassName }}
@@ -301,6 +401,10 @@ spec:
301401
operator: {{ .Values.backups.pgbackrest.jobs.tolerations.operator }}
302402
value: {{ .Values.backups.pgbackrest.jobs.tolerations.value }}
303403
{{- end }}
404+
{{- if .Values.backups.pgbackrest.jobs.securityContext }}
405+
securityContext:
406+
{{ .Values.backups.pgbackrest.jobs.securityContext | toYaml | indent 10 }}
407+
{{- end }}
304408
{{- end }}
305409
{{- if .Values.backups.pgbackrest.global }}
306410
global:
@@ -324,6 +428,14 @@ spec:
324428
affinity:
325429
{{ .Values.backups.pgbackrest.repoHost.affinity | toYaml | indent 10 }}
326430
{{- end }}
431+
{{- if .Values.backups.pgbackrest.repoHost.tolerations }}
432+
tolerations:
433+
{{ .Values.backups.pgbackrest.repoHost.tolerations | toYaml | indent 10 }}
434+
{{- end }}
435+
{{- if .Values.backups.pgbackrest.repoHost.securityContext }}
436+
securityContext:
437+
{{ .Values.backups.pgbackrest.repoHost.securityContext | toYaml | indent 10 }}
438+
{{- end }}
327439
{{- end }}
328440
manual:
329441
repoName: repo1
@@ -371,9 +483,23 @@ spec:
371483
container: {{ $azure.container }}
372484
{{- end }}
373485
{{- end }}
486+
{{- if .Values.backups.pgbackrest.restore }}
487+
restore:
488+
repoName: {{ .Values.backups.pgbackrest.restore.repoName }}
489+
{{- if .Values.backups.pgbackrest.restore.tolerations }}
490+
tolerations:
491+
{{ .Values.backups.pgbackrest.restore.tolerations | toYaml | indent 10 }}
492+
{{- end }}
493+
{{- end }}
374494

375495
{{- if .Values.patroni }}
376496
patroni:
497+
{{- if .Values.patroni.syncPeriodSeconds }}
498+
syncPeriodSeconds: {{ .Values.patroni.syncPeriodSeconds }}
499+
{{- end }}
500+
{{- if .Values.patroni.leaderLeaseDurationSeconds }}
501+
leaderLeaseDurationSeconds: {{ .Values.patroni.leaderLeaseDurationSeconds }}
502+
{{- end }}
377503
dynamicConfiguration:
378504
postgresql:
379505
parameters:
@@ -403,6 +529,9 @@ spec:
403529
{{- if .Values.extensions.storage.region }}
404530
region: {{ .Values.extensions.storage.region }}
405531
{{- end }}
532+
{{- if .Values.extensions.storage.endpoint }}
533+
endpoint: {{ .Values.extensions.storage.endpoint }}
534+
{{- end }}
406535
{{- if .Values.extensions.storage.secret.name }}
407536
secret:
408537
name: {{ .Values.extensions.storage.secret.name }}

0 commit comments

Comments
 (0)