From f45a503e110cace043648dc2ceccba9278062125 Mon Sep 17 00:00:00 2001 From: zhangpeng Date: Mon, 13 Nov 2023 15:18:56 +0800 Subject: [PATCH] Fix: check if the servicemonitor resource exists --- charts/rabbitmq/Chart.yaml | 2 +- charts/rabbitmq/templates/servicemonitor.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/rabbitmq/Chart.yaml b/charts/rabbitmq/Chart.yaml index d75ab79..1d57966 100644 --- a/charts/rabbitmq/Chart.yaml +++ b/charts/rabbitmq/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 1.0.2 +version: 1.0.3 # This is the version number of the application being deployed. This version number should be diff --git a/charts/rabbitmq/templates/servicemonitor.yaml b/charts/rabbitmq/templates/servicemonitor.yaml index d582faa..17d7d94 100644 --- a/charts/rabbitmq/templates/servicemonitor.yaml +++ b/charts/rabbitmq/templates/servicemonitor.yaml @@ -1,3 +1,4 @@ +{{if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" -}} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: @@ -48,3 +49,4 @@ spec: app.kubernetes.io/component: rabbitmq namespaceSelector: any: true +{{ end }} \ No newline at end of file