From 87b771922735c38eaa7f0ac5482c649cf1827676 Mon Sep 17 00:00:00 2001 From: blaisemGH <81759796+blaisemGH@users.noreply.github.com> Date: Sat, 27 Sep 2025 03:40:07 +0200 Subject: [PATCH 1/2] Issue #668: templated clusterImageCatalogs Signed-off-by: blaisemGH <81759796+blaisemGH@users.noreply.github.com> --- .../cloudnative-pg/templates/ClusterImageCatalog.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 charts/cloudnative-pg/templates/ClusterImageCatalog.yaml diff --git a/charts/cloudnative-pg/templates/ClusterImageCatalog.yaml b/charts/cloudnative-pg/templates/ClusterImageCatalog.yaml new file mode 100644 index 0000000000..8a8d63b4fb --- /dev/null +++ b/charts/cloudnative-pg/templates/ClusterImageCatalog.yaml @@ -0,0 +1,11 @@ +{{- if .Values.clusterImageCatalog }} +{{- range $clusterCatalog := .Values.clusterImageCatalog }} +apiVersion: postgresql.cnpg.io/v1 +kind: ClusterImageCatalog +metadata: + name: {{ $clusterCatalog.name }} +spec: + images: {{ toYaml $clusterCatalog.images | nindent 4 }} +--- +{{- end }} +{{- end }} \ No newline at end of file From 0958507f4e7f44b853a8d9ff0c827b712b4602ae Mon Sep 17 00:00:00 2001 From: blaisemGH <81759796+blaisemGH@users.noreply.github.com> Date: Mon, 29 Sep 2025 11:54:05 +0200 Subject: [PATCH 2/2] #668 updated with requires function to support validation --- .../templates/ClusterImageCatalog.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/charts/cloudnative-pg/templates/ClusterImageCatalog.yaml b/charts/cloudnative-pg/templates/ClusterImageCatalog.yaml index 8a8d63b4fb..36848aa395 100644 --- a/charts/cloudnative-pg/templates/ClusterImageCatalog.yaml +++ b/charts/cloudnative-pg/templates/ClusterImageCatalog.yaml @@ -1,11 +1,13 @@ -{{- if .Values.clusterImageCatalog }} -{{- range $clusterCatalog := .Values.clusterImageCatalog }} +{{- range $clusterImageCatalog := .Values.clusterImageCatalogs }} apiVersion: postgresql.cnpg.io/v1 kind: ClusterImageCatalog metadata: - name: {{ $clusterCatalog.name }} + name: {{ required "Items in .Values.clusterImageCatalogs require key 'name'." $clusterImageCatalog.name }} spec: - images: {{ toYaml $clusterCatalog.images | nindent 4 }} + images: + {{- range $entry := required "Items in .Values.clusterImageCatalogs require key 'images' with a list of keys 'image' and 'major'." $clusterImageCatalog.images }} + - image: {{ required "Items in .Values.clusterImageCatalogs.images require key 'image'." $entry.image }} + major: {{ required "Items in .Values.clusterImageCatalogs.images require key 'major'." $entry.major }} + {{- end }} --- -{{- end }} {{- end }} \ No newline at end of file