aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/visualization/charts/grafana/templates/configmap.yaml
diff options
context:
space:
mode:
authorSrivahni <srivahni.chivukula@intel.com>2019-04-02 16:10:45 -0700
committerSrivahni Chivukula <srivahni.chivukula@intel.com>2019-04-29 18:03:32 +0000
commit5b1cd4ca88dd979c4b538c41db53031706e8d31b (patch)
tree2f582b1f08a018b8f76af0010c549e31cb049918 /vnfs/DAaaS/visualization/charts/grafana/templates/configmap.yaml
parented44393c10548b712a4c9c55f5d51c9e01554c2b (diff)
Visualization Helm charts package
Helm charts for Grafana Added Prometheus and M3DB as datasouces Change-Id: I60bebd0c8ef26f1dc3d91659c55c43f603dd0928 Issue-ID: ONAPARC-393 Signed-off-by: Srivahni <srivahni.chivukula@intel.com>
Diffstat (limited to 'vnfs/DAaaS/visualization/charts/grafana/templates/configmap.yaml')
-rwxr-xr-xvnfs/DAaaS/visualization/charts/grafana/templates/configmap.yaml71
1 files changed, 71 insertions, 0 deletions
diff --git a/vnfs/DAaaS/visualization/charts/grafana/templates/configmap.yaml b/vnfs/DAaaS/visualization/charts/grafana/templates/configmap.yaml
new file mode 100755
index 00000000..a2d05075
--- /dev/null
+++ b/vnfs/DAaaS/visualization/charts/grafana/templates/configmap.yaml
@@ -0,0 +1,71 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ template "grafana.fullname" . }}
+ labels:
+ app: {{ template "grafana.name" . }}
+ chart: {{ template "grafana.chart" . }}
+ release: {{ .Release.Name }}
+ heritage: {{ .Release.Service }}
+data:
+{{- if .Values.plugins }}
+ plugins: {{ join "," .Values.plugins }}
+{{- end }}
+ grafana.ini: |
+{{- range $key, $value := index .Values "grafana.ini" }}
+ [{{ $key }}]
+ {{- range $elem, $elemVal := $value }}
+ {{ $elem }} = {{ $elemVal }}
+ {{- end }}
+{{- end }}
+
+{{- if .Values.datasources }}
+{{ $root := . }}
+ {{- range $key, $value := .Values.datasources }}
+ {{ $key }}: |
+{{ tpl (toYaml $value | indent 4) $root }}
+ {{- end -}}
+{{- end -}}
+
+{{- if .Values.notifiers }}
+ {{- range $key, $value := .Values.notifiers }}
+ {{ $key }}: |
+{{ toYaml $value | indent 4 }}
+ {{- end -}}
+{{- end -}}
+
+{{- if .Values.dashboardProviders }}
+ {{- range $key, $value := .Values.dashboardProviders }}
+ {{ $key }}: |
+{{ toYaml $value | indent 4 }}
+ {{- end -}}
+{{- end -}}
+
+{{- if .Values.dashboards }}
+ download_dashboards.sh: |
+ #!/usr/bin/env sh
+ set -euf
+ {{- if .Values.dashboardProviders }}
+ {{- range $key, $value := .Values.dashboardProviders }}
+ {{- range $value.providers }}
+ mkdir -p {{ .options.path }}
+ {{- end }}
+ {{- end }}
+ {{- end }}
+
+ {{- range $provider, $dashboards := .Values.dashboards }}
+ {{- range $key, $value := $dashboards }}
+ {{- if (or (hasKey $value "gnetId") (hasKey $value "url")) }}
+ curl -sk \
+ --connect-timeout 60 \
+ --max-time 60 \
+ {{- if not $value.b64content }}
+ -H "Accept: application/json" \
+ -H "Content-Type: application/json;charset=UTF-8" \
+ {{- end }}
+ {{- 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 -}} \
+ > /var/lib/grafana/dashboards/{{ $provider }}/{{ $key }}.json
+ {{- end -}}
+ {{- end }}
+ {{- end }}
+{{- end }}