mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
Only replace variable datasources in shared dashboards (#21710)
Avoid replacing hard-coded datasource entries in shared dashboards on downloading them. This is the root causes for #21541, where the following data source is also replace: ```json "annotations": { "list": [ { "builtIn": 1, "datasource": "-- Grafana --", "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "type": "dashboard" } ] }, ``` To avoid this situation, this commit adds the requirement that the datasource entry to replace starts with a dollar sign as the first character in the quoted string region. This was the case for all dashboards that I have checked. fixes #21541 Signed-off-by: Johannes Wienke <languitar@semipol.de>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
name: grafana
|
||||
version: 5.0.11
|
||||
version: 5.0.12
|
||||
appVersion: 6.7.1
|
||||
kubeVersion: "^1.8.0-0"
|
||||
description: The leading tool for querying and visualizing time series and metrics.
|
||||
|
||||
@@ -61,7 +61,7 @@ data:
|
||||
-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 -}} \
|
||||
{{- 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 }}
|
||||
|
||||
Reference in New Issue
Block a user