From 601c3b4a61cd02720ecafdebfd71a7c1a17cbb21 Mon Sep 17 00:00:00 2001 From: Ravi Singal Date: Fri, 27 Sep 2024 01:31:55 +0530 Subject: [PATCH] update prometheusrule and servicemonitor --- helm/templates/prometheusrules.yaml | 4 +++- helm/templates/servicemonitor.yaml | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/helm/templates/prometheusrules.yaml b/helm/templates/prometheusrules.yaml index 6f49016..fc665dc 100644 --- a/helm/templates/prometheusrules.yaml +++ b/helm/templates/prometheusrules.yaml @@ -1,4 +1,5 @@ -{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) ( .Values.prometheusrule.enabled ) }} +{{- if .Values.prometheusrule.enabled }} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }} apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: @@ -115,3 +116,4 @@ spec: summary: "All zookeeper containers in the Zookeeper pods down or in CrashLookBackOff status" message: "All zookeeper containers in the Zookeeper pods have been down or in CrashLookBackOff status for 3 minutes" {{- end }} +{{- end }} diff --git a/helm/templates/servicemonitor.yaml b/helm/templates/servicemonitor.yaml index 2c82cb4..bbfbff3 100644 --- a/helm/templates/servicemonitor.yaml +++ b/helm/templates/servicemonitor.yaml @@ -1,4 +1,6 @@ -{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) ( .Values.servicemonitor.enabled ) ( .Values.prometheus.jmx.enabled ) }} +{{- if .Values.servicemonitor.enabled }} +{{- if .Values.prometheus.jmx.enabled }} +{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }} --- apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor @@ -33,3 +35,5 @@ spec: matchNames: - {{ .Release.Namespace }} {{- end }} +{{- end }} +{{- end }}