From de797ae863dcc1df27afc8eda24a2a564bebe644 Mon Sep 17 00:00:00 2001 From: "Nagel, Felix" Date: Thu, 26 Oct 2023 09:30:30 +0200 Subject: [PATCH 01/17] use old root to get namespace Signed-off-by: Nagel, Felix --- charts/tempo-distributed/templates/gateway/secret-gateway.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/tempo-distributed/templates/gateway/secret-gateway.yaml b/charts/tempo-distributed/templates/gateway/secret-gateway.yaml index 32c8341983..bfe70c5797 100644 --- a/charts/tempo-distributed/templates/gateway/secret-gateway.yaml +++ b/charts/tempo-distributed/templates/gateway/secret-gateway.yaml @@ -1,3 +1,4 @@ +{{- $root := . -}} {{- $dict := dict "ctx" . "component" "gateway" -}} {{- with .Values.gateway }} {{- if and .enabled .basicAuth.enabled (not .basicAuth.existingSecret) }} @@ -5,7 +6,7 @@ apiVersion: v1 kind: Secret metadata: name: {{ include "tempo.resourceName" $dict }} - namespace: {{ .Release.Namespace }} + namespace: {{ $root.Release.Namespace }} labels: {{- include "tempo.labels" $dict | nindent 4 }} stringData: From 80e3a9aecba16f087062b9aee6d34ec1293a9ac6 Mon Sep 17 00:00:00 2001 From: kaflake <8384990+kaflake@users.noreply.github.com> Date: Mon, 30 Oct 2023 07:00:02 +0100 Subject: [PATCH 02/17] Update charts/tempo-distributed/templates/gateway/secret-gateway.yaml Co-authored-by: MH Signed-off-by: Nagel, Felix --- charts/tempo-distributed/templates/gateway/secret-gateway.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tempo-distributed/templates/gateway/secret-gateway.yaml b/charts/tempo-distributed/templates/gateway/secret-gateway.yaml index bfe70c5797..ed25c43cb7 100644 --- a/charts/tempo-distributed/templates/gateway/secret-gateway.yaml +++ b/charts/tempo-distributed/templates/gateway/secret-gateway.yaml @@ -6,7 +6,7 @@ apiVersion: v1 kind: Secret metadata: name: {{ include "tempo.resourceName" $dict }} - namespace: {{ $root.Release.Namespace }} + namespace: {{ $root.Release.Namespace | quote }} labels: {{- include "tempo.labels" $dict | nindent 4 }} stringData: From 2b86ae9e7ad4fb68d4f307f866e4333935bcef64 Mon Sep 17 00:00:00 2001 From: "Nagel, Felix" Date: Mon, 30 Oct 2023 07:04:51 +0100 Subject: [PATCH 03/17] update tempo-distributed version Signed-off-by: Nagel, Felix --- charts/tempo-distributed/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tempo-distributed/Chart.yaml b/charts/tempo-distributed/Chart.yaml index cdba587c07..7709530728 100644 --- a/charts/tempo-distributed/Chart.yaml +++ b/charts/tempo-distributed/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: tempo-distributed description: Grafana Tempo in MicroService mode type: application -version: 1.7.0 +version: 1.7.1 appVersion: 2.3.0 engine: gotpl home: https://grafana.com/docs/tempo/latest/ From c0ff9eb6e1c7571d1337dd517155dc13f142f27d Mon Sep 17 00:00:00 2001 From: MH Date: Fri, 24 Nov 2023 23:37:30 +0800 Subject: [PATCH 04/17] Update README.md Signed-off-by: MH --- charts/tempo-distributed/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tempo-distributed/README.md b/charts/tempo-distributed/README.md index b368afae7c..26c484e3ba 100644 --- a/charts/tempo-distributed/README.md +++ b/charts/tempo-distributed/README.md @@ -1,6 +1,6 @@ # tempo-distributed -![Version: 1.7.0](https://img.shields.io/badge/Version-1.7.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.0](https://img.shields.io/badge/AppVersion-2.3.0-informational?style=flat-square) +![Version: 1.7.1](https://img.shields.io/badge/Version-1.7.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.0](https://img.shields.io/badge/AppVersion-2.3.0-informational?style=flat-square) Grafana Tempo in MicroService mode From e77c78926d6f54ab741174322b65e9e5f5b940ae Mon Sep 17 00:00:00 2001 From: MH Date: Wed, 29 Nov 2023 07:22:32 +0800 Subject: [PATCH 05/17] Update Chart.yaml Signed-off-by: MH --- charts/tempo-distributed/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tempo-distributed/Chart.yaml b/charts/tempo-distributed/Chart.yaml index 7709530728..723f8b7028 100644 --- a/charts/tempo-distributed/Chart.yaml +++ b/charts/tempo-distributed/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: tempo-distributed description: Grafana Tempo in MicroService mode type: application -version: 1.7.1 +version: 1.7.2 appVersion: 2.3.0 engine: gotpl home: https://grafana.com/docs/tempo/latest/ From 5d1fa6d1924f02b054f0ee65100c8e1548be82e3 Mon Sep 17 00:00:00 2001 From: MH Date: Wed, 29 Nov 2023 07:22:56 +0800 Subject: [PATCH 06/17] Update README.md Signed-off-by: MH --- charts/tempo-distributed/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tempo-distributed/README.md b/charts/tempo-distributed/README.md index cecbb14328..20ea32d48a 100644 --- a/charts/tempo-distributed/README.md +++ b/charts/tempo-distributed/README.md @@ -1,6 +1,6 @@ # tempo-distributed -![Version: 1.7.1](https://img.shields.io/badge/Version-1.7.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.0](https://img.shields.io/badge/AppVersion-2.3.0-informational?style=flat-square) +![Version: 1.7.2](https://img.shields.io/badge/Version-1.7.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.0](https://img.shields.io/badge/AppVersion-2.3.0-informational?style=flat-square) Grafana Tempo in MicroService mode From 52c2ceb2658567f0c7644d5fb40bd7658b2473e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Austerm=C3=BChle?= Date: Tue, 5 Dec 2023 22:20:20 +0100 Subject: [PATCH 07/17] Document extraVolumes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/grafana/helm-charts/commit/dbf7b82e21390d3a137d51898a1f1489f1eec8c2 and https://github.com/grafana/helm-charts/issues/2777 Signed-off-by: Stephan Austermühle --- charts/grafana/README.md | 24 ++++++++++++++++++------ charts/grafana/templates/_pod.tpl | 7 +++---- charts/grafana/values.yaml | 13 +++++++++---- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/charts/grafana/README.md b/charts/grafana/README.md index 5420545e51..77abbed147 100644 --- a/charts/grafana/README.md +++ b/charts/grafana/README.md @@ -48,7 +48,7 @@ This version requires Helm >= 3.1.0. ### To 7.0.0 -For consistency with other Helm charts, the `global.image.registry` parameter was renamed +For consistency with other Helm charts, the `global.image.registry` parameter was renamed to `global.imageRegistry`. If you were not previously setting `global.image.registry`, no action is required on upgrade. If you were previously setting `global.image.registry`, you will need to instead set `global.imageRegistry`. @@ -136,6 +136,7 @@ need to instead set `global.imageRegistry`. | `enableServiceLinks` | Inject Kubernetes services as environment variables. | `true` | | `extraSecretMounts` | Additional grafana server secret mounts | `[]` | | `extraVolumeMounts` | Additional grafana server volume mounts | `[]` | +| `extraVolumes` | Additional Grafana server volumes | `[]` | | `createConfigmap` | Enable creating the grafana configmap | `true` | | `extraConfigmapMounts` | Additional grafana server configMap volume mounts (values are templated) | `[]` | | `extraEmptyDirMounts` | Additional grafana server emptyDir volume mounts | `[]` | @@ -315,24 +316,35 @@ ingress: path: "/grafana" ``` -### Example of extraVolumeMounts +### Example of extraVolumeMounts and extraVolumes -Volume can be type persistentVolumeClaim or hostPath but not both at same time. -If neither existingClaim or hostPath argument is given then type is emptyDir. +Configure additional volumes with `extraVolumes` and volume mounts with `extraVolumeMounts`. + +Example for `extraVolumeMounts` and corresponding `extraVolumes`: ```yaml -- extraVolumeMounts: +extraVolumeMounts: - name: plugins mountPath: /var/lib/grafana/plugins subPath: configs/grafana/plugins - existingClaim: existing-grafana-claim readOnly: false - name: dashboards mountPath: /var/lib/grafana/dashboards hostPath: /usr/shared/grafana/dashboards readOnly: false + +extraVolumes: + - name: plugins + existingClaim: existing-grafana-claim + - name: dashboards + hostPath: /usr/shared/grafana/dashboards ``` +Volumes default to `emptyDir`. Set to `persistentVolumeClaim`, +`hostPath`, `csi`, or `configMap` for other types. For a +`persistentVolumeClaim`, specify an existing claim name with +`existingClaim`. + ## Import dashboards There are a few methods to import dashboards to Grafana. Below are some examples and explanations as to how to use each method: diff --git a/charts/grafana/templates/_pod.tpl b/charts/grafana/templates/_pod.tpl index f4b9fd36f1..ae9fd7d1d1 100644 --- a/charts/grafana/templates/_pod.tpl +++ b/charts/grafana/templates/_pod.tpl @@ -169,7 +169,7 @@ initContainers: mountPath: "/etc/grafana/provisioning/alerting" {{- with .Values.sidecar.alerts.extraMounts }} {{- toYaml . | trim | nindent 6 }} - {{- end }} + {{- end }} {{- end }} {{- if and .Values.sidecar.datasources.enabled .Values.sidecar.datasources.initDatasources }} - name: {{ include "grafana.name" . }}-init-sc-datasources @@ -411,7 +411,7 @@ containers: mountPath: "/etc/grafana/provisioning/alerting" {{- with .Values.sidecar.alerts.extraMounts }} {{- toYaml . | trim | nindent 6 }} - {{- end }} + {{- end }} {{- end}} {{- if .Values.sidecar.dashboards.enabled }} - name: {{ include "grafana.name" . }}-sc-dashboard @@ -1257,7 +1257,7 @@ volumes: {{ toYaml .hostPath | nindent 6 }} {{- else if .csi }} csi: - {{- toYaml .data | nindent 6 }} + {{- toYaml .csi | nindent 6 }} {{- else if .configMap }} configMap: {{- toYaml .configMap | nindent 6 }} @@ -1273,4 +1273,3 @@ volumes: {{- tpl (toYaml .) $root | nindent 2 }} {{- end }} {{- end }} - diff --git a/charts/grafana/values.yaml b/charts/grafana/values.yaml index 07502cc5ae..52638c0b0e 100644 --- a/charts/grafana/values.yaml +++ b/charts/grafana/values.yaml @@ -530,15 +530,20 @@ extraVolumeMounts: [] # - name: extra-volume-0 # mountPath: /mnt/volume0 # readOnly: true - # existingClaim: volume-claim # - name: extra-volume-1 # mountPath: /mnt/volume1 # readOnly: true - # hostPath: /usr/shared/ # - name: grafana-secrets # mountPath: /mnt/volume2 - # csi: true - # data: + +## Additional Grafana server volumes +extraVolumes: [] + # - name: extra-volume-0 + # existingClaim: volume-claim + # - name: extra-volume-1 + # hostPath: /usr/shared/ + # - name: grafana-secrets + # csi: # driver: secrets-store.csi.k8s.io # readOnly: true # volumeAttributes: From abea13cc477bbb9c582d4e68091eb87daf829dfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Austerm=C3=BChle?= Date: Wed, 6 Dec 2023 11:46:41 +0100 Subject: [PATCH 08/17] Bump grafana chart version to v7.0.14 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stephan Austermühle --- 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 387f2ab423..adf084f288 100644 --- a/charts/grafana/Chart.yaml +++ b/charts/grafana/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: grafana -version: 7.0.13 +version: 7.0.14 appVersion: 10.2.2 kubeVersion: "^1.8.0-0" description: The leading tool for querying and visualizing time series and metrics. From 8d3e3945eb3f5abaf9b5c6828a58ceba249040dd Mon Sep 17 00:00:00 2001 From: Davenury Date: Fri, 8 Dec 2023 07:05:53 +0100 Subject: [PATCH 09/17] add a comment about enabling metrics generator processors in helm chart Signed-off-by: Davenury --- charts/tempo-distributed/Chart.yaml | 2 +- charts/tempo-distributed/values.yaml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/charts/tempo-distributed/Chart.yaml b/charts/tempo-distributed/Chart.yaml index 7709530728..723f8b7028 100644 --- a/charts/tempo-distributed/Chart.yaml +++ b/charts/tempo-distributed/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: tempo-distributed description: Grafana Tempo in MicroService mode type: application -version: 1.7.1 +version: 1.7.2 appVersion: 2.3.0 engine: gotpl home: https://grafana.com/docs/tempo/latest/ diff --git a/charts/tempo-distributed/values.yaml b/charts/tempo-distributed/values.yaml index 7306f6dff7..b9fe43feb6 100644 --- a/charts/tempo-distributed/values.yaml +++ b/charts/tempo-distributed/values.yaml @@ -321,6 +321,7 @@ metricsGenerator: external_labels: {} stale_duration: 15m processor: + # -- For processors to be enabled and generate metrics, pass the names of the processors to overrides.metrics_generator_processors value like [service-graphs, span-metrics] service_graphs: # -- Additional dimensions to add to the metrics. Dimensions are searched for in the # -- resource and span attributes and are added to the metrics if present. @@ -1322,6 +1323,7 @@ storage: # Global overrides global_overrides: per_tenant_override_config: /runtime-config/overrides.yaml + # -- List of enabled metrics generator processors ([service-graphs, span-metrics]) metrics_generator_processors: [] # Per tenants overrides From f3749bde240db75fd8f9a9b0e433903aecd3a663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 9 Dec 2023 23:57:19 +0100 Subject: [PATCH 10/17] Optimize checksum calculation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- charts/grafana/Chart.yaml | 2 +- charts/grafana/templates/_config.tpl | 170 ++++++++++++++++++ .../configmap-dashboard-provider.yaml | 16 +- charts/grafana/templates/configmap.yaml | 131 +------------- charts/grafana/templates/deployment.yaml | 10 +- charts/grafana/templates/secret.yaml | 12 +- 6 files changed, 180 insertions(+), 161 deletions(-) create mode 100644 charts/grafana/templates/_config.tpl diff --git a/charts/grafana/Chart.yaml b/charts/grafana/Chart.yaml index 387f2ab423..adf084f288 100644 --- a/charts/grafana/Chart.yaml +++ b/charts/grafana/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: grafana -version: 7.0.13 +version: 7.0.14 appVersion: 10.2.2 kubeVersion: "^1.8.0-0" description: The leading tool for querying and visualizing time series and metrics. diff --git a/charts/grafana/templates/_config.tpl b/charts/grafana/templates/_config.tpl new file mode 100644 index 0000000000..face210934 --- /dev/null +++ b/charts/grafana/templates/_config.tpl @@ -0,0 +1,170 @@ +{{/* + Generate config map data + */}} +{{- define "grafana.configData" -}} +{{- $files := .Files }} +{{- $root := . -}} +{{- with .Values.plugins }} +plugins: {{ join "," . }} +{{- end }} +grafana.ini: | +{{- range $elem, $elemVal := index .Values "grafana.ini" }} + {{- if not (kindIs "map" $elemVal) }} + {{- if kindIs "invalid" $elemVal }} + {{ $elem }} = + {{- else if kindIs "string" $elemVal }} + {{ $elem }} = {{ tpl $elemVal $ }} + {{- else }} + {{ $elem }} = {{ $elemVal }} + {{- end }} + {{- end }} +{{- end }} +{{- range $key, $value := index .Values "grafana.ini" }} + {{- if kindIs "map" $value }} + [{{ $key }}] + {{- range $elem, $elemVal := $value }} + {{- if kindIs "invalid" $elemVal }} + {{ $elem }} = + {{- else if kindIs "string" $elemVal }} + {{ $elem }} = {{ tpl $elemVal $ }} + {{- else }} + {{ $elem }} = {{ $elemVal }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} + +{{- range $key, $value := .Values.datasources }} +{{- if not (hasKey $value "secret") }} +{{ $key }}: | + {{- tpl (toYaml $value | nindent 2) $root }} +{{- end }} +{{- end }} + +{{- range $key, $value := .Values.notifiers }} +{{- if not (hasKey $value "secret") }} +{{ $key }}: | + {{- toYaml $value | nindent 2 }} +{{- end }} +{{- end }} + +{{- range $key, $value := .Values.alerting }} +{{- if (hasKey $value "file") }} +{{ $key }}: +{{- toYaml ( $files.Get $value.file ) | nindent 2 }} +{{- else if (or (hasKey $value "secret") (hasKey $value "secretFile"))}} +{{/* will be stored inside secret generated by "configSecret.yaml"*/}} +{{- else }} +{{ $key }}: | + {{- tpl (toYaml $value | nindent 2) $root }} +{{- end }} +{{- end }} + +{{- range $key, $value := .Values.dashboardProviders }} +{{ $key }}: | + {{- toYaml $value | nindent 2 }} +{{- 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 }} +{{ $dashboardProviders := .Values.dashboardProviders }} +{{- range $provider, $dashboards := .Values.dashboards }} + {{- range $key, $value := $dashboards }} + {{- if (or (hasKey $value "gnetId") (hasKey $value "url")) }} + curl -skf \ + --connect-timeout 60 \ + --max-time 60 \ + {{- if not $value.b64content }} + {{- if not $value.acceptHeader }} + -H "Accept: application/json" \ + {{- else }} + -H "Accept: {{ $value.acceptHeader }}" \ + {{- end }} + {{- if $value.token }} + -H "Authorization: token {{ $value.token }}" \ + {{- end }} + {{- if $value.bearerToken }} + -H "Authorization: Bearer {{ $value.bearerToken }}" \ + {{- end }} + {{- if $value.basic }} + -H "Authorization: Basic {{ $value.basic }}" \ + {{- end }} + {{- if $value.gitlabToken }} + -H "PRIVATE-TOKEN: {{ $value.gitlabToken }}" \ + {{- end }} + -H "Content-Type: application/json;charset=UTF-8" \ + {{- end }} + {{- $dpPath := "" -}} + {{- range $kd := (index $dashboardProviders "dashboardproviders.yaml").providers }} + {{- if eq $kd.name $provider }} + {{- $dpPath = $kd.options.path }} + {{- end }} + {{- 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 }} + {{- if kindIs "string" $value.datasource }} + | sed '/-- .* --/! s/"datasource":.*,/"datasource": "{{ $value.datasource }}",/g' \ + {{- end }} + {{- if kindIs "slice" $value.datasource }} + {{- range $value.datasource }} + | sed '/-- .* --/! s/${{"{"}}{{ .name }}}/{{ .value }}/g' \ + {{- end }} + {{- end }} + {{- end }} + {{- if $value.b64content }} + | base64 -d \ + {{- end }} + > "{{- if $dpPath -}}{{ $dpPath }}{{- else -}}/var/lib/grafana/dashboards/{{ $provider }}{{- end -}}/{{ $key }}.json" + {{ end }} + {{- end }} +{{- end }} +{{- end }} +{{- end -}} + +{{/* + Generate dashboard json config map data + */}} +{{- define "grafana.configDashboardProviderData" -}} +provider.yaml: |- + apiVersion: 1 + providers: + - name: '{{ .Values.sidecar.dashboards.provider.name }}' + orgId: {{ .Values.sidecar.dashboards.provider.orgid }} + {{- if not .Values.sidecar.dashboards.provider.foldersFromFilesStructure }} + folder: '{{ .Values.sidecar.dashboards.provider.folder }}' + {{- end }} + type: {{ .Values.sidecar.dashboards.provider.type }} + disableDeletion: {{ .Values.sidecar.dashboards.provider.disableDelete }} + allowUiUpdates: {{ .Values.sidecar.dashboards.provider.allowUiUpdates }} + updateIntervalSeconds: {{ .Values.sidecar.dashboards.provider.updateIntervalSeconds | default 30 }} + options: + foldersFromFilesStructure: {{ .Values.sidecar.dashboards.provider.foldersFromFilesStructure }} + path: {{ .Values.sidecar.dashboards.folder }}{{- with .Values.sidecar.dashboards.defaultFolderName }}/{{ . }}{{- end }} +{{- end -}} + +{{- define "grafana.secretsData" -}} +{{- if and (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) (not .Values.admin.existingSecret) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD__FILE) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD) }} +admin-user: {{ .Values.adminUser | b64enc | quote }} +{{- if .Values.adminPassword }} +admin-password: {{ .Values.adminPassword | b64enc | quote }} +{{- else }} +admin-password: {{ include "grafana.password" . }} +{{- end }} +{{- end }} +{{- if not .Values.ldap.existingSecret }} +ldap-toml: {{ tpl .Values.ldap.config $ | b64enc | quote }} +{{- end }} +{{- end -}} diff --git a/charts/grafana/templates/configmap-dashboard-provider.yaml b/charts/grafana/templates/configmap-dashboard-provider.yaml index 1f706a8bbf..b412c4d1f0 100644 --- a/charts/grafana/templates/configmap-dashboard-provider.yaml +++ b/charts/grafana/templates/configmap-dashboard-provider.yaml @@ -11,19 +11,5 @@ metadata: name: {{ include "grafana.fullname" . }}-config-dashboards namespace: {{ include "grafana.namespace" . }} data: - provider.yaml: |- - apiVersion: 1 - providers: - - name: '{{ .Values.sidecar.dashboards.provider.name }}' - orgId: {{ .Values.sidecar.dashboards.provider.orgid }} - {{- if not .Values.sidecar.dashboards.provider.foldersFromFilesStructure }} - folder: '{{ .Values.sidecar.dashboards.provider.folder }}' - {{- end }} - type: {{ .Values.sidecar.dashboards.provider.type }} - disableDeletion: {{ .Values.sidecar.dashboards.provider.disableDelete }} - allowUiUpdates: {{ .Values.sidecar.dashboards.provider.allowUiUpdates }} - updateIntervalSeconds: {{ .Values.sidecar.dashboards.provider.updateIntervalSeconds | default 30 }} - options: - foldersFromFilesStructure: {{ .Values.sidecar.dashboards.provider.foldersFromFilesStructure }} - path: {{ .Values.sidecar.dashboards.folder }}{{- with .Values.sidecar.dashboards.defaultFolderName }}/{{ . }}{{- end }} + {{- include "grafana.configDashboardProviderData" . | nindent 2 }} {{- end }} diff --git a/charts/grafana/templates/configmap.yaml b/charts/grafana/templates/configmap.yaml index 7b837d90b1..7d7428be51 100644 --- a/charts/grafana/templates/configmap.yaml +++ b/charts/grafana/templates/configmap.yaml @@ -1,6 +1,4 @@ {{- if .Values.createConfigmap }} -{{- $files := .Files }} -{{- $root := . -}} apiVersion: v1 kind: ConfigMap metadata: @@ -13,132 +11,5 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} data: - {{- with .Values.plugins }} - plugins: {{ join "," . }} - {{- end }} - grafana.ini: | - {{- range $elem, $elemVal := index .Values "grafana.ini" }} - {{- if not (kindIs "map" $elemVal) }} - {{- if kindIs "invalid" $elemVal }} - {{ $elem }} = - {{- else if kindIs "string" $elemVal }} - {{ $elem }} = {{ tpl $elemVal $ }} - {{- else }} - {{ $elem }} = {{ $elemVal }} - {{- end }} - {{- end }} - {{- end }} - {{- range $key, $value := index .Values "grafana.ini" }} - {{- if kindIs "map" $value }} - [{{ $key }}] - {{- range $elem, $elemVal := $value }} - {{- if kindIs "invalid" $elemVal }} - {{ $elem }} = - {{- else if kindIs "string" $elemVal }} - {{ $elem }} = {{ tpl $elemVal $ }} - {{- else }} - {{ $elem }} = {{ $elemVal }} - {{- end }} - {{- end }} - {{- end }} - {{- end }} - - {{- range $key, $value := .Values.datasources }} - {{- if not (hasKey $value "secret") }} - {{- $key | nindent 2 }}: | - {{- tpl (toYaml $value | nindent 4) $root }} - {{- end }} - {{- end }} - - {{- range $key, $value := .Values.notifiers }} - {{- if not (hasKey $value "secret") }} - {{- $key | nindent 2 }}: | - {{- toYaml $value | nindent 4 }} - {{- end }} - {{- end }} - - {{- range $key, $value := .Values.alerting }} - {{- if (hasKey $value "file") }} - {{- $key | nindent 2 }}: - {{- toYaml ( $files.Get $value.file ) | nindent 4}} - {{- else if (or (hasKey $value "secret") (hasKey $value "secretFile"))}} - {{/* will be stored inside secret generated by "configSecret.yaml"*/}} - {{- else }} - {{- $key | nindent 2 }}: | - {{- tpl (toYaml $value | nindent 4) $root }} - {{- end }} - {{- end }} - - {{- range $key, $value := .Values.dashboardProviders }} - {{- $key | nindent 2 }}: | - {{- toYaml $value | nindent 4 }} - {{- 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 }} - {{ $dashboardProviders := .Values.dashboardProviders }} - {{- range $provider, $dashboards := .Values.dashboards }} - {{- range $key, $value := $dashboards }} - {{- if (or (hasKey $value "gnetId") (hasKey $value "url")) }} - curl -skf \ - --connect-timeout 60 \ - --max-time 60 \ - {{- if not $value.b64content }} - {{- if not $value.acceptHeader }} - -H "Accept: application/json" \ - {{- else }} - -H "Accept: {{ $value.acceptHeader }}" \ - {{- end }} - {{- if $value.token }} - -H "Authorization: token {{ $value.token }}" \ - {{- end }} - {{- if $value.bearerToken }} - -H "Authorization: Bearer {{ $value.bearerToken }}" \ - {{- end }} - {{- if $value.basic }} - -H "Authorization: Basic {{ $value.basic }}" \ - {{- end }} - {{- if $value.gitlabToken }} - -H "PRIVATE-TOKEN: {{ $value.gitlabToken }}" \ - {{- end }} - -H "Content-Type: application/json;charset=UTF-8" \ - {{- end }} - {{- $dpPath := "" -}} - {{- range $kd := (index $dashboardProviders "dashboardproviders.yaml").providers }} - {{- if eq $kd.name $provider }} - {{- $dpPath = $kd.options.path }} - {{- end }} - {{- 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 }} - {{- if kindIs "string" $value.datasource }} - | sed '/-- .* --/! s/"datasource":.*,/"datasource": "{{ $value.datasource }}",/g' \ - {{- end }} - {{- if kindIs "slice" $value.datasource }} - {{- range $value.datasource }} - | sed '/-- .* --/! s/${{"{"}}{{ .name }}}/{{ .value }}/g' \ - {{- end }} - {{- end }} - {{- end }} - {{- if $value.b64content }} - | base64 -d \ - {{- end }} - > "{{- if $dpPath -}}{{ $dpPath }}{{- else -}}/var/lib/grafana/dashboards/{{ $provider }}{{- end -}}/{{ $key }}.json" - {{ end }} - {{- end }} - {{- end }} -{{- end }} + {{- include "grafana.configData" . | nindent 2 }} {{- end }} diff --git a/charts/grafana/templates/deployment.yaml b/charts/grafana/templates/deployment.yaml index bfa26bb40e..46c016faa3 100644 --- a/charts/grafana/templates/deployment.yaml +++ b/charts/grafana/templates/deployment.yaml @@ -33,14 +33,16 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} annotations: - checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} + checksum/config: {{ include "grafana.configData" . | sha256sum }} + {{- if .Values.dashboards }} checksum/dashboards-json-config: {{ include (print $.Template.BasePath "/dashboards-json-configmap.yaml") . | sha256sum }} - checksum/sc-dashboard-provider-config: {{ include (print $.Template.BasePath "/configmap-dashboard-provider.yaml") . | sha256sum }} + {{- end }} + checksum/sc-dashboard-provider-config: {{ include "grafana.configDashboardProviderData" . | sha256sum }} {{- if and (or (and (not .Values.admin.existingSecret) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD__FILE) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD)) (and .Values.ldap.enabled (not .Values.ldap.existingSecret))) (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) }} - checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} + checksum/secret: {{ include "grafana.secretsData" . | sha256sum }} {{- end }} {{- if .Values.envRenderSecret }} - checksum/secret-env: {{ include (print $.Template.BasePath "/secret-env.yaml") . | sha256sum }} + checksum/secret-env: {{ tpl (toYaml .Values.envRenderSecret) . | sha256sum }} {{- end }} kubectl.kubernetes.io/default-container: {{ .Chart.Name }} {{- with .Values.podAnnotations }} diff --git a/charts/grafana/templates/secret.yaml b/charts/grafana/templates/secret.yaml index 5cbd527448..fd2ca50f4b 100644 --- a/charts/grafana/templates/secret.yaml +++ b/charts/grafana/templates/secret.yaml @@ -12,15 +12,5 @@ metadata: {{- end }} type: Opaque data: - {{- if and (not .Values.env.GF_SECURITY_DISABLE_INITIAL_ADMIN_CREATION) (not .Values.admin.existingSecret) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD__FILE) (not .Values.env.GF_SECURITY_ADMIN_PASSWORD) }} - admin-user: {{ .Values.adminUser | b64enc | quote }} - {{- if .Values.adminPassword }} - admin-password: {{ .Values.adminPassword | b64enc | quote }} - {{- else }} - admin-password: {{ include "grafana.password" . }} - {{- end }} - {{- end }} - {{- if not .Values.ldap.existingSecret }} - ldap-toml: {{ tpl .Values.ldap.config $ | b64enc | quote }} - {{- end }} + {{- include "grafana.secretsData" . | nindent 2 }} {{- end }} From 892c2d7d234cd4790a9bbb39590d204e4a781983 Mon Sep 17 00:00:00 2001 From: Wei Kin Huang Date: Sun, 10 Dec 2023 21:01:48 -0500 Subject: [PATCH 11/17] [grafana] Allow setting dns config for pod template Signed-off-by: Wei Kin Huang --- charts/grafana/templates/_pod.tpl | 11 +++++++++-- charts/grafana/values.yaml | 10 ++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/charts/grafana/templates/_pod.tpl b/charts/grafana/templates/_pod.tpl index f4b9fd36f1..1f11021c70 100644 --- a/charts/grafana/templates/_pod.tpl +++ b/charts/grafana/templates/_pod.tpl @@ -14,6 +14,13 @@ securityContext: hostAliases: {{- toYaml . | nindent 2 }} {{- end }} +{{- if .Values.dnsPolicy }} +dnsPolicy: {{ .Values.dnsPolicy }} +{{- end }} +{{- with .Values.dnsConfig }} +dnsConfig: + {{- toYaml . | nindent 2 }} +{{- end }} {{- with .Values.priorityClassName }} priorityClassName: {{ . }} {{- end }} @@ -169,7 +176,7 @@ initContainers: mountPath: "/etc/grafana/provisioning/alerting" {{- with .Values.sidecar.alerts.extraMounts }} {{- toYaml . | trim | nindent 6 }} - {{- end }} + {{- end }} {{- end }} {{- if and .Values.sidecar.datasources.enabled .Values.sidecar.datasources.initDatasources }} - name: {{ include "grafana.name" . }}-init-sc-datasources @@ -411,7 +418,7 @@ containers: mountPath: "/etc/grafana/provisioning/alerting" {{- with .Values.sidecar.alerts.extraMounts }} {{- toYaml . | trim | nindent 6 }} - {{- end }} + {{- end }} {{- end}} {{- if .Values.sidecar.dashboards.enabled }} - name: {{ include "grafana.name" . }}-sc-dashboard diff --git a/charts/grafana/values.yaml b/charts/grafana/values.yaml index 07502cc5ae..c675c7bd74 100644 --- a/charts/grafana/values.yaml +++ b/charts/grafana/values.yaml @@ -116,6 +116,16 @@ testFramework: imagePullPolicy: IfNotPresent securityContext: {} +# dns configuration for pod +dnsPolicy: ~ +dnsConfig: {} + # nameservers: + # - 8.8.8.8 + # options: + # - name: ndots + # value: "2" + # - name: edns0 + securityContext: runAsNonRoot: true runAsUser: 472 From a59e7c654c4c73c70fe561ddec61f53b37e65905 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20Austerm=C3=BChle?= Date: Mon, 11 Dec 2023 15:38:27 +0100 Subject: [PATCH 12/17] Bump grafana chart version to v7.0.15 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stephan Austermühle --- 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 adf084f288..c993496cf7 100644 --- a/charts/grafana/Chart.yaml +++ b/charts/grafana/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: grafana -version: 7.0.14 +version: 7.0.15 appVersion: 10.2.2 kubeVersion: "^1.8.0-0" description: The leading tool for querying and visualizing time series and metrics. From 357f763ed2bc687ad6cd4fc414459677172b8789 Mon Sep 17 00:00:00 2001 From: MH Date: Tue, 12 Dec 2023 21:49:19 +0800 Subject: [PATCH 13/17] Update Chart.yaml Signed-off-by: MH --- 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 adf084f288..c993496cf7 100644 --- a/charts/grafana/Chart.yaml +++ b/charts/grafana/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: grafana -version: 7.0.14 +version: 7.0.15 appVersion: 10.2.2 kubeVersion: "^1.8.0-0" description: The leading tool for querying and visualizing time series and metrics. From a2c8a150ff05d778376323fa98bb25f330ed12ff Mon Sep 17 00:00:00 2001 From: Davenury Date: Tue, 12 Dec 2023 18:09:52 +0100 Subject: [PATCH 14/17] generate docs; lint Signed-off-by: Davenury --- charts/tempo-distributed/README.md | 5 +++-- charts/tempo-distributed/values.yaml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/charts/tempo-distributed/README.md b/charts/tempo-distributed/README.md index cecbb14328..1e2b4c661d 100644 --- a/charts/tempo-distributed/README.md +++ b/charts/tempo-distributed/README.md @@ -1,6 +1,6 @@ # tempo-distributed -![Version: 1.7.1](https://img.shields.io/badge/Version-1.7.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.0](https://img.shields.io/badge/AppVersion-2.3.0-informational?style=flat-square) +![Version: 1.7.2](https://img.shields.io/badge/Version-1.7.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.0](https://img.shields.io/badge/AppVersion-2.3.0-informational?style=flat-square) Grafana Tempo in MicroService mode @@ -451,7 +451,7 @@ The memcached default args are removed and should be provided manually. The sett | global.image.pullSecrets | list | `[]` | Optional list of imagePullSecrets for all images, excluding enterprise. Names of existing secrets with private container registry credentials. Ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod Example: pullSecrets: [ my-dockerconfigjson-secret ] | | global.image.registry | string | `"docker.io"` | Overrides the Docker registry globally for all images, excluding enterprise. | | global.priorityClassName | string | `nil` | Overrides the priorityClassName for all pods | -| global_overrides.metrics_generator_processors | list | `[]` | | +| global_overrides.metrics_generator_processors | list | `[]` | List of enabled metrics generator processors ([service-graphs, span-metrics]) | | global_overrides.per_tenant_override_config | string | `"/runtime-config/overrides.yaml"` | | | ingester.affinity | string | Soft node and soft zone anti-affinity | Affinity for ingester pods. Passed through `tpl` and, thus, to be configured as string | | ingester.annotations | object | `{}` | Annotations for the ingester StatefulSet | @@ -561,6 +561,7 @@ The memcached default args are removed and should be provided manually. The sett | metricsGenerator.appProtocol | object | `{"grpc":null}` | Adds the appProtocol field to the metricsGenerator service. This allows metricsGenerator to work with istio protocol selection. | | metricsGenerator.appProtocol.grpc | string | `nil` | Set the optional grpc service protocol. Ex: "grpc", "http2" or "https" | | metricsGenerator.config | object | `{"metrics_ingestion_time_range_slack":"30s","processor":{"service_graphs":{"dimensions":[],"histogram_buckets":[0.1,0.2,0.4,0.8,1.6,3.2,6.4,12.8],"max_items":10000,"wait":"10s","workers":10},"span_metrics":{"dimensions":[],"histogram_buckets":[0.002,0.004,0.008,0.016,0.032,0.064,0.128,0.256,0.512,1.02,2.05,4.1]}},"registry":{"collection_interval":"15s","external_labels":{},"stale_duration":"15m"},"storage":{"path":"/var/tempo/wal","remote_write":[],"remote_write_flush_deadline":"1m","wal":null}}` | More information on configuration: https://grafana.com/docs/tempo/latest/configuration/#metrics-generator | +| metricsGenerator.config.processor.service_graphs | object | `{"dimensions":[],"histogram_buckets":[0.1,0.2,0.4,0.8,1.6,3.2,6.4,12.8],"max_items":10000,"wait":"10s","workers":10}` | For processors to be enabled and generate metrics, pass the names of the processors to overrides.metrics_generator_processors value like [service-graphs, span-metrics] | | metricsGenerator.config.processor.service_graphs.dimensions | list | `[]` | resource and span attributes and are added to the metrics if present. | | metricsGenerator.config.processor.span_metrics.dimensions | list | `[]` | Dimensions are searched for in the resource and span attributes and are added to the metrics if present. | | metricsGenerator.config.storage.remote_write | list | `[]` | https://prometheus.io/docs/prometheus/latest/configuration/configuration/#remote_write | diff --git a/charts/tempo-distributed/values.yaml b/charts/tempo-distributed/values.yaml index b9fe43feb6..5359988d86 100644 --- a/charts/tempo-distributed/values.yaml +++ b/charts/tempo-distributed/values.yaml @@ -1323,7 +1323,7 @@ storage: # Global overrides global_overrides: per_tenant_override_config: /runtime-config/overrides.yaml - # -- List of enabled metrics generator processors ([service-graphs, span-metrics]) + # -- List of enabled metrics generator processors ([service-graphs, span-metrics]) metrics_generator_processors: [] # Per tenants overrides From dd0d27dba0cff1809bab673efd7a51a75d12555e Mon Sep 17 00:00:00 2001 From: Davenury Date: Tue, 12 Dec 2023 19:28:49 +0100 Subject: [PATCH 15/17] regenerate docs Signed-off-by: Davenury --- charts/tempo-distributed/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tempo-distributed/README.md b/charts/tempo-distributed/README.md index 1e2b4c661d..86cb7fe53c 100644 --- a/charts/tempo-distributed/README.md +++ b/charts/tempo-distributed/README.md @@ -451,7 +451,7 @@ The memcached default args are removed and should be provided manually. The sett | global.image.pullSecrets | list | `[]` | Optional list of imagePullSecrets for all images, excluding enterprise. Names of existing secrets with private container registry credentials. Ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod Example: pullSecrets: [ my-dockerconfigjson-secret ] | | global.image.registry | string | `"docker.io"` | Overrides the Docker registry globally for all images, excluding enterprise. | | global.priorityClassName | string | `nil` | Overrides the priorityClassName for all pods | -| global_overrides.metrics_generator_processors | list | `[]` | List of enabled metrics generator processors ([service-graphs, span-metrics]) | +| global_overrides.metrics_generator_processors | list | `[]` | List of enabled metrics generator processors ([service-graphs, span-metrics]) | | global_overrides.per_tenant_override_config | string | `"/runtime-config/overrides.yaml"` | | | ingester.affinity | string | Soft node and soft zone anti-affinity | Affinity for ingester pods. Passed through `tpl` and, thus, to be configured as string | | ingester.annotations | object | `{}` | Annotations for the ingester StatefulSet | From 7e938f8b9cdc2f4d16a468bc83b1c34e45a25288 Mon Sep 17 00:00:00 2001 From: MH Date: Sun, 17 Dec 2023 05:13:25 +0800 Subject: [PATCH 16/17] Update Chart.yaml Signed-off-by: MH --- charts/tempo-distributed/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tempo-distributed/Chart.yaml b/charts/tempo-distributed/Chart.yaml index 723f8b7028..12cf79a6f8 100644 --- a/charts/tempo-distributed/Chart.yaml +++ b/charts/tempo-distributed/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: tempo-distributed description: Grafana Tempo in MicroService mode type: application -version: 1.7.2 +version: 1.7.3 appVersion: 2.3.0 engine: gotpl home: https://grafana.com/docs/tempo/latest/ From 8459d24511766518b69fa349215789abe548480e Mon Sep 17 00:00:00 2001 From: MH Date: Sun, 17 Dec 2023 05:13:45 +0800 Subject: [PATCH 17/17] Update README.md Signed-off-by: MH --- charts/tempo-distributed/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tempo-distributed/README.md b/charts/tempo-distributed/README.md index 86cb7fe53c..b67bfae36e 100644 --- a/charts/tempo-distributed/README.md +++ b/charts/tempo-distributed/README.md @@ -1,6 +1,6 @@ # tempo-distributed -![Version: 1.7.2](https://img.shields.io/badge/Version-1.7.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.0](https://img.shields.io/badge/AppVersion-2.3.0-informational?style=flat-square) +![Version: 1.7.3](https://img.shields.io/badge/Version-1.7.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.3.0](https://img.shields.io/badge/AppVersion-2.3.0-informational?style=flat-square) Grafana Tempo in MicroService mode