From 64a568e19c4056935c7ad647b1fbdc073d6e6195 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20No=C3=ABl?= <21990816+philippemnoel@users.noreply.github.com> Date: Mon, 2 Mar 2026 16:33:17 -0800 Subject: [PATCH] fix(chart): critical reliability and templating fixes (#180) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Philippe Noël --- .../cluster/templates/_barman_object_store.tpl | 6 ++++-- charts/cluster/templates/databases.yaml | 17 +++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/charts/cluster/templates/_barman_object_store.tpl b/charts/cluster/templates/_barman_object_store.tpl index b7b8981f30..4fdb368698 100644 --- a/charts/cluster/templates/_barman_object_store.tpl +++ b/charts/cluster/templates/_barman_object_store.tpl @@ -5,9 +5,11 @@ {{- end }} {{- if or (.scope.endpointCA.create) (.scope.endpointCA.name) }} + {{- $endpointCAName := coalesce .scope.endpointCA.name (printf "%s-ca-bundle" .chartFullname) }} + {{- $endpointCAKey := default "ca-bundle.crt" .scope.endpointCA.key }} endpointCA: - name: {{ .scope.endpointCA.name }} - key: {{ .scope.endpointCA.key }} + name: {{ $endpointCAName }} + key: {{ $endpointCAKey }} {{- end }} {{- if .scope.destinationPath }} diff --git a/charts/cluster/templates/databases.yaml b/charts/cluster/templates/databases.yaml index d701b7bed7..b65f2069b3 100644 --- a/charts/cluster/templates/databases.yaml +++ b/charts/cluster/templates/databases.yaml @@ -1,4 +1,5 @@ {{- range .Values.databases }} +{{- $dbOwner := default .name .owner }} --- apiVersion: postgresql.cnpg.io/v1 kind: Database @@ -19,18 +20,18 @@ spec: cluster: name: {{ include "cluster.fullname" $ }} ensure: {{ .ensure | default "present" }} - owner: {{ .owner }} + owner: {{ $dbOwner }} template: {{ .template | default "template1" }} encoding: {{ .encoding | default "UTF8" }} databaseReclaimPolicy: {{ .databaseReclaimPolicy | default "retain" }} - {{- with .isTemplate }} - isTemplate: {{ . }} + {{- if hasKey . "isTemplate" }} + isTemplate: {{ .isTemplate }} {{- end }} - {{- with .allowConnections }} - allowConnections: {{ . }} + {{- if hasKey . "allowConnections" }} + allowConnections: {{ .allowConnections }} {{- end }} - {{- with .connectionLimit }} - connectionLimit: {{ . }} + {{- if hasKey . "connectionLimit" }} + connectionLimit: {{ .connectionLimit }} {{- end }} {{- with .tablespace }} tablespace: {{ . }} @@ -63,7 +64,7 @@ spec: schemas: {{- range . }} - name: {{ .name }} - owner: {{ .owner }} + owner: {{ default $dbOwner .owner }} ensure: {{ .ensure | default "present" }} {{- end }} {{- end }}