From b180db53b5f561321bfbde98dd79c91901095d21 Mon Sep 17 00:00:00 2001 From: Dou Mok Date: Mon, 5 Jan 2026 13:28:27 -0800 Subject: [PATCH 1/6] Add new params 'cnpgImageOverrideEnabled' and 'cnpgImageSpec' to postgresql configuration in 'values.yaml' --- values.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/values.yaml b/values.yaml index 7cf4828..826d28d 100644 --- a/values.yaml +++ b/values.yaml @@ -154,6 +154,11 @@ init: ## @section Optional PostgreSQL Database Configuration Parameters ## postgresql: + cnpgImageOverideEnabled: false + ## @param postgresql.cnpgImageSpec Adjust this value to your desired postgres version + ## To see available versions, see: https://github.com/cloudnative-pg/postgres-containers/pkgs/container/postgresql + cnpgImageSpec: "" + ## @param postgresql.pg_hba Client authentication pg_hba.conf ## ref: https://cloudnative-pg.io/documentation/current/postgresql_conf/#the-pg_hba-section and ## https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html From 3a52fcb2970256fd09cd345ce185530b997317a0 Mon Sep 17 00:00:00 2001 From: Dou Mok Date: Mon, 5 Jan 2026 13:29:08 -0800 Subject: [PATCH 2/6] Update 'pg_cluster.yaml' template 'spec' section to add 'imageName' if 'cnpgImageOverride' is enabled --- templates/pg_cluster.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/pg_cluster.yaml b/templates/pg_cluster.yaml index eecd5fc..53c4a69 100644 --- a/templates/pg_cluster.yaml +++ b/templates/pg_cluster.yaml @@ -11,6 +11,9 @@ metadata: name: {{ .Release.Name }}-cnpg namespace: {{ .Release.Namespace }} spec: + {{- if .Values.postgresql.cnpgImageOverideEnabled }} + imageName: {{ .Values.postgresql.cnpgImageSpec }} + {{- end }} instances: {{ .Values.instances | default 3 }} {{- if .Values.init.enabled }} bootstrap: From 8282770a650727632a2fc2e8b1dbc8bd26db6672 Mon Sep 17 00:00:00 2001 From: Dou Mok Date: Mon, 5 Jan 2026 13:29:41 -0800 Subject: [PATCH 3/6] Fix typo in spec name from 'cnpgImageOverideEnabled' to 'cnpgImageOverrideEnabled' --- templates/pg_cluster.yaml | 2 +- values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/pg_cluster.yaml b/templates/pg_cluster.yaml index 53c4a69..dd96542 100644 --- a/templates/pg_cluster.yaml +++ b/templates/pg_cluster.yaml @@ -11,7 +11,7 @@ metadata: name: {{ .Release.Name }}-cnpg namespace: {{ .Release.Namespace }} spec: - {{- if .Values.postgresql.cnpgImageOverideEnabled }} + {{- if .Values.postgresql.cnpgImageOverrideEnabled }} imageName: {{ .Values.postgresql.cnpgImageSpec }} {{- end }} instances: {{ .Values.instances | default 3 }} diff --git a/values.yaml b/values.yaml index 826d28d..407a6c6 100644 --- a/values.yaml +++ b/values.yaml @@ -154,7 +154,7 @@ init: ## @section Optional PostgreSQL Database Configuration Parameters ## postgresql: - cnpgImageOverideEnabled: false + cnpgImageOverrideEnabled: false ## @param postgresql.cnpgImageSpec Adjust this value to your desired postgres version ## To see available versions, see: https://github.com/cloudnative-pg/postgres-containers/pkgs/container/postgresql cnpgImageSpec: "" From fe6dc43d7f7df66f098b6df49eeccfa74ef4eae4 Mon Sep 17 00:00:00 2001 From: Dou Mok Date: Tue, 6 Jan 2026 16:17:31 -0800 Subject: [PATCH 4/6] Add missing param comments to new 'postgresql' config item 'cnpgImageOverrideEnabled' and add example for 'cnpgImageSpec' --- values.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/values.yaml b/values.yaml index 407a6c6..95a5490 100644 --- a/values.yaml +++ b/values.yaml @@ -154,9 +154,11 @@ init: ## @section Optional PostgreSQL Database Configuration Parameters ## postgresql: + ## @param postgresql.cnpgImageOverrideEnabled Set to true to override cnpg default postgres image cnpgImageOverrideEnabled: false ## @param postgresql.cnpgImageSpec Adjust this value to your desired postgres version ## To see available versions, see: https://github.com/cloudnative-pg/postgres-containers/pkgs/container/postgresql + ## Example: ghcr.io/cloudnative-pg/postgresql:18 cnpgImageSpec: "" ## @param postgresql.pg_hba Client authentication pg_hba.conf From 6a3df0d13e68790edea4cca51f7e5a8558f06f66 Mon Sep 17 00:00:00 2001 From: Dou Mok Date: Wed, 7 Jan 2026 12:07:52 -0800 Subject: [PATCH 5/6] Refactor configuration options in 'values.yaml' for cnpg postgres image override from 'postgresql' section into new 'image' section --- templates/pg_cluster.yaml | 4 ++-- values.yaml | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/templates/pg_cluster.yaml b/templates/pg_cluster.yaml index dd96542..47d597c 100644 --- a/templates/pg_cluster.yaml +++ b/templates/pg_cluster.yaml @@ -11,8 +11,8 @@ metadata: name: {{ .Release.Name }}-cnpg namespace: {{ .Release.Namespace }} spec: - {{- if .Values.postgresql.cnpgImageOverrideEnabled }} - imageName: {{ .Values.postgresql.cnpgImageSpec }} + {{- if .Values.image.enabled }} + imageName: {{ .Values.image.postgresImageSpec }} {{- end }} instances: {{ .Values.instances | default 3 }} {{- if .Values.init.enabled }} diff --git a/values.yaml b/values.yaml index 95a5490..1c33b9b 100644 --- a/values.yaml +++ b/values.yaml @@ -11,6 +11,19 @@ ## $ helm install oci:////ghcr.io/dataoneorg/charts/cnpg --version \ ## -f +## @section Postgres Image Parameters +## Use this section to specify which postgres image the cnpg cluster should be deploying + +image: + ## @param postgresImageOverrideEnabled Set to true to override cnpg default postgres image + ## + enabled: false + ## @param postgresImageSpec Adjust this value to your desired postgres version + ## To see available versions, see: https://github.com/cloudnative-pg/postgres-containers/pkgs/container/postgresql + ## Example: ghcr.io/cloudnative-pg/postgresql:18 + ## + postgresImageSpec: "" + ## @section Cluster Configuration Parameters ## @param instances Number of PostgreSQL instances required in the PG cluster. @@ -154,13 +167,6 @@ init: ## @section Optional PostgreSQL Database Configuration Parameters ## postgresql: - ## @param postgresql.cnpgImageOverrideEnabled Set to true to override cnpg default postgres image - cnpgImageOverrideEnabled: false - ## @param postgresql.cnpgImageSpec Adjust this value to your desired postgres version - ## To see available versions, see: https://github.com/cloudnative-pg/postgres-containers/pkgs/container/postgresql - ## Example: ghcr.io/cloudnative-pg/postgresql:18 - cnpgImageSpec: "" - ## @param postgresql.pg_hba Client authentication pg_hba.conf ## ref: https://cloudnative-pg.io/documentation/current/postgresql_conf/#the-pg_hba-section and ## https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html From 0741f71850de03c4608a9c5a1770b3b503f0421a Mon Sep 17 00:00:00 2001 From: Dou Mok Date: Wed, 7 Jan 2026 12:20:23 -0800 Subject: [PATCH 6/6] Update 'README.md' with new section to describe postgres image override functionality --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index ac756f1..e5c66b1 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,15 @@ Alternatively, you can set `existingSecret` to the name of a Secret that you cre > [!CAUTION] > Make sure you have provided the correct credentials in the secret, along with `dbUser` and `dbName`, BEFORE you create the cluster. Changing these values, and doing a `helm upgrade` after the cluster has been created, will NOT update those values in the existing Postgres database! +## Postgres Image Version + +It is possible to specify a postgres version to deploy with cnpg. To do so, set `image.enabled` to `true`, and add/select your desired postgres to `image.postgresImageSpec`. Please see below for an example: + +```yaml +image: + enabled: true + postgresImageSpec: ghcr.io/cloudnative-pg/postgresql:18 +``` ## Scheduled Backup