Skip to content

Commit 64a568e

Browse files
committed
fix(chart): critical reliability and templating fixes (#180)
Signed-off-by: Philippe Noël <philippemnoel@gmail.com>
1 parent ee3aad8 commit 64a568e

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

charts/cluster/templates/_barman_object_store.tpl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
{{- end }}
66

77
{{- if or (.scope.endpointCA.create) (.scope.endpointCA.name) }}
8+
{{- $endpointCAName := coalesce .scope.endpointCA.name (printf "%s-ca-bundle" .chartFullname) }}
9+
{{- $endpointCAKey := default "ca-bundle.crt" .scope.endpointCA.key }}
810
endpointCA:
9-
name: {{ .scope.endpointCA.name }}
10-
key: {{ .scope.endpointCA.key }}
11+
name: {{ $endpointCAName }}
12+
key: {{ $endpointCAKey }}
1113
{{- end }}
1214

1315
{{- if .scope.destinationPath }}

charts/cluster/templates/databases.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- range .Values.databases }}
2+
{{- $dbOwner := default .name .owner }}
23
---
34
apiVersion: postgresql.cnpg.io/v1
45
kind: Database
@@ -19,18 +20,18 @@ spec:
1920
cluster:
2021
name: {{ include "cluster.fullname" $ }}
2122
ensure: {{ .ensure | default "present" }}
22-
owner: {{ .owner }}
23+
owner: {{ $dbOwner }}
2324
template: {{ .template | default "template1" }}
2425
encoding: {{ .encoding | default "UTF8" }}
2526
databaseReclaimPolicy: {{ .databaseReclaimPolicy | default "retain" }}
26-
{{- with .isTemplate }}
27-
isTemplate: {{ . }}
27+
{{- if hasKey . "isTemplate" }}
28+
isTemplate: {{ .isTemplate }}
2829
{{- end }}
29-
{{- with .allowConnections }}
30-
allowConnections: {{ . }}
30+
{{- if hasKey . "allowConnections" }}
31+
allowConnections: {{ .allowConnections }}
3132
{{- end }}
32-
{{- with .connectionLimit }}
33-
connectionLimit: {{ . }}
33+
{{- if hasKey . "connectionLimit" }}
34+
connectionLimit: {{ .connectionLimit }}
3435
{{- end }}
3536
{{- with .tablespace }}
3637
tablespace: {{ . }}
@@ -63,7 +64,7 @@ spec:
6364
schemas:
6465
{{- range . }}
6566
- name: {{ .name }}
66-
owner: {{ .owner }}
67+
owner: {{ default $dbOwner .owner }}
6768
ensure: {{ .ensure | default "present" }}
6869
{{- end }}
6970
{{- end }}

0 commit comments

Comments
 (0)