4 name: {{ template "grafana.fullname" . }}
6 app: {{ template "grafana.name" . }}
7 chart: {{ template "grafana.chart" . }}
8 release: {{ .Release.Name }}
9 heritage: {{ .Release.Service }}
11 {{- if .Values.plugins }}
12 plugins: {{ join "," .Values.plugins }}
15 {{- range $key, $value := index .Values "grafana.ini" }}
17 {{- range $elem, $elemVal := $value }}
18 {{ $elem }} = {{ $elemVal }}
22 {{- if .Values.datasources }}
24 {{- range $key, $value := .Values.datasources }}
26 {{ tpl (toYaml $value | indent 4) $root }}
30 {{- if .Values.notifiers }}
31 {{- range $key, $value := .Values.notifiers }}
33 {{ toYaml $value | indent 4 }}
37 {{- if .Values.dashboardProviders }}
38 {{- range $key, $value := .Values.dashboardProviders }}
40 {{ toYaml $value | indent 4 }}
44 {{- if .Values.dashboards }}
45 download_dashboards.sh: |
48 {{- if .Values.dashboardProviders }}
49 {{- range $key, $value := .Values.dashboardProviders }}
50 {{- range $value.providers }}
51 mkdir -p {{ .options.path }}
56 {{- range $provider, $dashboards := .Values.dashboards }}
57 {{- range $key, $value := $dashboards }}
58 {{- if (or (hasKey $value "gnetId") (hasKey $value "url")) }}
60 --connect-timeout 60 \
62 {{- if not $value.b64content }}
63 -H "Accept: application/json" \
64 -H "Content-Type: application/json;charset=UTF-8" \
66 {{- if $value.url -}}{{ $value.url }}{{- else -}} https://grafana.com/api/dashboards/{{ $value.gnetId }}/revisions/{{- if $value.revision -}}{{ $value.revision }}{{- else -}}1{{- end -}}/download{{- end -}}{{ if $value.datasource }}| sed 's|\"datasource\":[^,]*|\"datasource\": \"{{ $value.datasource }}\"|g'{{ end }}{{- if $value.b64content -}} | base64 -d {{- end -}} \
67 > /var/lib/grafana/dashboards/{{ $provider }}/{{ $key }}.json