-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[grafana] Improve dashboards download script #3350
base: main
Are you sure you want to change the base?
[grafana] Improve dashboards download script #3350
Conversation
Signed-off-by: Rachid Zarouali <xinity@users.noreply.github.com>
9cda7f8
to
b18764b
Compare
Please bump the chart version, thanks! |
Signed-off-by: Rachid Zarouali <xinity@users.noreply.github.com>
@jkroepke oups, missed this, done :) |
charts/grafana/templates/_config.tpl
Outdated
@@ -81,7 +81,14 @@ download_dashboards.sh: | | |||
{{- range $provider, $dashboards := .Values.dashboards }} | |||
{{- range $key, $value := $dashboards }} | |||
{{- if (or (hasKey $value "gnetId") (hasKey $value "url")) }} | |||
curl -skf \ | |||
{{- if $value.url }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, if someone changes the URL logic below, this may get forgotten. Not sure, if it make sense to move the Source URL logic to a dedicated template helper.
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkroepke i assume that if the logic is changed then lines 120 and below will also be changed right ? :
{{- if $value.url }} |
not sure for now it worth it to move it into a helper template even though it would better in the future :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe @zanhsieh has an opinion here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
charts/grafana/templates/_config.tpl
Outdated
{{- if $value.url }} | ||
echo "Source Url: {{ $value.url }}" | ||
{{- else }} | ||
echo "Source Url: https://grafana.com/api/dashboards/{{ $value.gnetId }}/revisions/{{- if $value.revision -}}{{ $value.revision }}{{- else -}}1{{- end -}}/download" | ||
{{- end }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{- if $value.url }} | |
echo "Source Url: {{ $value.url }}" | |
{{- else }} | |
echo "Source Url: https://grafana.com/api/dashboards/{{ $value.gnetId }}/revisions/{{- if $value.revision -}}{{ $value.revision }}{{- else -}}1{{- end -}}/download" | |
{{- end }} | |
echo "Source Url: {{ include "grafana.url" . }} |
please fix CI failures and MR conflicts |
@jkroepke will squash to improve readability |
@xinity |
move the download message out of the if loop Signed-off-by: Rachid Zarouali <xinity@users.noreply.github.com>
Signed-off-by: Rachid Zarouali <xinity@users.noreply.github.com>
improvment thanks to community feedback, need some testing Signed-off-by: Rachid Zarouali <xinity@users.noreply.github.com>
Signed-off-by: Rachid Zarouali <xinity@users.noreply.github.com>
Signed-off-by: Tero Paloheimo <tero.paloheimo@iki.fi>
Signed-off-by: Charles Korn <charles.korn@grafana.com>
Signed-off-by: Charles Korn <charles.korn@grafana.com>
Signed-off-by: Charles Korn <charles.korn@grafana.com>
Signed-off-by: Charles Korn <charles.korn@grafana.com>
Signed-off-by: Charles Korn <charles.korn@grafana.com>
Signed-off-by: Rachid Zarouali <xinity@users.noreply.github.com>
Signed-off-by: Rachid Zarouali <xinity@users.noreply.github.com>
6c00445
to
850d017
Compare
Signed-off-by: Rachid Zarouali <xinity@users.noreply.github.com>
@zanhsieh too many commits but signed and fix :) |
add improvment suggested Co-authored-by: Jan-Otto Kröpke <github@jkroepke.de> Signed-off-by: Rachid Zarouali <xinity@users.noreply.github.com>
{{/* | ||
Define the source URL | ||
*/}} | ||
{{- define "grafana.url" -}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{- define "grafana.url" -}} | |
{{- define "grafana.dashboard-dowload-url" -}} |
@@ -81,7 +81,9 @@ download_dashboards.sh: | | |||
{{- range $provider, $dashboards := .Values.dashboards }} | |||
{{- range $key, $value := $dashboards }} | |||
{{- if (or (hasKey $value "gnetId") (hasKey $value "url")) }} | |||
curl -skf \ | |||
echo "downloading: {{ $key }} dashboard" | |||
echo "Source Url: {{ include "grafana.url" . }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "Source Url: {{ include "grafana.url" . }} | |
echo "Source URL: {{ include "grafana.dashboard-dowload-url" . }} |
@@ -224,6 +224,16 @@ Formats imagePullSecrets. Input is (dict "root" . "imagePullSecrets" .{specific | |||
{{- $secretFound}} | |||
{{- end -}} | |||
|
|||
|
|||
{{/* | |||
Define the source URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also add the template to the curl command!
This PR aims at improving the logging experience of the dowload dashboards script to :