-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in 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 <[email protected]>
9cda7f8
to
b18764b
Compare
Please bump the chart version, thanks! |
Signed-off-by: Rachid Zarouali <[email protected]>
@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 <[email protected]>
Signed-off-by: Rachid Zarouali <[email protected]>
improvment thanks to community feedback, need some testing Signed-off-by: Rachid Zarouali <[email protected]>
Signed-off-by: Rachid Zarouali <[email protected]>
Signed-off-by: Tero Paloheimo <[email protected]>
Signed-off-by: Charles Korn <[email protected]>
Signed-off-by: Charles Korn <[email protected]>
Signed-off-by: Charles Korn <[email protected]>
Signed-off-by: Charles Korn <[email protected]>
Signed-off-by: Charles Korn <[email protected]>
Signed-off-by: Rachid Zarouali <[email protected]>
Signed-off-by: Rachid Zarouali <[email protected]>
6c00445
to
850d017
Compare
Signed-off-by: Rachid Zarouali <[email protected]>
@zanhsieh too many commits but signed and fix :) |
add improvment suggested Co-authored-by: Jan-Otto Kröpke <[email protected]> Signed-off-by: Rachid Zarouali <[email protected]>
{{/* | ||
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 :