Skip to content

Commit

Permalink
Merge pull request #342 from percona/K8SPG-597-pg-240
Browse files Browse the repository at this point in the history
K8SPG-597 - Update PG operator chart for 2.4.0 release
  • Loading branch information
jvpasinatto authored Jul 2, 2024
2 parents 44fac1d + 12b6e78 commit 151b188
Show file tree
Hide file tree
Showing 9 changed files with 27,603 additions and 15,753 deletions.
4 changes: 2 additions & 2 deletions charts/pg-db/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: pg-db
description: 'A Helm chart to deploy the PostgreSQL database with the Percona Operator for PostgreSQL'
type: application
version: 2.3.18
appVersion: 2.3.1
version: 2.4.0
appVersion: 2.4.0
home: https://docs.percona.com/percona-operator-for-postgresql/2.0/
maintainers:
- name: tplavcic
Expand Down
62 changes: 50 additions & 12 deletions charts/pg-db/README.md

Large diffs are not rendered by default.

24 changes: 0 additions & 24 deletions charts/pg-db/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,6 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{- define "pg-database.postgres-image" -}}
{{- if .Values.image }}
{{- .Values.image }}
{{- else }}
{{- printf "%s:%s-ppg%d-postgres" .Values.repository .Chart.AppVersion (.Values.postgresVersion | int ) }}
{{- end }}
{{- end -}}

{{- define "pg-database.backup-image" -}}
{{- if .Values.backups.pgbackrest.image }}
{{- .Values.backups.pgbackrest.image }}
{{- else }}
{{- printf "%s:%s-ppg%d-pgbackrest" .Values.repository .Chart.AppVersion (.Values.postgresVersion | int ) }}
{{- end }}
{{- end -}}

{{- define "pg-database.pgbouncer-image" -}}
{{- if .Values.proxy.pgBouncer.image }}
{{- .Values.proxy.pgBouncer.image }}
{{- else }}
{{- printf "%s:%s-ppg%d-pgbouncer" .Values.repository .Chart.AppVersion (.Values.postgresVersion | int )}}
{{- end }}
{{- end -}}

{{- define "pg-database.backup-repos" -}}
{{- if .Values.backups.pgbackrest.repos }}
repos:
Expand Down
135 changes: 132 additions & 3 deletions charts/pg-db/templates/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ metadata:
namespace: {{ .Release.Namespace }}
spec:
crVersion: {{ .Values.crVersion }}
image: {{ include "pg-database.postgres-image" . }}
image: {{ .Values.image }}
imagePullPolicy: Always
port: {{ default 5432 .Values.port }}
postgresVersion: {{ .Values.postgresVersion }}
Expand Down Expand Up @@ -78,6 +78,10 @@ spec:
{{- range $option := $postgresCluster.options }}
- {{ $option }}
{{- end }}
{{- if $postgresCluster.tolerations }}
tolerations:
{{ $postgresCluster.tolerations | toYaml | indent 8 }}
{{- end }}
{{- end }}
{{- if $pgbackrest := $dataSource.pgbackrest }}
pgbackrest:
Expand All @@ -89,6 +93,10 @@ spec:
options:
{{- range $option := $pgbackrest.options }}
- {{ $option }}
{{- end }}
{{- if $pgbackrest.tolerations }}
tolerations:
{{ $pgbackrest.tolerations | toYaml | indent 8 }}
{{- end }}
repo:
name: {{ $pgbackrest.repo.name }}
Expand All @@ -107,6 +115,21 @@ spec:
container: {{ $azure.container }}
{{- end }}
{{- end }}
{{- if $volumes := $dataSource.volumes }}
volumes:
{{- if $pgDataVolume := $volumes.pgDataVolume }}
pgDataVolume:
{{ $pgDataVolume | toYaml | indent 8 }}
{{- end }}
{{- if $pgWALVolume := $volumes.pgWALVolume }}
pgWALVolume:
{{ $pgWALVolume | toYaml | indent 8 }}
{{- end }}
{{- if $pgBackRestVolume := $volumes.pgBackRestVolume }}
pgBackRestVolume:
{{ $pgBackRestVolume | toYaml | indent 8 }}
{{- end }}
{{- end }}
{{- end }}

{{- if .Values.expose }}
Expand All @@ -125,6 +148,22 @@ spec:
{{ .Values.expose.loadBalancerSourceRanges | toYaml | indent 6 }}
{{- end }}
{{- end }}
{{- if .Values.exposeReplicas }}
exposeReplicas:
type: {{ .Values.exposeReplicas.type }}
{{- if .Values.exposeReplicas.annotations }}
annotations:
{{ .Values.exposeReplicas.annotations | toYaml | indent 6 }}
{{- end }}
{{- if .Values.exposeReplicas.labels }}
labels:
{{ .Values.exposeReplicas.labels | toYaml | indent 6 }}
{{- end }}
{{- if .Values.exposeReplicas.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{ .Values.exposeReplicas.loadBalancerSourceRanges | toYaml | indent 6 }}
{{- end }}
{{- end }}

instances:
{{- range $instance := .Values.instances }}
Expand All @@ -147,6 +186,20 @@ spec:
memory: {{ $instance.resources.limits.memory }}
{{- end }}
{{- end }}
{{- if $instance.containers }}
containers:
{{- if $instance.containers.replicaCertCopy }}
replicaCertCopy:
{{- if $instance.containers.replicaCertCopy.resources }}
resources:
{{- if $instance.containers.replicaCertCopy.resources.limits }}
limits:
cpu: {{ $instance.containers.replicaCertCopy.resources.limits.cpu }}
memory: {{ $instance.containers.replicaCertCopy.resources.limits.memory }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if $instance.sidecars }}
sidecars:
{{- range $sidecar := $instance.sidecars }}
Expand Down Expand Up @@ -177,6 +230,10 @@ spec:
{{- if $instance.priorityClassName }}
priorityClassName: {{ $instance.priorityClassName }}
{{- end }}
{{- if $instance.securityContext }}
securityContext:
{{ $instance.securityContext | toYaml | indent 8 }}
{{- end }}

{{- if $instance.walVolumeClaimSpec }}
walVolumeClaimSpec:
Expand All @@ -202,7 +259,7 @@ spec:

proxy:
pgBouncer:
image: {{ include "pg-database.pgbouncer-image" .}}
image: {{ .Values.proxy.pgBouncer.image }}
replicas: {{ .Values.proxy.pgBouncer.replicas}}
exposeSuperusers: {{ .Values.proxy.pgBouncer.exposeSuperusers | default true }}
{{- if .Values.proxy.pgBouncer.resources }}
Expand All @@ -218,6 +275,20 @@ spec:
memory: {{ .Values.proxy.pgBouncer.resources.limits.memory }}
{{- end }}
{{- end }}
{{- if .Values.proxy.pgBouncer.containers }}
containers:
{{- if .Values.proxy.pgBouncer.containers.pgbouncerConfig }}
pgbouncerConfig:
{{- if .Values.proxy.pgBouncer.containers.pgbouncerConfig.resources }}
resources:
{{- if .Values.proxy.pgBouncer.containers.pgbouncerConfig.resources.limits }}
limits:
cpu: {{ .Values.proxy.pgBouncer.containers.pgbouncerConfig.resources.limits.cpu }}
memory: {{ .Values.proxy.pgBouncer.containers.pgbouncerConfig.resources.limits.memory }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.proxy.pgBouncer.expose }}
expose:
type: {{ .Values.proxy.pgBouncer.expose.type }}
Expand Down Expand Up @@ -273,6 +344,10 @@ spec:
operator: {{ .Values.proxy.pgBouncer.tolerations.operator }}
value: {{ .Values.proxy.pgBouncer.tolerations.value }}
{{- end }}
{{- if .Values.proxy.pgBouncer.securityContext }}
securityContext:
{{ .Values.proxy.pgBouncer.securityContext | toYaml | indent 8 }}
{{- end }}

pmm:
enabled: {{ .Values.pmm.enabled }}
Expand All @@ -282,11 +357,36 @@ spec:

backups:
pgbackrest:
image: {{ include "pg-database.backup-image" . }}
image: {{ .Values.backups.pgbackrest.image }}
{{- if .Values.backups.pgbackrest.configuration }}
configuration:
{{ .Values.backups.pgbackrest.configuration | toYaml | indent 6 }}
{{- end }}
{{- if .Values.backups.pgbackrest.containers }}
containers:
{{- if .Values.backups.pgbackrest.containers.pgbackrest }}
pgbackrest:
{{- if .Values.backups.pgbackrest.containers.pgbackrest.resources }}
resources:
{{- if .Values.backups.pgbackrest.containers.pgbackrest.resources.limits }}
limits:
cpu: {{ .Values.backups.pgbackrest.containers.pgbackrest.resources.limits.cpu }}
memory: {{ .Values.backups.pgbackrest.containers.pgbackrest.resources.limits.memory }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.backups.pgbackrest.containers.pgbackrestConfig }}
pgbackrestConfig:
{{- if .Values.backups.pgbackrest.containers.pgbackrestConfig.resources }}
resources:
{{- if .Values.backups.pgbackrest.containers.pgbackrestConfig.resources.limits }}
limits:
cpu: {{ .Values.backups.pgbackrest.containers.pgbackrestConfig.resources.limits.cpu }}
memory: {{ .Values.backups.pgbackrest.containers.pgbackrestConfig.resources.limits.memory }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.backups.pgbackrest.jobs }}
jobs:
priorityClassName: {{ .Values.backups.pgbackrest.jobs.priorityClassName }}
Expand All @@ -301,6 +401,10 @@ spec:
operator: {{ .Values.backups.pgbackrest.jobs.tolerations.operator }}
value: {{ .Values.backups.pgbackrest.jobs.tolerations.value }}
{{- end }}
{{- if .Values.backups.pgbackrest.jobs.securityContext }}
securityContext:
{{ .Values.backups.pgbackrest.jobs.securityContext | toYaml | indent 10 }}
{{- end }}
{{- end }}
{{- if .Values.backups.pgbackrest.global }}
global:
Expand All @@ -324,6 +428,14 @@ spec:
affinity:
{{ .Values.backups.pgbackrest.repoHost.affinity | toYaml | indent 10 }}
{{- end }}
{{- if .Values.backups.pgbackrest.repoHost.tolerations }}
tolerations:
{{ .Values.backups.pgbackrest.repoHost.tolerations | toYaml | indent 10 }}
{{- end }}
{{- if .Values.backups.pgbackrest.repoHost.securityContext }}
securityContext:
{{ .Values.backups.pgbackrest.repoHost.securityContext | toYaml | indent 10 }}
{{- end }}
{{- end }}
manual:
repoName: repo1
Expand Down Expand Up @@ -371,9 +483,23 @@ spec:
container: {{ $azure.container }}
{{- end }}
{{- end }}
{{- if .Values.backups.pgbackrest.restore }}
restore:
repoName: {{ .Values.backups.pgbackrest.restore.repoName }}
{{- if .Values.backups.pgbackrest.restore.tolerations }}
tolerations:
{{ .Values.backups.pgbackrest.restore.tolerations | toYaml | indent 10 }}
{{- end }}
{{- end }}

{{- if .Values.patroni }}
patroni:
{{- if .Values.patroni.syncPeriodSeconds }}
syncPeriodSeconds: {{ .Values.patroni.syncPeriodSeconds }}
{{- end }}
{{- if .Values.patroni.leaderLeaseDurationSeconds }}
leaderLeaseDurationSeconds: {{ .Values.patroni.leaderLeaseDurationSeconds }}
{{- end }}
dynamicConfiguration:
postgresql:
parameters:
Expand Down Expand Up @@ -403,6 +529,9 @@ spec:
{{- if .Values.extensions.storage.region }}
region: {{ .Values.extensions.storage.region }}
{{- end }}
{{- if .Values.extensions.storage.endpoint }}
endpoint: {{ .Values.extensions.storage.endpoint }}
{{- end }}
{{- if .Values.extensions.storage.secret.name }}
secret:
name: {{ .Values.extensions.storage.secret.name }}
Expand Down
Loading

0 comments on commit 151b188

Please sign in to comment.