Skip to content

Commit a0ddacd

Browse files
committed
feat(postgres): add centralized ClusterImageCatalog with CNPG operator
Protect system PostgreSQL databases from automatic major version upgrades by introducing centralized ClusterImageCatalog resources based on official CNPG artifacts repository. Changes: - Add two ClusterImageCatalog resources (bookworm and trixie OS variants) - Based on CNPG official standard images with PostgreSQL 13-17 support - PostgreSQL 18 excluded to prevent auto-upgrades - Replace hardcoded imageName with imageCatalogRef in all system databases - Add Makefile target 'update-image-catalogs' for automated catalog updates System components using catalogs: - keycloak-db → postgresql-bookworm major 17 - harbor-db → postgresql-bookworm major 17 - grafana-db → postgresql-bookworm major 17 - alerta-db → postgresql-bookworm major 17 - seaweedfs-db → postgresql-bookworm major 17 Benefits: - Catalogs deploy with operator, always available before cluster changes - Standard images include additional extensions (pgaudit, etc.) - Support for both Debian bookworm and trixie - Automated updates via 'make update-image-catalogs' - Changes propagate through OCIRepo without manual migrations Signed-off-by: IvanHunters <[email protected]>
1 parent 73ec5a5 commit a0ddacd

8 files changed

Lines changed: 81 additions & 5 deletions

File tree

‎packages/system/harbor/templates/database.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ metadata:
55
name: {{ .Values.harbor.fullnameOverride }}-db
66
spec:
77
instances: {{ .Values.db.replicas }}
8-
imageName: ghcr.io/cloudnative-pg/postgresql:17.7
8+
imageCatalogRef:
9+
apiGroup: postgresql.cnpg.io
10+
kind: ClusterImageCatalog
11+
name: postgresql-bookworm
12+
major: 17
913
storage:
1014
size: {{ .Values.db.size }}
1115
{{- with .Values.db.storageClass }}

‎packages/system/keycloak/templates/db.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ metadata:
44
name: keycloak-db
55
spec:
66
instances: 2
7-
imageName: ghcr.io/cloudnative-pg/postgresql:17.7
7+
imageCatalogRef:
8+
apiGroup: postgresql.cnpg.io
9+
kind: ClusterImageCatalog
10+
name: postgresql-bookworm
11+
major: 17
812
storage:
913
size: 20Gi
1014
{{- if .Values._cluster.scheduling }}

‎packages/system/monitoring/templates/alerta/alerta-db.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ metadata:
55
name: alerta-db
66
spec:
77
instances: 2
8-
imageName: ghcr.io/cloudnative-pg/postgresql:17.7
8+
imageCatalogRef:
9+
apiGroup: postgresql.cnpg.io
10+
kind: ClusterImageCatalog
11+
name: postgresql-bookworm
12+
major: 17
913
{{- if .Values._cluster.scheduling }}
1014
{{- $rawConstraints := get .Values._cluster.scheduling "globalAppTopologySpreadConstraints" }}
1115
{{- if $rawConstraints }}

‎packages/system/monitoring/templates/grafana/db.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ metadata:
44
name: grafana-db
55
spec:
66
instances: 2
7-
imageName: ghcr.io/cloudnative-pg/postgresql:17.7
7+
imageCatalogRef:
8+
apiGroup: postgresql.cnpg.io
9+
kind: ClusterImageCatalog
10+
name: postgresql-bookworm
11+
major: 17
812
storage:
913
size: {{ .Values.grafana.db.size }}
1014
{{- if .Values._cluster.scheduling }}

‎packages/system/postgres-operator/Makefile‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,15 @@ update:
99
helm repo update cnpg
1010
helm pull cnpg/cloudnative-pg --untar --untardir charts --version 0.26.1
1111
rm -rf charts/cloudnative-pg/charts
12+
13+
update-image-catalogs:
14+
@echo "Downloading PostgreSQL image catalogs from CNPG artifacts..."
15+
@curl -sSL https://raw.githubusercontent.com/cloudnative-pg/artifacts/main/image-catalogs/catalog-standard-bookworm.yaml \
16+
| sed 's/postgresql-standard-bookworm/postgresql-bookworm/' \
17+
| awk '/major: 18/,/image:/ {next} {print}' \
18+
> templates/image-catalog-bookworm.yaml
19+
@curl -sSL https://raw.githubusercontent.com/cloudnative-pg/artifacts/main/image-catalogs/catalog-standard-trixie.yaml \
20+
| sed 's/postgresql-standard-trixie/postgresql-trixie/' \
21+
| awk '/major: 18/,/image:/ {next} {print}' \
22+
> templates/image-catalog-trixie.yaml
23+
@echo "Updated image catalogs (PostgreSQL 13-17, excluded v18)"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: postgresql.cnpg.io/v1
2+
kind: ClusterImageCatalog
3+
metadata:
4+
name: postgresql-bookworm
5+
labels:
6+
images.cnpg.io/family: postgresql
7+
images.cnpg.io/type: standard
8+
images.cnpg.io/os: bookworm
9+
images.cnpg.io/date: '20260406'
10+
images.cnpg.io/publisher: cnpg.io
11+
spec:
12+
images:
13+
- major: 13
14+
image: ghcr.io/cloudnative-pg/postgresql:13.22-202511100817-standard-bookworm@sha256:e65cbf9ba18d313acde4bcdc1bc8eb636b0e005f83f23b44aba3f957ecca1e66
15+
- major: 14
16+
image: ghcr.io/cloudnative-pg/postgresql:14.22-202604060836-standard-bookworm@sha256:520831b1115377aedf2370f565da88688b5df89f55478130be88e5dabc54d71b
17+
- major: 15
18+
image: ghcr.io/cloudnative-pg/postgresql:15.17-202604060834-standard-bookworm@sha256:147e208ec48768a5db6b008015a91d8c65859ab5201f96a3240b4b20d54a462b
19+
- major: 16
20+
image: ghcr.io/cloudnative-pg/postgresql:16.13-202604060836-standard-bookworm@sha256:ad1312a89f2c85f507647e6cb47401fc5265c17dd38b4d5bc511b1ce47e98989
21+
- major: 17
22+
image: ghcr.io/cloudnative-pg/postgresql:17.9-202604060836-standard-bookworm@sha256:22b5b918265328349d2e99e1d0bfe8851712b92a32739962b852b1428a33874a
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: postgresql.cnpg.io/v1
2+
kind: ClusterImageCatalog
3+
metadata:
4+
name: postgresql-trixie
5+
labels:
6+
images.cnpg.io/family: postgresql
7+
images.cnpg.io/type: standard
8+
images.cnpg.io/os: trixie
9+
images.cnpg.io/date: '20260406'
10+
images.cnpg.io/publisher: cnpg.io
11+
spec:
12+
images:
13+
- major: 13
14+
image: ghcr.io/cloudnative-pg/postgresql:13.22-202511100817-standard-trixie@sha256:8252529362b12a451a18cb19fdec9174ea09709102a7e6cf2e2b24d140dbd181
15+
- major: 14
16+
image: ghcr.io/cloudnative-pg/postgresql:14.22-202604060836-standard-trixie@sha256:8194f92a5da760127aa85b277bfaf71dfed59b22e0bf8f1f38d4893c8aebedd1
17+
- major: 15
18+
image: ghcr.io/cloudnative-pg/postgresql:15.17-202604060834-standard-trixie@sha256:021f860ac34f52689a966f4427d8bf48f89508aadf7fd60286ae9dbfe32f1f3a
19+
- major: 16
20+
image: ghcr.io/cloudnative-pg/postgresql:16.13-202604060836-standard-trixie@sha256:af4ccb6f3fad2ca86e53ea53264bd36d3de3facc208db936cf571bc5e264589c
21+
- major: 17
22+
image: ghcr.io/cloudnative-pg/postgresql:17.9-202604060836-standard-trixie@sha256:eba37bfc4b6cb1f1b3a869cab42ec1833519bbeb8cceacd1859b4faeca01fa4d

‎packages/system/seaweedfs/templates/database.yaml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ metadata:
55
name: seaweedfs-db
66
spec:
77
instances: {{ .Values.db.replicas }}
8-
imageName: ghcr.io/cloudnative-pg/postgresql:17.7
8+
imageCatalogRef:
9+
apiGroup: postgresql.cnpg.io
10+
kind: ClusterImageCatalog
11+
name: postgresql-bookworm
12+
major: 17
913
storage:
1014
size: {{ .Values.db.size }}
1115
{{- with .Values.db.storageClass }}

0 commit comments

Comments
 (0)