From 516b037da2402d2d1d543051ba04b8a7f2bd741f Mon Sep 17 00:00:00 2001 From: Marco Ebert Date: Tue, 29 Oct 2024 22:22:11 +0100 Subject: [PATCH] Service Monitor: Reorder namespace selector. --- .../templates/controller-servicemonitor.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/charts/ingress-nginx/templates/controller-servicemonitor.yaml b/charts/ingress-nginx/templates/controller-servicemonitor.yaml index 499bf93719..93ab4d242d 100644 --- a/charts/ingress-nginx/templates/controller-servicemonitor.yaml +++ b/charts/ingress-nginx/templates/controller-servicemonitor.yaml @@ -18,6 +18,13 @@ metadata: annotations: {{ toYaml .Values.controller.metrics.serviceMonitor.annotations | nindent 4 }} {{- end }} spec: + {{- if .Values.controller.metrics.serviceMonitor.namespaceSelector }} + namespaceSelector: {{ toYaml .Values.controller.metrics.serviceMonitor.namespaceSelector | nindent 4 }} + {{- else }} + namespaceSelector: + matchNames: + - {{ include "ingress-nginx.namespace" . }} + {{- end }} selector: matchLabels: {{- include "ingress-nginx.selectorLabels" . | nindent 6 }} @@ -37,13 +44,6 @@ spec: {{- if .Values.controller.metrics.serviceMonitor.jobLabel }} jobLabel: {{ .Values.controller.metrics.serviceMonitor.jobLabel | quote }} {{- end }} - {{- if .Values.controller.metrics.serviceMonitor.namespaceSelector }} - namespaceSelector: {{ toYaml .Values.controller.metrics.serviceMonitor.namespaceSelector | nindent 4 }} - {{- else }} - namespaceSelector: - matchNames: - - {{ include "ingress-nginx.namespace" . }} - {{- end }} {{- if .Values.controller.metrics.serviceMonitor.targetLabels }} targetLabels: {{ toYaml .Values.controller.metrics.serviceMonitor.targetLabels | nindent 2 }} {{- end }}