From 71bd6baf61e1e124718c028d013a73c716383e68 Mon Sep 17 00:00:00 2001 From: WrenIX Date: Wed, 22 Nov 2023 22:29:30 +0100 Subject: [PATCH] fix: add namespaceSelector on serviceMonitor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Richard Boldiš Signed-off-by: WrenIX --- charts/nextcloud/templates/metrics/servicemonitor.yaml | 4 ++++ charts/nextcloud/values.yaml | 3 +++ 2 files changed, 7 insertions(+) diff --git a/charts/nextcloud/templates/metrics/servicemonitor.yaml b/charts/nextcloud/templates/metrics/servicemonitor.yaml index adc090a9..e3b440cd 100644 --- a/charts/nextcloud/templates/metrics/servicemonitor.yaml +++ b/charts/nextcloud/templates/metrics/servicemonitor.yaml @@ -26,8 +26,12 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/component: metrics namespaceSelector: + {{- with .Values.metrics.serviceMonitor.namespaceSelector }} + {{- toYaml . | nindent 4 }} + {{- else }} matchNames: - {{ .Release.Namespace | quote }} + {{- end }} endpoints: - port: metrics path: "/" diff --git a/charts/nextcloud/values.yaml b/charts/nextcloud/values.yaml index 0d2d9368..1baf1099 100644 --- a/charts/nextcloud/values.yaml +++ b/charts/nextcloud/values.yaml @@ -517,6 +517,9 @@ metrics: ## namespace: "" + ## @param metrics.serviceMonitor.namespaceSelector where service are to discoverd (default release namespace) + namespaceSelector: + ## @param metrics.serviceMonitor.jobLabel The name of the label on the target service to use as the job name in prometheus. ## jobLabel: ""