blob: b5fc642eb173cff0225d9d0f5b80c774aa01c614 [file] [log] [blame]
Giorgi Lekveishviliec6b3cc2023-12-01 16:30:04 +04001{{- if and .Values.deployment.enabled .Values.prometheus.monitor.enabled }}
2apiVersion: monitoring.coreos.com/v1
3kind: ServiceMonitor
4metadata:
5 name: {{ template "coredns.fullname" . }}
6 {{- if .Values.prometheus.monitor.namespace }}
7 namespace: {{ .Values.prometheus.monitor.namespace }}
8 {{- end }}
9 labels: {{- include "coredns.labels" . | nindent 4 }}
10 {{- if .Values.prometheus.monitor.additionalLabels }}
11{{ toYaml .Values.prometheus.monitor.additionalLabels | indent 4 }}
12 {{- end }}
13{{- with .Values.customAnnotations }}
14 annotations:
15{{- toYaml . | nindent 4 }}
16{{- end }}
17spec:
18 {{- if ne .Values.prometheus.monitor.namespace .Release.Namespace }}
19 namespaceSelector:
20 matchNames:
21 - {{ .Release.Namespace }}
22 {{- end }}
23 selector:
24 matchLabels:
25 app.kubernetes.io/instance: {{ .Release.Name | quote }}
26 {{- if .Values.isClusterService }}
27 k8s-app: {{ template "coredns.k8sapplabel" . }}
28 {{- end }}
29 app.kubernetes.io/name: {{ template "coredns.name" . }}
30 app.kubernetes.io/component: metrics
31 endpoints:
32 - port: metrics
33 {{- if .Values.prometheus.monitor.interval }}
34 interval: {{ .Values.prometheus.monitor.interval }}
35 {{- end }}
36{{- end }}