2022-02-01 17:34:10 +00:00
|
|
|
{{- if and .Values.controller.metrics.enabled .Values.controller.metrics.serviceMonitor.enabled -}}
|
2020-02-24 19:25:57 +00:00
|
|
|
apiVersion: monitoring.coreos.com/v1
|
|
|
|
kind: ServiceMonitor
|
|
|
|
metadata:
|
2020-03-04 02:53:23 +00:00
|
|
|
name: {{ include "ingress-nginx.controller.fullname" . }}
|
2024-10-29 21:45:51 +00:00
|
|
|
{{- if .Values.controller.metrics.serviceMonitor.namespace }}
|
2023-11-01 21:59:56 +00:00
|
|
|
namespace: {{ .Values.controller.metrics.serviceMonitor.namespace }}
|
2024-10-29 21:45:51 +00:00
|
|
|
{{- else }}
|
2023-10-24 17:53:46 +00:00
|
|
|
namespace: {{ include "ingress-nginx.namespace" . }}
|
2024-10-29 21:45:51 +00:00
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
labels:
|
2020-02-28 14:53:24 +00:00
|
|
|
{{- include "ingress-nginx.labels" . | nindent 4 }}
|
2020-03-04 02:53:23 +00:00
|
|
|
app.kubernetes.io/component: controller
|
2024-10-29 21:45:51 +00:00
|
|
|
{{- if .Values.controller.metrics.serviceMonitor.additionalLabels }}
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- toYaml .Values.controller.metrics.serviceMonitor.additionalLabels | nindent 4 }}
|
2024-10-29 21:45:51 +00:00
|
|
|
{{- end }}
|
2023-12-20 22:08:50 +00:00
|
|
|
{{- if .Values.controller.metrics.serviceMonitor.annotations }}
|
|
|
|
annotations: {{ toYaml .Values.controller.metrics.serviceMonitor.annotations | nindent 4 }}
|
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
spec:
|
2024-10-29 21:45:51 +00:00
|
|
|
{{- 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 }}
|
|
|
|
app.kubernetes.io/component: controller
|
2020-02-24 19:25:57 +00:00
|
|
|
endpoints:
|
2024-10-29 21:45:51 +00:00
|
|
|
- port: {{ .Values.controller.metrics.portName }}
|
|
|
|
interval: {{ .Values.controller.metrics.serviceMonitor.scrapeInterval }}
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- if .Values.controller.metrics.serviceMonitor.honorLabels }}
|
2024-10-29 21:45:51 +00:00
|
|
|
honorLabels: true
|
2020-03-02 14:49:26 +00:00
|
|
|
{{- end }}
|
2021-12-06 13:50:32 +00:00
|
|
|
{{- if .Values.controller.metrics.serviceMonitor.relabelings }}
|
2024-10-29 21:45:51 +00:00
|
|
|
relabelings: {{ toYaml .Values.controller.metrics.serviceMonitor.relabelings | nindent 4 }}
|
2021-12-06 13:50:32 +00:00
|
|
|
{{- end }}
|
2020-08-19 02:25:57 +00:00
|
|
|
{{- if .Values.controller.metrics.serviceMonitor.metricRelabelings }}
|
2024-10-29 21:45:51 +00:00
|
|
|
metricRelabelings: {{ toYaml .Values.controller.metrics.serviceMonitor.metricRelabelings | nindent 4 }}
|
2020-08-19 02:25:57 +00:00
|
|
|
{{- end }}
|
2024-10-29 21:45:51 +00:00
|
|
|
{{- if .Values.controller.metrics.serviceMonitor.jobLabel }}
|
2021-03-10 09:51:55 +00:00
|
|
|
jobLabel: {{ .Values.controller.metrics.serviceMonitor.jobLabel | quote }}
|
2020-08-19 02:25:57 +00:00
|
|
|
{{- end }}
|
2024-10-29 21:45:51 +00:00
|
|
|
{{- if .Values.controller.metrics.serviceMonitor.targetLabels }}
|
|
|
|
targetLabels: {{ toYaml .Values.controller.metrics.serviceMonitor.targetLabels | nindent 2 }}
|
|
|
|
{{- end }}
|
2020-02-24 19:25:57 +00:00
|
|
|
{{- end }}
|