Service Monitor: Reorder namespace selector.

This commit is contained in:
Marco Ebert 2024-10-29 22:22:11 +01:00 committed by k8s-infra-cherrypick-robot
parent 9b59df51ff
commit 516b037da2

View file

@ -18,6 +18,13 @@ metadata:
annotations: {{ toYaml .Values.controller.metrics.serviceMonitor.annotations | nindent 4 }} annotations: {{ toYaml .Values.controller.metrics.serviceMonitor.annotations | nindent 4 }}
{{- end }} {{- end }}
spec: 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: selector:
matchLabels: matchLabels:
{{- include "ingress-nginx.selectorLabels" . | nindent 6 }} {{- include "ingress-nginx.selectorLabels" . | nindent 6 }}
@ -37,13 +44,6 @@ spec:
{{- if .Values.controller.metrics.serviceMonitor.jobLabel }} {{- if .Values.controller.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.controller.metrics.serviceMonitor.jobLabel | quote }} jobLabel: {{ .Values.controller.metrics.serviceMonitor.jobLabel | quote }}
{{- end }} {{- 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 }} {{- if .Values.controller.metrics.serviceMonitor.targetLabels }}
targetLabels: {{ toYaml .Values.controller.metrics.serviceMonitor.targetLabels | nindent 2 }} targetLabels: {{ toYaml .Values.controller.metrics.serviceMonitor.targetLabels | nindent 2 }}
{{- end }} {{- end }}