Skip to content

Commit d35d736

Browse files
committed
fix(chart): critical reliability and templating fixes (#180)
1 parent b1d64c2 commit d35d736

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

charts/cluster/prometheus_rules/cluster-logical_replication_stopped-critical.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ expr: |
1818
) or (
1919
# Subscription is enabled but stuck (no worker process with significant lag)
2020
label_replace(max by (namespace, job, subname) (cnpg_pg_stat_subscription_enabled), "cluster", "$1", "job", ".+/(.+)") == 1
21-
and label_replace(max by (namespace, job, subname) (cnpg_pg_stat_subscription_pid), "cluster", "$1", "job", ".+/(.+)") == ""
21+
and label_replace(max by (namespace, job, subname) (cnpg_pg_stat_subscription_pid), "cluster", "$1", "job", ".+/(.+)") <= 0
2222
and label_replace(max by (namespace, job, subname) (cnpg_pg_stat_subscription_buffered_lag_bytes), "cluster", "$1", "job", ".+/(.+)") / 1024^3 > 0.1
2323
)
2424
for: 15m

charts/cluster/prometheus_rules/cluster-logical_replication_stopped.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ expr: |
1717
) or (
1818
# Subscription is enabled but stuck (no worker process with significant lag)
1919
label_replace(max by (namespace, job, subname) (cnpg_pg_stat_subscription_enabled), "cluster", "$1", "job", ".+/(.+)") == 1
20-
and label_replace(max by (namespace, job, subname) (cnpg_pg_stat_subscription_pid), "cluster", "$1", "job", ".+/(.+)") == ""
20+
and label_replace(max by (namespace, job, subname) (cnpg_pg_stat_subscription_pid), "cluster", "$1", "job", ".+/(.+)") <= 0
2121
and label_replace(max by (namespace, job, subname) (cnpg_pg_stat_subscription_buffered_lag_bytes), "cluster", "$1", "job", ".+/(.+)") / 1024^3 > 0.1
2222
)
2323
for: 5m

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)