-
Notifications
You must be signed in to change notification settings - Fork 306
/
datasource.yaml
44 lines (44 loc) · 2.01 KB
/
datasource.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{{- if or (and .Values.grafana.enabled .Values.grafana.sidecar.datasources.enabled ) .Values.grafana.forceDeployDatasource }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ printf "%s-%s" (include "victoria-metrics-k8s-stack.fullname" $) "grafana-ds" | trunc 63 | trimSuffix "-" }}
namespace: {{ .Release.Namespace }}
{{- if .Values.grafana.sidecar.datasources.annotations }}
annotations:
{{ toYaml .Values.grafana.sidecar.datasources.annotations | indent 4 }}
{{- end }}
labels:
{{ $.Values.grafana.sidecar.datasources.label }}: "1"
app: {{ include "victoria-metrics-k8s-stack.name" $ }}-grafana
{{- include "victoria-metrics-k8s-stack.labels" . | nindent 4 }}
data:
{{- if or .Values.vmsingle.enabled .Values.vmcluster.enabled .Values.grafana.additionalDataSources }}
datasource.yaml: |-
apiVersion: 1
datasources:
{{- if or .Values.vmsingle.enabled .Values.vmcluster.enabled }}
- name: VictoriaMetrics
type: {{ default "prometheus" .Values.grafana.defaultDatasourceType }}
{{- $readEndpoint:= (include "victoria-metrics-k8s-stack.vmReadEndpoint" . | fromYaml) }}
url: {{ $readEndpoint.url }}
access: proxy
isDefault: true
jsonData: {{ toYaml .Values.grafana.sidecar.datasources.jsonData | nindent 8 }}
{{- end }}
{{- include "victoria-metrics-k8s-stack.VMDataSource" . }}
{{- if .Values.grafana.sidecar.datasources.createVMReplicasDatasources }}
{{- range until (int .Values.vmsingle.spec.replicaCount) }}
- name: VictoriaMetrics-{{ . }}
type: {{ default "prometheus" .Values.grafana.defaultDatasourceType }}
url: "http://{{ include "victoria-metrics-k8s-stack.vmsingleName" $ }}-{{ . }}.{{ $.Release.Namespace }}.svc:{{ $.Values.vmsingle.spec.port | default 8428 }}"
access: proxy
isDefault: false
jsonData: {{ toYaml .Values.grafana.sidecar.datasources.jsonData | nindent 8 }}
{{- end }}
{{- end }}
{{- if .Values.grafana.additionalDataSources }}
{{ tpl (toYaml .Values.grafana.additionalDataSources | indent 4) . }}
{{- end }}
{{- end }}
{{- end }}