ingress-nginx-helm/charts/ingress-nginx/templates/controller-servicemonitor.yaml

51 lines
2.3 KiB
YAML
Raw Normal View History

{{- 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:
name: {{ include "ingress-nginx.controller.fullname" . }}
2024-10-29 21:45:51 +00:00
{{- if .Values.controller.metrics.serviceMonitor.namespace }}
namespace: {{ .Values.controller.metrics.serviceMonitor.namespace }}
2024-10-29 21:45:51 +00:00
{{- else }}
namespace: {{ include "ingress-nginx.namespace" . }}
2024-10-29 21:45:51 +00:00
{{- end }}
2020-02-24 19:25:57 +00:00
labels:
{{- include "ingress-nginx.labels" . | nindent 4 }}
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 }}
{{- 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 }}
{{- if .Values.controller.metrics.serviceMonitor.relabelings }}
2024-10-29 21:45:51 +00:00
relabelings: {{ toYaml .Values.controller.metrics.serviceMonitor.relabelings | nindent 4 }}
{{- end }}
{{- if .Values.controller.metrics.serviceMonitor.metricRelabelings }}
2024-10-29 21:45:51 +00:00
metricRelabelings: {{ toYaml .Values.controller.metrics.serviceMonitor.metricRelabelings | nindent 4 }}
{{- end }}
2024-10-29 21:45:51 +00:00
{{- if .Values.controller.metrics.serviceMonitor.jobLabel }}
jobLabel: {{ .Values.controller.metrics.serviceMonitor.jobLabel | quote }}
{{- 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 }}