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