Skip to content

Commit e5f31b3

Browse files
bentonampoyzannur
andauthored
feat: helm global values updates (#16062)
Signed-off-by: Aaron <aaron.benton@grafana.com> Signed-off-by: Poyzan <31743851+poyzannur@users.noreply.github.com> Co-authored-by: Poyzan <31743851+poyzannur@users.noreply.github.com>
1 parent 381323e commit e5f31b3

23 files changed

+197
-200
lines changed

‎docs/sources/setup/install/helm/reference.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4613,6 +4613,51 @@ true
46134613
<td><pre lang="json">
46144614
"kube-dns"
46154615
</pre>
4616+
</td>
4617+
</tr>
4618+
<tr>
4619+
<td>global.extraArgs</td>
4620+
<td>list</td>
4621+
<td>Common additional CLI arguments for all jobs (that is, -log.level debug, -config.expand-env=true or -log-config-reverse-order) scope: admin-api, backend, bloom-builder, bloom-gateway, bloom-planner, compactor, distributor, index-gateway, ingester, overrides-exporter, pattern-ingester, querier, query-frontend, query-scheduler, read, ruler, write.</td>
4622+
<td><pre lang="json">
4623+
[]
4624+
</pre>
4625+
</td>
4626+
</tr>
4627+
<tr>
4628+
<td>global.extraEnv</td>
4629+
<td>list</td>
4630+
<td>Common environment variables to add to all pods directly managed by this chart. scope: admin-api, backend, bloom-builder, bloom-gateway, bloom-planner, compactor, distributor, index-gateway, ingester, overrides-exporter, pattern-ingester, querier, query-frontend, query-scheduler, read, ruler, write.</td>
4631+
<td><pre lang="json">
4632+
[]
4633+
</pre>
4634+
</td>
4635+
</tr>
4636+
<tr>
4637+
<td>global.extraEnvFrom</td>
4638+
<td>list</td>
4639+
<td>Common source of environment injections to add to all pods directly managed by this chart. scope: admin-api, backend, bloom-builder, bloom-gateway, bloom-planner, compactor, distributor, index-gateway, ingester, overrides-exporter, pattern-ingester, querier, query-frontend, query-scheduler, read, ruler, write. For example to inject values from a Secret, use: extraEnvFrom: - secretRef: name: mysecret</td>
4640+
<td><pre lang="json">
4641+
[]
4642+
</pre>
4643+
</td>
4644+
</tr>
4645+
<tr>
4646+
<td>global.extraVolumeMounts</td>
4647+
<td>list</td>
4648+
<td>Common mount points to add to all pods directly managed by this chart. scope: admin-api, backend, bloom-builder, bloom-gateway, bloom-planner, compactor, distributor, index-gateway, ingester, overrides-exporter, pattern-ingester, querier, query-frontend, query-scheduler, read, ruler, write.</td>
4649+
<td><pre lang="json">
4650+
[]
4651+
</pre>
4652+
</td>
4653+
</tr>
4654+
<tr>
4655+
<td>global.extraVolumes</td>
4656+
<td>list</td>
4657+
<td>Common volumes to add to all pods directly managed by this chart. scope: admin-api, backend, bloom-builder, bloom-gateway, bloom-planner, compactor, distributor, index-gateway, ingester, overrides-exporter, pattern-ingester, querier, query-frontend, query-scheduler, read, ruler, write.</td>
4658+
<td><pre lang="json">
4659+
[]
4660+
</pre>
46164661
</td>
46174662
</tr>
46184663
<tr>

‎production/helm/loki/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Entries should include a reference to the pull request that introduced the chang
1313

1414
[//]: # (<AUTOMATED_UPDATES_LOCATOR> : do not remove this line. This locator is used by the CI pipeline to automatically create a changelog entry for each new Loki release. Add other chart versions and respective changelog entries bellow this line.)
1515

16+
- [FEATURE] Added support for globals: `extraArgs`, `extraEnv`, `extraEnvFrom`, `extraVolumes`, `extraVolumeMounts` ([#16062](https://github.com/grafana/loki/pull/16062)) relates to ([#12652](https://github.com/grafana/loki/pull/12652))
17+
1618
## 6.26.0
1719

1820
- [CHANGE] Changed version of Grafana Loki to 3.4.0

‎production/helm/loki/templates/admin-api/deployment-admin-api.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ spec:
2323
template:
2424
metadata:
2525
labels:
26-
{{- include "enterprise-logs.adminApiSelectorLabels" . | nindent 8 }}
27-
{{- with .Values.adminApi.labels }}
26+
{{- include "enterprise-logs.adminApiLabels" . | nindent 8 }}
27+
{{- with merge .Values.loki.podLabels .Values.adminApi.labels }}
2828
{{- toYaml . | nindent 8 }}
2929
{{- end }}
3030
app.kubernetes.io/part-of: memberlist

‎production/helm/loki/templates/backend/statefulset-backend.yaml

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@ metadata:
1111
app.kubernetes.io/part-of: memberlist
1212
{{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
1313
annotations:
14-
{{- with .Values.loki.annotations }}
15-
{{- toYaml . | nindent 4 }}
16-
{{- end }}
17-
{{- with .Values.backend.annotations }}
14+
{{- with merge .Values.loki.annotations .Values.backend.annotations }}
1815
{{- toYaml . | nindent 4 }}
1916
{{- end }}
2017
{{- end }}
@@ -55,16 +52,10 @@ spec:
5552
{{- toYaml . | nindent 8 }}
5653
{{- end }}
5754
labels:
58-
{{- include "loki.backendSelectorLabels" . | nindent 8 }}
59-
{{- with .Values.loki.podLabels }}
55+
{{- include "loki.backendLabels" . | nindent 8 }}
56+
{{- with merge .Values.loki.podLabels .Values.backend.podLabels }}
6057
{{- toYaml . | nindent 8 }}
6158
{{- end }}
62-
{{- with .Values.backend.podLabels }}
63-
{{- toYaml . | nindent 8 }}
64-
{{- end }}
65-
{{- with .Values.backend.selectorLabels }}
66-
{{- tpl (toYaml .) $ | nindent 8 }}
67-
{{- end }}
6859
app.kubernetes.io/part-of: memberlist
6960
spec:
7061
serviceAccountName: {{ include "loki.serviceAccountName" . }}
@@ -160,7 +151,7 @@ spec:
160151
- -config.file=/etc/loki/config/config.yaml
161152
- -target={{ .Values.backend.targetModule }}
162153
- -legacy-read-mode=false
163-
{{- with .Values.backend.extraArgs }}
154+
{{- with (concat .Values.global.extraArgs .Values.backend.extraArgs) | uniq }}
164155
{{- toYaml . | nindent 12 }}
165156
{{- end }}
166157
ports:
@@ -173,11 +164,11 @@ spec:
173164
- name: http-memberlist
174165
containerPort: 7946
175166
protocol: TCP
176-
{{- with .Values.backend.extraEnv }}
167+
{{- with (concat .Values.global.extraEnv .Values.backend.extraEnv) | uniq }}
177168
env:
178169
{{- toYaml . | nindent 12 }}
179170
{{- end }}
180-
{{- with .Values.backend.extraEnvFrom }}
171+
{{- with (concat .Values.global.extraEnv .Values.backend.extraEnvFrom) | uniq }}
181172
envFrom:
182173
{{- toYaml . | nindent 12 }}
183174
{{- end }}
@@ -202,7 +193,7 @@ spec:
202193
- name: sc-rules-volume
203194
mountPath: {{ .Values.sidecar.rules.folder | quote }}
204195
{{- end}}
205-
{{- with .Values.backend.extraVolumeMounts }}
196+
{{- with (concat .Values.global.extraVolumeMounts .Values.backend.extraVolumeMounts) | uniq }}
206197
{{- toYaml . | nindent 12 }}
207198
{{- end }}
208199
resources:
@@ -257,7 +248,7 @@ spec:
257248
emptyDir: {}
258249
{{- end -}}
259250
{{- end -}}
260-
{{- with .Values.backend.extraVolumes }}
251+
{{- with (concat .Values.global.extraVolumes .Values.backend.extraVolumes) | uniq }}
261252
{{- toYaml . | nindent 8 }}
262253
{{- end }}
263254
{{- if .Values.backend.persistence.volumeClaimsEnabled }}

‎production/helm/loki/templates/bloom-builder/deployment-bloom-builder.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,9 @@ spec:
3434
{{- toYaml . | nindent 8 }}
3535
{{- end }}
3636
labels:
37-
{{- include "loki.bloomBuilderSelectorLabels" . | nindent 8 }}
37+
{{- include "loki.bloomBuilderLabels" . | nindent 8 }}
3838
app.kubernetes.io/part-of: memberlist
39-
{{- with .Values.loki.podLabels }}
40-
{{- toYaml . | nindent 8 }}
41-
{{- end }}
42-
{{- with .Values.bloomBuilder.podLabels }}
39+
{{- with merge .Values.loki.podLabels .Values.bloomBuilder.podLabels }}
4340
{{- toYaml . | nindent 8 }}
4441
{{- end }}
4542
spec:
@@ -67,7 +64,7 @@ spec:
6764
args:
6865
- -config.file=/etc/loki/config/config.yaml
6966
- -target=bloom-builder
70-
{{- with .Values.bloomBuilder.extraArgs }}
67+
{{- with (concat .Values.global.extraArgs .Values.bloomBuilder.extraArgs) | uniq }}
7168
{{- toYaml . | nindent 12 }}
7269
{{- end }}
7370
ports:
@@ -80,11 +77,11 @@ spec:
8077
- name: http-memberlist
8178
containerPort: 7946
8279
protocol: TCP
83-
{{- with .Values.bloomBuilder.extraEnv }}
80+
{{- with (concat .Values.global.extraEnv .Values.bloomBuilder.extraEnv) | uniq }}
8481
env:
8582
{{- toYaml . | nindent 12 }}
8683
{{- end }}
87-
{{- with .Values.bloomBuilder.extraEnvFrom }}
84+
{{- with (concat .Values.global.extraEnvFrom .Values.bloomBuilder.extraEnvFrom) | uniq }}
8885
envFrom:
8986
{{- toYaml . | nindent 12 }}
9087
{{- end }}
@@ -105,7 +102,7 @@ spec:
105102
mountPath: /tmp
106103
- name: data
107104
mountPath: /var/loki
108-
{{- with .Values.bloomBuilder.extraVolumeMounts }}
105+
{{- with (concat .Values.global.extraVolumeMounts .Values.bloomBuilder.extraVolumeMounts) | uniq }}
109106
{{- toYaml . | nindent 12 }}
110107
{{- end }}
111108
resources:
@@ -144,7 +141,7 @@ spec:
144141
emptyDir: {}
145142
- name: data
146143
emptyDir: {}
147-
{{- with .Values.bloomBuilder.extraVolumes }}
144+
{{- with (concat .Values.global.extraVolumes .Values.bloomBuilder.extraVolumes) | uniq }}
148145
{{- toYaml . | nindent 8 }}
149146
{{- end }}
150147
{{- end -}}

‎production/helm/loki/templates/bloom-gateway/statefulset-bloom-gateway.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,9 @@ spec:
3838
{{- toYaml . | nindent 8 }}
3939
{{- end }}
4040
labels:
41-
{{- include "loki.bloomGatewaySelectorLabels" . | nindent 8 }}
41+
{{- include "loki.bloomGatewayLabels" . | nindent 8 }}
4242
app.kubernetes.io/part-of: memberlist
43-
{{- with .Values.loki.podLabels }}
44-
{{- toYaml . | nindent 8 }}
45-
{{- end }}
46-
{{- with .Values.bloomGateway.podLabels }}
43+
{{- with merge .Values.loki.podLabels .Values.bloomGateway.podLabels }}
4744
{{- toYaml . | nindent 8 }}
4845
{{- end }}
4946
spec:
@@ -75,7 +72,7 @@ spec:
7572
args:
7673
- -config.file=/etc/loki/config/config.yaml
7774
- -target=bloom-gateway
78-
{{- with .Values.bloomGateway.extraArgs }}
75+
{{- with (concat .Values.global.extraArgs .Values.bloomGateway.extraArgs) | uniq }}
7976
{{- toYaml . | nindent 12 }}
8077
{{- end }}
8178
ports:
@@ -88,11 +85,11 @@ spec:
8885
- name: http-memberlist
8986
containerPort: 7946
9087
protocol: TCP
91-
{{- with .Values.bloomGateway.extraEnv }}
88+
{{- with (concat .Values.global.extraEnv .Values.bloomGateway.extraEnv) | uniq }}
9289
env:
9390
{{- toYaml . | nindent 12 }}
9491
{{- end }}
95-
{{- with .Values.bloomGateway.extraEnvFrom }}
92+
{{- with (concat .Values.global.extraEnvFrom .Values.bloomGateway.extraEnvFrom) | uniq }}
9693
envFrom:
9794
{{- toYaml . | nindent 12 }}
9895
{{- end }}
@@ -112,7 +109,7 @@ spec:
112109
- name: license
113110
mountPath: /etc/loki/license
114111
{{- end }}
115-
{{- with .Values.bloomGateway.extraVolumeMounts }}
112+
{{- with (concat .Values.global.extraVolumeMounts .Values.bloomGateway.extraVolumeMounts) | uniq }}
116113
{{- toYaml . | nindent 12 }}
117114
{{- end }}
118115
{{- with .Values.bloomGateway.resources }}
@@ -155,7 +152,7 @@ spec:
155152
- name: data
156153
emptyDir: {}
157154
{{- end }}
158-
{{- with .Values.bloomGateway.extraVolumes }}
155+
{{- with (concat .Values.global.extraVolumes .Values.bloomGateway.extraVolumes) | uniq }}
159156
{{- toYaml . | nindent 8 }}
160157
{{- end }}
161158
{{- if .Values.bloomGateway.persistence.enabled }}

‎production/helm/loki/templates/bloom-planner/statefulset-bloom-planner.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,9 @@ spec:
3838
{{- toYaml . | nindent 8 }}
3939
{{- end }}
4040
labels:
41-
{{- include "loki.bloomPlannerSelectorLabels" . | nindent 8 }}
41+
{{- include "loki.bloomPlannerLabels" . | nindent 8 }}
4242
app.kubernetes.io/part-of: memberlist
43-
{{- with .Values.loki.podLabels }}
44-
{{- toYaml . | nindent 8 }}
45-
{{- end }}
46-
{{- with .Values.bloomPlanner.podLabels }}
43+
{{- with merge .Values.loki.podLabels .Values.bloomPlanner.podLabels }}
4744
{{- toYaml . | nindent 8 }}
4845
{{- end }}
4946
spec:

‎production/helm/loki/templates/compactor/statefulset-compactor.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,9 @@ spec:
3939
{{- toYaml . | nindent 8 }}
4040
{{- end }}
4141
labels:
42-
{{- include "loki.compactorSelectorLabels" . | nindent 8 }}
42+
{{- include "loki.compactorLabels" . | nindent 8 }}
4343
app.kubernetes.io/part-of: memberlist
44-
{{- with .Values.loki.podLabels }}
45-
{{- toYaml . | nindent 8 }}
46-
{{- end }}
47-
{{- with .Values.compactor.podLabels }}
44+
{{- with merge .Values.loki.podLabels .Values.compactor.podLabels }}
4845
{{- toYaml . | nindent 8 }}
4946
{{- end }}
5047
spec:
@@ -82,7 +79,7 @@ spec:
8279
args:
8380
- -config.file=/etc/loki/config/config.yaml
8481
- -target=compactor
85-
{{- with .Values.compactor.extraArgs }}
82+
{{- with (concat .Values.global.extraArgs .Values.compactor.extraArgs) | uniq }}
8683
{{- toYaml . | nindent 12 }}
8784
{{- end }}
8885
ports:
@@ -95,11 +92,11 @@ spec:
9592
- name: http-memberlist
9693
containerPort: 7946
9794
protocol: TCP
98-
{{- with .Values.compactor.extraEnv }}
95+
{{- with (concat .Values.global.extraEnv .Values.compactor.extraEnv) | uniq }}
9996
env:
10097
{{- toYaml . | nindent 12 }}
10198
{{- end }}
102-
{{- with .Values.compactor.extraEnvFrom }}
99+
{{- with (concat .Values.global.extraEnvFrom .Values.compactor.extraEnvFrom) | uniq }}
103100
envFrom:
104101
{{- toYaml . | nindent 12 }}
105102
{{- end }}
@@ -120,7 +117,7 @@ spec:
120117
- name: license
121118
mountPath: /etc/loki/license
122119
{{- end }}
123-
{{- with .Values.compactor.extraVolumeMounts }}
120+
{{- with (concat .Values.global.extraVolumeMounts .Values.compactor.extraVolumeMounts) | uniq }}
124121
{{- toYaml . | nindent 12 }}
125122
{{- end }}
126123
{{- with .Values.compactor.resources }}
@@ -167,7 +164,7 @@ spec:
167164
- name: data
168165
emptyDir: {}
169166
{{- end }}
170-
{{- with .Values.compactor.extraVolumes }}
167+
{{- with (concat .Values.global.extraVolumes .Values.compactor.extraVolumes) | uniq }}
171168
{{- toYaml . | nindent 8 }}
172169
{{- end }}
173170
{{- if .Values.compactor.persistence.enabled }}

‎production/helm/loki/templates/distributor/deployment-distributor.yaml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,9 @@ spec:
3535
{{- toYaml . | nindent 8 }}
3636
{{- end }}
3737
labels:
38-
{{- include "loki.distributorSelectorLabels" . | nindent 8 }}
38+
{{- include "loki.distributorLabels" . | nindent 8 }}
3939
app.kubernetes.io/part-of: memberlist
40-
{{- with .Values.loki.podLabels }}
41-
{{- toYaml . | nindent 8 }}
42-
{{- end }}
43-
{{- with .Values.distributor.podLabels }}
40+
{{- with merge .Values.loki.podLabels .Values.distributor.podLabels }}
4441
{{- toYaml . | nindent 8 }}
4542
{{- end }}
4643
spec:
@@ -81,7 +78,7 @@ spec:
8178
- -distributor.zone-awareness-enabled=true
8279
{{- end }}
8380
{{- end }}
84-
{{- with .Values.distributor.extraArgs }}
81+
{{- with (concat .Values.global.extraArgs .Values.distributor.extraArgs) | uniq }}
8582
{{- toYaml . | nindent 12 }}
8683
{{- end }}
8784
ports:
@@ -94,11 +91,11 @@ spec:
9491
- name: http-memberlist
9592
containerPort: 7946
9693
protocol: TCP
97-
{{- with .Values.distributor.extraEnv }}
94+
{{- with (concat .Values.global.extraEnv .Values.distributor.extraEnv) | uniq }}
9895
env:
9996
{{- toYaml . | nindent 12 }}
10097
{{- end }}
101-
{{- with .Values.distributor.extraEnvFrom }}
98+
{{- with (concat .Values.global.extraEnvFrom .Values.distributor.extraEnvFrom) | uniq }}
10299
envFrom:
103100
{{- toYaml . | nindent 12 }}
104101
{{- end }}
@@ -117,7 +114,7 @@ spec:
117114
- name: license
118115
mountPath: /etc/loki/license
119116
{{- end }}
120-
{{- with .Values.distributor.extraVolumeMounts }}
117+
{{- with (concat .Values.global.extraVolumeMounts .Values.distributor.extraVolumeMounts) | uniq }}
121118
{{- toYaml . | nindent 12 }}
122119
{{- end }}
123120
resources:
@@ -152,7 +149,7 @@ spec:
152149
secretName: enterprise-logs-license
153150
{{- end }}
154151
{{- end }}
155-
{{- with .Values.distributor.extraVolumes }}
152+
{{- with (concat .Values.global.extraVolumes .Values.distributor.extraVolumes) | uniq }}
156153
{{- toYaml . | nindent 8 }}
157154
{{- end }}
158155
{{- end -}}

0 commit comments

Comments
 (0)