Skip to content

Commit 43d422e

Browse files
Merge pull request #3739 from peter-kyu/sc-env
[grafana] add support for envValueFrom in sidecar.alerts both initContainer and watch container
2 parents 11cf6b0 + c479456 commit 43d422e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

charts/grafana/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: grafana
3-
version: 9.3.4
3+
version: 9.3.5
44
appVersion: 12.1.0
55
kubeVersion: "^1.8.0-0"
66
description: The leading tool for querying and visualizing time series and metrics.

charts/grafana/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ need to instead set `global.imageRegistry`.
175175
| `sidecar.securityContext` | Sidecar securityContext | `{}` |
176176
| `sidecar.enableUniqueFilenames` | Sets the kiwigrid/k8s-sidecar UNIQUE_FILENAMES environment variable. If set to `true` the sidecar will create unique filenames where duplicate data keys exist between ConfigMaps and/or Secrets within the same or multiple Namespaces. | `false` |
177177
| `sidecar.alerts.enabled` | Enables the cluster wide search for alerts and adds/updates/deletes them in grafana |`false` |
178+
| `sidecar.alerts.env` | Extra environment variables passed to pods | `{}` |
179+
| `sidecar.alerts.envValueFrom` | Environment variables from alternate sources. See the API docs on [EnvVarSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#envvarsource-v1-core) for format details. Can be templated | `{}` |
178180
| `sidecar.alerts.label` | Label that config maps with alerts should have to be added (can be templated) | `grafana_alert` |
179181
| `sidecar.alerts.labelValue` | Label value that config maps with alerts should have to be added (can be templated) | `""` |
180182
| `sidecar.alerts.searchNamespace` | Namespaces list. If specified, the sidecar will search for alerts config-maps inside these namespaces. Otherwise the namespace in which the sidecar is running will be used. It's also possible to specify ALL to search in all namespaces. | `nil` |
@@ -185,6 +187,8 @@ need to instead set `global.imageRegistry`.
185187
| `sidecar.alerts.initAlerts` | Set to true to deploy the alerts sidecar as an initContainer. This is needed if skipReload is true, to load any alerts defined at startup time. | `false` |
186188
| `sidecar.alerts.extraMounts` | Additional alerts sidecar volume mounts. | `[]` |
187189
| `sidecar.dashboards.enabled` | Enables the cluster wide search for dashboards and adds/updates/deletes them in grafana | `false` |
190+
| `sidecar.dashboards.env` | Extra environment variables passed to pods | `{}` |
191+
| `sidecar.dashboards.envValueFrom` | Environment variables from alternate sources. See the API docs on [EnvVarSource](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.17/#envvarsource-v1-core) for format details. Can be templated | `{}` |
188192
| `sidecar.dashboards.SCProvider` | Enables creation of sidecar provider | `true` |
189193
| `sidecar.dashboards.provider.name` | Unique name of the grafana provider | `sidecarProvider` |
190194
| `sidecar.dashboards.provider.orgid` | Id of the organisation, to which the dashboards should be added | `1` |

charts/grafana/templates/_pod.tpl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ initContainers:
151151
{{- end }}
152152
{{- with .Values.sidecar.alerts.searchNamespace }}
153153
- name: NAMESPACE
154-
value: {{ . | join "," | quote }}
154+
value: "{{ tpl (. | join ",") $root | quote }}"
155155
{{- end }}
156156
{{- with .Values.sidecar.alerts.skipTlsVerify }}
157157
- name: SKIP_TLS_VERIFY
@@ -352,6 +352,11 @@ containers:
352352
- name: "{{ $key }}"
353353
value: "{{ $value }}"
354354
{{- end }}
355+
{{- range $key, $value := .Values.sidecar.alerts.envValueFrom }}
356+
- name: {{ $key | quote }}
357+
valueFrom:
358+
{{- tpl (toYaml $value) $ | nindent 10 }}
359+
{{- end }}
355360
{{- if .Values.sidecar.alerts.ignoreAlreadyProcessed }}
356361
- name: IGNORE_ALREADY_PROCESSED
357362
value: "true"
@@ -382,7 +387,7 @@ containers:
382387
{{- end }}
383388
{{- with .Values.sidecar.alerts.searchNamespace }}
384389
- name: NAMESPACE
385-
value: {{ . | join "," | quote }}
390+
value: "{{ tpl (. | join ",") $root | quote }}"
386391
{{- end }}
387392
{{- with .Values.sidecar.alerts.skipTlsVerify }}
388393
- name: SKIP_TLS_VERIFY

0 commit comments

Comments
 (0)