From 2a7b4cbb2bc9b8c090322d9f0e0c656b82eb52e2 Mon Sep 17 00:00:00 2001 From: Rokibul Hasan Date: Thu, 30 May 2024 21:23:19 +0600 Subject: [PATCH 1/2] Handle `lookup` issue when Prometheus is not present in Rancher cluster Signed-off-by: Rokibul Hasan --- charts/opscenter-features/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/opscenter-features/templates/_helpers.tpl b/charts/opscenter-features/templates/_helpers.tpl index 111154581..13528140a 100644 --- a/charts/opscenter-features/templates/_helpers.tpl +++ b/charts/opscenter-features/templates/_helpers.tpl @@ -109,5 +109,5 @@ Image Templates {{- end }} {{- define "prometheus.mode" -}} -{{- ternary "federated" "standalone" (and (has "Rancher" .Values.clusterMetadata.clusterManagers) (not (empty (lookup "monitoring.coreos.com/v1" "Prometheus" "cattle-monitoring-system" "rancher-monitoring-prometheus")))) -}} +{{- ternary "federated" "standalone" (and (has "Rancher" .Values.clusterMetadata.clusterManagers) (not (and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") (lookup "monitoring.coreos.com/v1" "Prometheus" "cattle-monitoring-system" "rancher-monitoring-prometheus")))) -}} {{- end }} From 09a46fe76c07c4c101b310e90de6cb0767c3d26e Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Thu, 30 May 2024 23:39:07 +0600 Subject: [PATCH 2/2] Update check Signed-off-by: Tamal Saha --- charts/opscenter-features/templates/_helpers.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/opscenter-features/templates/_helpers.tpl b/charts/opscenter-features/templates/_helpers.tpl index 13528140a..12d7291d1 100644 --- a/charts/opscenter-features/templates/_helpers.tpl +++ b/charts/opscenter-features/templates/_helpers.tpl @@ -109,5 +109,5 @@ Image Templates {{- end }} {{- define "prometheus.mode" -}} -{{- ternary "federated" "standalone" (and (has "Rancher" .Values.clusterMetadata.clusterManagers) (not (and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") (lookup "monitoring.coreos.com/v1" "Prometheus" "cattle-monitoring-system" "rancher-monitoring-prometheus")))) -}} +{{- ternary "federated" "standalone" (and (has "Rancher" .Values.clusterMetadata.clusterManagers) (and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") (not (empty (lookup "monitoring.coreos.com/v1" "Prometheus" "cattle-monitoring-system" "rancher-monitoring-prometheus"))))) -}} {{- end }}