From b18764bc45eeee3c4159bf47dc3912b6c4df40da Mon Sep 17 00:00:00 2001 From: Rachid Zarouali Date: Thu, 10 Oct 2024 07:21:02 +0000 Subject: [PATCH 01/15] Improve download script and remove -x parameter Signed-off-by: Rachid Zarouali --- charts/grafana/templates/_config.tpl | 9 ++++++++- charts/grafana/templates/_pod.tpl | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/charts/grafana/templates/_config.tpl b/charts/grafana/templates/_config.tpl index b866217f2e..4ec87294b6 100644 --- a/charts/grafana/templates/_config.tpl +++ b/charts/grafana/templates/_config.tpl @@ -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 }} + echo "downloading: {{ $key }} dashboard" + echo "Source Url: {{ $value.url }}" +{{- else }} + echo "downloading {{ $key }} dashboard" + echo "Source Url: https://grafana.com/api/dashboards/{{ $value.gnetId }}/revisions/{{- if $value.revision -}}{{ $value.revision }}{{- else -}}1{{- end -}}/download" +{{- end }} + curl -skf --show-error \ --connect-timeout 60 \ --max-time 60 \ {{- if not $value.b64content }} diff --git a/charts/grafana/templates/_pod.tpl b/charts/grafana/templates/_pod.tpl index 716e27d022..b5f368e055 100644 --- a/charts/grafana/templates/_pod.tpl +++ b/charts/grafana/templates/_pod.tpl @@ -66,7 +66,7 @@ initContainers: {{- end }} imagePullPolicy: {{ .Values.downloadDashboardsImage.pullPolicy }} command: ["/bin/sh"] - args: [ "-c", "mkdir -p /var/lib/grafana/dashboards/default && /bin/sh -x /etc/grafana/download_dashboards.sh" ] + args: [ "-c", "mkdir -p /var/lib/grafana/dashboards/default && /bin/sh /etc/grafana/download_dashboards.sh" ] {{- with .Values.downloadDashboards.resources }} resources: {{- toYaml . | nindent 6 }} From c30fe288c52dcedca27d1da3cbf9e3771bb52511 Mon Sep 17 00:00:00 2001 From: Rachid Zarouali Date: Thu, 10 Oct 2024 08:09:06 +0000 Subject: [PATCH 02/15] Chart version bump Signed-off-by: Rachid Zarouali --- charts/grafana/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/grafana/Chart.yaml b/charts/grafana/Chart.yaml index 58e6238907..f50100b802 100644 --- a/charts/grafana/Chart.yaml +++ b/charts/grafana/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: grafana -version: 8.5.2 +version: 8.5.3 appVersion: 11.2.1 kubeVersion: "^1.8.0-0" description: The leading tool for querying and visualizing time series and metrics. From 050e5c280622e59510fca3d85b78000f4c0328d2 Mon Sep 17 00:00:00 2001 From: Rachid Zarouali Date: Fri, 11 Oct 2024 14:24:50 +0200 Subject: [PATCH 03/15] Update _config.tpl move the download message out of the if loop Signed-off-by: Rachid Zarouali --- charts/grafana/templates/_config.tpl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/charts/grafana/templates/_config.tpl b/charts/grafana/templates/_config.tpl index 4ec87294b6..52c1b224a3 100644 --- a/charts/grafana/templates/_config.tpl +++ b/charts/grafana/templates/_config.tpl @@ -81,11 +81,10 @@ download_dashboards.sh: | {{- range $provider, $dashboards := .Values.dashboards }} {{- range $key, $value := $dashboards }} {{- if (or (hasKey $value "gnetId") (hasKey $value "url")) }} -{{- if $value.url }} echo "downloading: {{ $key }} dashboard" +{{- if $value.url }} echo "Source Url: {{ $value.url }}" {{- else }} - echo "downloading {{ $key }} dashboard" echo "Source Url: https://grafana.com/api/dashboards/{{ $value.gnetId }}/revisions/{{- if $value.revision -}}{{ $value.revision }}{{- else -}}1{{- end -}}/download" {{- end }} curl -skf --show-error \ From 1e21e066039ead309182029f3980f0570c234302 Mon Sep 17 00:00:00 2001 From: Rachid Zarouali Date: Fri, 11 Oct 2024 22:59:19 +0200 Subject: [PATCH 04/15] tentative moving $value.url to helper Signed-off-by: Rachid Zarouali --- charts/grafana/templates/_helpers.tpl | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/charts/grafana/templates/_helpers.tpl b/charts/grafana/templates/_helpers.tpl index 2a68cb6f85..6bac82dbdc 100644 --- a/charts/grafana/templates/_helpers.tpl +++ b/charts/grafana/templates/_helpers.tpl @@ -224,6 +224,18 @@ Formats imagePullSecrets. Input is (dict "root" . "imagePullSecrets" .{specific {{- $secretFound}} {{- end -}} + +{{/* +Define the source URL +*/}} +{{- define "grafana.url" -}} +{{- if $value.url }} + "{{ $value.url }}" \ +{{- else }} + "https://grafana.com/api/dashboards/{{ $value.gnetId }}/revisions/{{- if $value.revision -}}{{ $value.revision }}{{- else -}}1{{- end -}}/download" \ +{{- end }} +{{- end }} + {{/* Checks whether the user is attempting to store secrets in plaintext in the grafana.ini configmap From d5043b00fa5d19bcfec234a40bf96a73dddd9e00 Mon Sep 17 00:00:00 2001 From: Rachid Zarouali Date: Mon, 14 Oct 2024 09:15:51 +0200 Subject: [PATCH 05/15] Improve helper function improvment thanks to community feedback, need some testing Signed-off-by: Rachid Zarouali --- charts/grafana/templates/_helpers.tpl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/charts/grafana/templates/_helpers.tpl b/charts/grafana/templates/_helpers.tpl index 6bac82dbdc..2622f80e54 100644 --- a/charts/grafana/templates/_helpers.tpl +++ b/charts/grafana/templates/_helpers.tpl @@ -229,11 +229,9 @@ Formats imagePullSecrets. Input is (dict "root" . "imagePullSecrets" .{specific Define the source URL */}} {{- define "grafana.url" -}} -{{- if $value.url }} - "{{ $value.url }}" \ -{{- else }} - "https://grafana.com/api/dashboards/{{ $value.gnetId }}/revisions/{{- if $value.revision -}}{{ $value.revision }}{{- else -}}1{{- end -}}/download" \ -{{- end }} +{{- $this_revision := hasKey $value "revision" | ternary $value.revision 1 }} +{{- $this_url := hasKey $value "url" | ternary $value.url (printf "https://grafana.com/api/dashboards/%s/revisions/%s/download" $value.gnetId $this_revision) }} +{{- print $this_url }} {{- end }} {{/* From a9ce21ee4386eb2191a7ef04149db301fb8c3180 Mon Sep 17 00:00:00 2001 From: Rachid Zarouali Date: Mon, 14 Oct 2024 08:20:14 +0000 Subject: [PATCH 06/15] fix Chart versionning Signed-off-by: Rachid Zarouali --- charts/grafana/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/grafana/Chart.yaml b/charts/grafana/Chart.yaml index f50100b802..335a9f09bd 100644 --- a/charts/grafana/Chart.yaml +++ b/charts/grafana/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: grafana version: 8.5.3 -appVersion: 11.2.1 +appVersion: 11.2.3 kubeVersion: "^1.8.0-0" description: The leading tool for querying and visualizing time series and metrics. home: https://grafana.com From 116bfabd9406a4e2e9d8e105e86b4ce4cfc5658a Mon Sep 17 00:00:00 2001 From: Tero Paloheimo Date: Sun, 13 Oct 2024 12:33:20 +0300 Subject: [PATCH 07/15] Update Grafana to version 11.2.2 Signed-off-by: Tero Paloheimo --- charts/grafana/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/grafana/Chart.yaml b/charts/grafana/Chart.yaml index 335a9f09bd..683f463f3b 100644 --- a/charts/grafana/Chart.yaml +++ b/charts/grafana/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: grafana -version: 8.5.3 -appVersion: 11.2.3 +version: 8.5.6 +appVersion: 11.2.2 kubeVersion: "^1.8.0-0" description: The leading tool for querying and visualizing time series and metrics. home: https://grafana.com From 169ca4eee389adb8d825dd7f264b65d86fb08726 Mon Sep 17 00:00:00 2001 From: Charles Korn Date: Mon, 14 Oct 2024 10:16:18 +1100 Subject: [PATCH 08/15] Bump actions/checkout Signed-off-by: Charles Korn --- .github/workflows/check-codeowners.yaml | 2 +- .github/workflows/lint-test.yaml | 2 +- .github/workflows/linter.yml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/sync-readme.yaml | 4 ++-- .github/workflows/update-helm-repo.yaml | 6 +++--- .github/workflows/validate-pr.yaml | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check-codeowners.yaml b/.github/workflows/check-codeowners.yaml index f77c5224b5..051ec859f9 100644 --- a/.github/workflows/check-codeowners.yaml +++ b/.github/workflows/check-codeowners.yaml @@ -6,7 +6,7 @@ jobs: build: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: install yq run: | sudo snap install yq diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index f5d3528496..f09c2ada3c 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -35,7 +35,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index daa9d1246d..7534269626 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Check Docs run: | diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e46c9e748e..e99b2929e5 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/sync-readme.yaml b/.github/workflows/sync-readme.yaml index e51ecdc964..7937e66e44 100644 --- a/.github/workflows/sync-readme.yaml +++ b/.github/workflows/sync-readme.yaml @@ -12,10 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: | cp -f README.md ${{ runner.temp }}/README.md - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: ref: gh-pages - run: | diff --git a/.github/workflows/update-helm-repo.yaml b/.github/workflows/update-helm-repo.yaml index 5716b07eb5..a5001a73e9 100644 --- a/.github/workflows/update-helm-repo.yaml +++ b/.github/workflows/update-helm-repo.yaml @@ -50,7 +50,7 @@ jobs: chartpath: ${{ steps.list-changed.outputs.chartpath }} steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 path: source @@ -114,7 +114,7 @@ jobs: fi - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 path: source @@ -127,7 +127,7 @@ jobs: - name: Checkout helm-charts # The cr tool only works if the target repository is already checked out - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 repository: grafana/helm-charts diff --git a/.github/workflows/validate-pr.yaml b/.github/workflows/validate-pr.yaml index c23ec0153b..5510ed3fe1 100644 --- a/.github/workflows/validate-pr.yaml +++ b/.github/workflows/validate-pr.yaml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Code - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 From 6a03b1b4306ed9b060a444f80cd86a0dbe11cdaf Mon Sep 17 00:00:00 2001 From: Charles Korn Date: Mon, 14 Oct 2024 10:16:27 +1100 Subject: [PATCH 09/15] Bump actions/setup-python Signed-off-by: Charles Korn --- .github/workflows/lint-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index f09c2ada3c..3643e15721 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -47,7 +47,7 @@ jobs: # Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and # yamllint (https://github.com/adrienverge/yamllint) which require Python - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: 3.7 From 97da95fd5bd8156bc9609d3f8e00f8a08d5d69cd Mon Sep 17 00:00:00 2001 From: Charles Korn Date: Mon, 14 Oct 2024 10:17:47 +1100 Subject: [PATCH 10/15] Bump azure/setup-helm Signed-off-by: Charles Korn --- .github/workflows/lint-test.yaml | 2 +- .github/workflows/release.yaml | 2 +- .github/workflows/update-helm-repo.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 3643e15721..021e74607c 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -40,7 +40,7 @@ jobs: fetch-depth: 0 - name: Set up Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v4 with: version: ${{ inputs.helm_version }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index e99b2929e5..1f1f7466f4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,7 +25,7 @@ jobs: git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Set up Helm - uses: azure/setup-helm@v3.5 + uses: azure/setup-helm@v4 with: version: v3.12.0 diff --git a/.github/workflows/update-helm-repo.yaml b/.github/workflows/update-helm-repo.yaml index a5001a73e9..2ea76eecf8 100644 --- a/.github/workflows/update-helm-repo.yaml +++ b/.github/workflows/update-helm-repo.yaml @@ -141,7 +141,7 @@ jobs: git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Install Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v4 with: version: v3.5.2 From ad0fad14927f878c46bdfe5fd0d2f7e9b51aa39f Mon Sep 17 00:00:00 2001 From: Charles Korn Date: Mon, 14 Oct 2024 10:19:07 +1100 Subject: [PATCH 11/15] Remove use of deprecated `::set-output` Signed-off-by: Charles Korn --- .github/workflows/lint-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 021e74607c..2d9a568dd6 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -59,7 +59,7 @@ jobs: run: | changed=$(ct list-changed --config "${CT_CONFIGFILE}") if [[ -n "$changed" ]]; then - echo "::set-output name=changed::true" + echo "changed=true" >> "$GITHUB_OUTPUT" fi - name: Run chart-testing (lint) From 1dbea94bab7d947344a6f60469ae1f616caeafc6 Mon Sep 17 00:00:00 2001 From: Charles Korn Date: Mon, 14 Oct 2024 10:23:12 +1100 Subject: [PATCH 12/15] Bump Python version to one available in Ubuntu 24.04 runners Signed-off-by: Charles Korn --- .github/workflows/lint-test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 2d9a568dd6..b5134a83d4 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -49,7 +49,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.12 - name: Set up chart-testing uses: helm/chart-testing-action@v2.1.0 From 419c997027a5c6fdedfae8576538bba6a61b6a07 Mon Sep 17 00:00:00 2001 From: Rachid Zarouali Date: Tue, 15 Oct 2024 07:41:37 +0000 Subject: [PATCH 13/15] fix _config.tpl Signed-off-by: Rachid Zarouali --- charts/grafana/templates/_config.tpl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/charts/grafana/templates/_config.tpl b/charts/grafana/templates/_config.tpl index 52c1b224a3..27b077c705 100644 --- a/charts/grafana/templates/_config.tpl +++ b/charts/grafana/templates/_config.tpl @@ -82,11 +82,8 @@ download_dashboards.sh: | {{- range $key, $value := $dashboards }} {{- if (or (hasKey $value "gnetId") (hasKey $value "url")) }} echo "downloading: {{ $key }} dashboard" -{{- 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" . }} + curl -skf --show-error \ --connect-timeout 60 \ --max-time 60 \ From 850d017beaa24846b56e04c5aa673c5dc5b832bc Mon Sep 17 00:00:00 2001 From: Rachid Zarouali Date: Tue, 15 Oct 2024 07:52:01 +0000 Subject: [PATCH 14/15] fix typo in _config.tpl Signed-off-by: Rachid Zarouali --- charts/grafana/templates/_config.tpl | 1 - 1 file changed, 1 deletion(-) diff --git a/charts/grafana/templates/_config.tpl b/charts/grafana/templates/_config.tpl index 27b077c705..7dea726f67 100644 --- a/charts/grafana/templates/_config.tpl +++ b/charts/grafana/templates/_config.tpl @@ -83,7 +83,6 @@ download_dashboards.sh: | {{- if (or (hasKey $value "gnetId") (hasKey $value "url")) }} echo "downloading: {{ $key }} dashboard" echo "Source Url: {{ include "grafana.url" . }} - curl -skf --show-error \ --connect-timeout 60 \ --max-time 60 \ From 68fafde73d3c643899a77bf7e33c5871822613cb Mon Sep 17 00:00:00 2001 From: Rachid Zarouali Date: Tue, 15 Oct 2024 12:14:38 +0200 Subject: [PATCH 15/15] Update charts/grafana/templates/_helpers.tpl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add improvment suggested Co-authored-by: Jan-Otto Kröpke Signed-off-by: Rachid Zarouali --- charts/grafana/templates/_helpers.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/grafana/templates/_helpers.tpl b/charts/grafana/templates/_helpers.tpl index 2622f80e54..10249d8a44 100644 --- a/charts/grafana/templates/_helpers.tpl +++ b/charts/grafana/templates/_helpers.tpl @@ -229,8 +229,8 @@ Formats imagePullSecrets. Input is (dict "root" . "imagePullSecrets" .{specific Define the source URL */}} {{- define "grafana.url" -}} -{{- $this_revision := hasKey $value "revision" | ternary $value.revision 1 }} -{{- $this_url := hasKey $value "url" | ternary $value.url (printf "https://grafana.com/api/dashboards/%s/revisions/%s/download" $value.gnetId $this_revision) }} +{{- $this_revision := hasKey . "revision" | ternary .revision 1 }} +{{- $this_url := hasKey . "url" | ternary .url (printf "https://grafana.com/api/dashboards/%s/revisions/%s/download" .gnetId $this_revision) }} {{- print $this_url }} {{- end }}