Add Grafana service monitor and simplify datasource

This commit is contained in:
Thomas Philipona 2023-10-14 13:00:47 +02:00
parent 628f64b1e8
commit 753c3dd95f
3 changed files with 25 additions and 1 deletions

View File

@ -16,7 +16,7 @@ stringData:
access: proxy access: proxy
editable: false editable: false
type: prometheus type: prometheus
url: http://thanos-query.{{ .Values.user }}-monitoring.svc.cluster.local:10902 url: http://thanos-query:10902
version: 1 version: 1
{{- if .Values.grafana.datasources }} {{- if .Values.grafana.datasources }}
{{- toYaml .Values.grafana.datasources | nindent 6 }} {{- toYaml .Values.grafana.datasources | nindent 6 }}

View File

@ -0,0 +1,23 @@
{{- define "grafana.servicemonitor" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: grafana-monitor
spec:
endpoints:
- basicAuth:
password:
name: basic-auth
key: {{ .Values.user }}
username:
name: basic-auth
key: grafana_user
interval: 60s
port: http
scheme: http
path: /metrics
selector:
matchLabels:
app.kubernetes.io/name: grafana
{{- end }}

View File

@ -19,6 +19,7 @@
{{- template "grafana.svc" . }} {{- template "grafana.svc" . }}
{{- template "grafana.sa" . }} {{- template "grafana.sa" . }}
{{- template "grafana.deploy" . }} {{- template "grafana.deploy" . }}
{{- template "grafana.servicemonitor" . }}
{{- template "grafana.ingress" . }} {{- template "grafana.ingress" . }}
{{- end }} {{- end }}