From 45905cd3e8d1199a472dbc72bf83d65e6ed44609 Mon Sep 17 00:00:00 2001 From: Pierre Bastianelli Date: Tue, 22 Jul 2025 11:41:40 -0700 Subject: [PATCH 1/2] feat: chart can now customize resources for pgbackrest --- helm/cas-postgres-cluster/Chart.yaml | 2 +- .../templates/PostgresCluster.yaml | 17 ++----------- helm/cas-postgres-cluster/values.yaml | 25 +++++++++++++------ 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/helm/cas-postgres-cluster/Chart.yaml b/helm/cas-postgres-cluster/Chart.yaml index 25ef626..791418a 100644 --- a/helm/cas-postgres-cluster/Chart.yaml +++ b/helm/cas-postgres-cluster/Chart.yaml @@ -7,7 +7,7 @@ description: |- type: application -version: 1.1.3 +version: 1.2.0 # Postgres Operator version for which this chart has been built. # It will very likely work for later versions, in which case the list of compatible images will change. diff --git a/helm/cas-postgres-cluster/templates/PostgresCluster.yaml b/helm/cas-postgres-cluster/templates/PostgresCluster.yaml index 90630ab..a63c64f 100644 --- a/helm/cas-postgres-cluster/templates/PostgresCluster.yaml +++ b/helm/cas-postgres-cluster/templates/PostgresCluster.yaml @@ -103,23 +103,10 @@ spec: incremental: "0 0,4,12,16,20 * * *" # this stuff is for the "pgbackrest" container (the only non-init container) in the "obps-postgres-repo-host" pod repoHost: - resources: - requests: - cpu: 50m - memory: 64Mi - limits: - cpu: 100m - memory: 128Mi + resources: {{ toYaml .Values.postgresCluster.repoHost.resources | nindent 10 }} sidecars: # this stuff is for the "pgbackrest" container in the "obps-postgres-pgha1" set of pods - pgbackrest: - resources: - requests: - cpu: 50m - memory: 64Mi - limits: - cpu: 100m - memory: 128Mi + pgbackrest: {{ toYaml .Values.postgresCluster.pgbackrest.resources | nindent 12 }} # allows the triggering of manual backups manual: repoName: repo1 diff --git a/helm/cas-postgres-cluster/values.yaml b/helm/cas-postgres-cluster/values.yaml index a7f3f02..0b0a17f 100644 --- a/helm/cas-postgres-cluster/values.yaml +++ b/helm/cas-postgres-cluster/values.yaml @@ -13,16 +13,27 @@ postgresCluster: memory: 256Mi postgres: - # image: artifacts.developer.gov.bc.ca/bcgov-docker-local/crunchy-postgres - # tag: ubi8-15.7-0 replicaCount: 2 - # pgbackrest: - # image: artifacts.developer.gov.bc.ca/bcgov-docker-local/crunchy-pgbackrest - # tag: ubi8-2.41-4 + pgbackrest: + # Resources for the pgbackrest sidecar container + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + cpu: 100m + memory: 128Mi pgbouncer: - # image: artifacts.developer.gov.bc.ca/bcgov-docker-local/crunchy-pgbouncer - # tag: ubi8-1.18-0 replicaCount: 2 + # Resources for the "obps-postgres-repo-host" pod + repoHost: + resources: + requests: + cpu: 50m + memory: 64Mi + limits: + cpu: 100m + memory: 128Mi # The "users" value(s) is passed to the crunchy postgres operator to create the database. # See https://access.crunchydata.com/documentation/postgres-operator/latest/tutorials/basic-setup/user-management From 9ed8fcab97b85dd0ac8b64635282149cf9caa8ae Mon Sep 17 00:00:00 2001 From: Pierre Bastianelli Date: Tue, 22 Jul 2025 13:32:52 -0700 Subject: [PATCH 2/2] chore: schema validation --- helm/cas-postgres-cluster/Chart.yaml | 2 +- .../templates/PostgresCluster.yaml | 3 ++- helm/cas-postgres-cluster/values.schema.json | 16 ++++++++++++++++ helm/cas-postgres-cluster/values.yaml | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 helm/cas-postgres-cluster/values.schema.json diff --git a/helm/cas-postgres-cluster/Chart.yaml b/helm/cas-postgres-cluster/Chart.yaml index 791418a..9df37b7 100644 --- a/helm/cas-postgres-cluster/Chart.yaml +++ b/helm/cas-postgres-cluster/Chart.yaml @@ -12,7 +12,7 @@ version: 1.2.0 # Postgres Operator version for which this chart has been built. # It will very likely work for later versions, in which case the list of compatible images will change. # For the full list of compatible postgres/pgbouncer/pgbackrest versions, see https://access.crunchydata.com/documentation/postgres-operator/latest/references/components -appVersion: "5.3.1" +appVersion: "5.7.0" dependencies: - name: terraform-bucket-provision diff --git a/helm/cas-postgres-cluster/templates/PostgresCluster.yaml b/helm/cas-postgres-cluster/templates/PostgresCluster.yaml index a63c64f..125a20f 100644 --- a/helm/cas-postgres-cluster/templates/PostgresCluster.yaml +++ b/helm/cas-postgres-cluster/templates/PostgresCluster.yaml @@ -106,7 +106,8 @@ spec: resources: {{ toYaml .Values.postgresCluster.repoHost.resources | nindent 10 }} sidecars: # this stuff is for the "pgbackrest" container in the "obps-postgres-pgha1" set of pods - pgbackrest: {{ toYaml .Values.postgresCluster.pgbackrest.resources | nindent 12 }} + pgbackrest: + resources: {{ toYaml .Values.postgresCluster.pgbackrest.resources | nindent 12 }} # allows the triggering of manual backups manual: repoName: repo1 diff --git a/helm/cas-postgres-cluster/values.schema.json b/helm/cas-postgres-cluster/values.schema.json new file mode 100644 index 0000000..2421135 --- /dev/null +++ b/helm/cas-postgres-cluster/values.schema.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "required": ["postgresCluster"], + "properties": { + "postgresCluster": { + "type": "object", + "required": ["postgresVersion"], + "properties": { + "postgresVersion": { + "type": "number", + "minimum": 17 + } + } + } + } +} diff --git a/helm/cas-postgres-cluster/values.yaml b/helm/cas-postgres-cluster/values.yaml index 0b0a17f..79ef772 100644 --- a/helm/cas-postgres-cluster/values.yaml +++ b/helm/cas-postgres-cluster/values.yaml @@ -2,7 +2,7 @@ environment: ~ postgresCluster: - postgresVersion: 14 + postgresVersion: 17 storageSize: 1Gi resources: requests: