helm(rook-ceph-cluster): use nested if clauses in prometheusrule template

This change returns the use of nested if clauses
instead of `and` function shortcut to avoid errors
in older helm versions.

Signed-off-by: Artyom Babiy <artyom.babiy@gmail.com>
(cherry picked from commit 1f183bd675)
This commit is contained in:
Artyom Babiy authored and Mergify committed 2025-06-09 22:13:30 +00:00
1 parent df976c01e6
commit e89a7d7878
1 file changed
+7 -3
@@ -1,4 +1,5 @@
{{- if and .Values.monitoring .Values.monitoring.createPrometheusRules }}
{{- if .Values.monitoring }}
{{- if .Values.monitoring.createPrometheusRules }}
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
@@ -17,8 +18,10 @@ metadata:
namespace: {{ default .Release.Namespace .Values.monitoring.rulesNamespaceOverride }}
spec:
{{- $rulesFile := "prometheus/localrules.yaml" }}
{{- if and .Values.cephClusterSpec.external .Values.cephClusterSpec.external.enable }}
{{- $rulesFile = "prometheus/externalrules.yaml" }}
{{- if .Values.cephClusterSpec.external }}
{{- if .Values.cephClusterSpec.external.enable }}
{{- $rulesFile = "prometheus/externalrules.yaml" }}
{{- end }}
{{- end }}
{{- $defaultRules := .Files.Get $rulesFile | fromYaml }}
groups:
@@ -43,3 +46,4 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- end }}