Add Prometheus Service Monitor

This commit is contained in:
Thomas Philipona 2023-10-14 11:44:56 +02:00
parent 905d5a2d09
commit faecd0aa8d
2 changed files with 21 additions and 0 deletions

View File

@ -0,0 +1,20 @@
{{- define "prometheus.servicemonitor" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/name: prometheus
user: {{ .Values.user }}
name: {{ .Values.user }}-prometheus-servicemonitor
spec:
endpoints:
- path: /metrics
port: web
namespaceSelector:
matchNames:
- {{ .Values.user }}-monitoring
selector:
matchLabels:
operated-prometheus: 'true'
{{- end }}

View File

@ -26,6 +26,7 @@
{{- if .Values.prometheus.enabled }} {{- if .Values.prometheus.enabled }}
{{- template "prometheus.ingress" . }} {{- template "prometheus.ingress" . }}
{{- template "prometheus.prometheus" . }} {{- template "prometheus.prometheus" . }}
{{- template "prometheus.servicemonitor" . }}
{{- template "prometheus.role" . }} {{- template "prometheus.role" . }}
{{- template "prometheus.rolebinding" . }} {{- template "prometheus.rolebinding" . }}
{{- template "prometheus.sa" . }} {{- template "prometheus.sa" . }}