Skip to content

Commit c3154e1

Browse files
fix(monitoring): guard against nil pointer in pooler PodMonitor template (#841)
* fix(monitoring): guard against nil pointer in pooler PodMonitor template When a pooler defines `monitoring.enabled: true` without a `podMonitor` sub-key, the template panics with a nil pointer error because Go templates evaluate all arguments to `and` before calling the function. Signed-off-by: Philippe Noël <philippemnoel@gmail.com> Signed-off-by: Itay Grudev <itay+github.com@grudev.com> Co-authored-by: Itay Grudev <itay@verito.digital> Co-authored-by: Itay Grudev <itay+github.com@grudev.com>
1 parent fbc5c54 commit c3154e1

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

charts/cluster/templates/podmonitor-pooler.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{{- range .Values.poolers }}
2+
{{- if .monitoring }}
3+
{{- if .monitoring.enabled }}
4+
{{- if .monitoring.podMonitor }}
5+
{{- if .monitoring.podMonitor.enabled }}
26
---
3-
{{- if and .monitoring .monitoring.enabled .monitoring.podMonitor.enabled }}
47
apiVersion: monitoring.coreos.com/v1
58
kind: PodMonitor
69
metadata:
@@ -35,3 +38,6 @@ spec:
3538
{{- end }}
3639
{{- end }}
3740
{{- end }}
41+
{{- end }}
42+
{{- end }}
43+
{{- end }}

0 commit comments

Comments
 (0)