Skip to content

Commit f4accc1

Browse files
fix(helm/loki): Allow prefixing of rollout-group value and ingester name (#15063)
Co-authored-by: Trevor Whitney <trevorjwhitney@gmail.com>
1 parent 860c25d commit f4accc1

11 files changed

+59
-33
lines changed

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

+2
Original file line numberDiff line numberDiff line change
@@ -5012,6 +5012,7 @@ null
50125012
<td>Configuration for the ingester</td>
50135013
<td><pre lang="json">
50145014
{
5015+
"addIngesterNamePrefix": false,
50155016
"affinity": {
50165017
"podAntiAffinity": {
50175018
"requiredDuringSchedulingIgnoredDuringExecution": [
@@ -5080,6 +5081,7 @@ null
50805081
"readinessProbe": {},
50815082
"replicas": 0,
50825083
"resources": {},
5084+
"rolloutGroupPrefix": null,
50835085
"serviceAnnotations": {},
50845086
"serviceLabels": {},
50855087
"terminationGracePeriodSeconds": 300,

‎production/helm/loki/templates/ingester/_helpers-ingester.tpl

+19-1
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,22 @@ expects a dict
7171
*/}}
7272
{{- define "loki.ingester.maxUnavailable" -}}
7373
{{- ceil (mulf .replicas (divf (int .ctx.Values.ingester.zoneAwareReplication.maxUnavailablePct) 100)) -}}
74-
{{- end -}}
74+
{{- end -}}
75+
76+
{{/*
77+
Return rollout-group prefix if it is set
78+
*/}}
79+
{{- define "loki.prefixRolloutGroup" -}}
80+
{{- if .Values.ingester.rolloutGroupPrefix -}}
81+
{{- .Values.ingester.rolloutGroupPrefix -}}-
82+
{{- end -}}
83+
{{- end -}}
84+
85+
{{/*
86+
Return ingester name prefix if required
87+
*/}}
88+
{{- define "loki.prefixIngesterName" -}}
89+
{{- if .Values.ingester.addIngesterNamePrefix -}}
90+
loki-
91+
{{- end -}}
92+
{{- end -}}

‎production/helm/loki/templates/ingester/poddisruptionbudget-ingester-rollout.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ metadata:
1313
spec:
1414
selector:
1515
matchLabels:
16-
rollout-group: ingester
16+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
1717
{{- with .Values.ingester.maxUnavailable }}
1818
maxUnavailable: {{ . }}
1919
{{- end }}

‎production/helm/loki/templates/ingester/poddisruptionbudget-ingester.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
- key: rollout-group
2020
operator: NotIn
2121
values:
22-
- "ingester"
22+
- '{{ include "loki.prefixRolloutGroup" . }}ingester'
2323
{{- with .Values.ingester.maxUnavailable }}
2424
maxUnavailable: {{ . }}
2525
{{- end }}

‎production/helm/loki/templates/ingester/service-ingester-zone-a-headless.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ spec:
3333
{{- end }}
3434
selector:
3535
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }}
36-
name: ingester-zone-a
37-
rollout-group: ingester
36+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-a
37+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
3838
{{- end -}}

‎production/helm/loki/templates/ingester/service-ingester-zone-b-headless.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ spec:
3333
{{- end }}
3434
selector:
3535
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }}
36-
name: ingester-zone-b
37-
rollout-group: ingester
36+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-b
37+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
3838
{{- end -}}

‎production/helm/loki/templates/ingester/service-ingester-zone-c-headless.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ spec:
3333
{{- end }}
3434
selector:
3535
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }}
36-
name: ingester-zone-c
37-
rollout-group: ingester
36+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-c
37+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
3838
{{- end -}}

‎production/helm/loki/templates/ingester/statefulset-ingester-zone-a.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ metadata:
99
labels:
1010
{{- include "loki.ingesterLabels" . | nindent 4 }}
1111
app.kubernetes.io/part-of: memberlist
12-
rollout-group: ingester
13-
name: ingester-zone-a
12+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-a
13+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
1414
annotations:
1515
rollout-max-unavailable: "{{ include "loki.ingester.maxUnavailable" (dict "ctx" . "replicas" $replicas)}}"
1616
{{- with .Values.loki.annotations }}
@@ -38,8 +38,8 @@ spec:
3838
selector:
3939
matchLabels:
4040
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }}
41-
name: ingester-zone-a
42-
rollout-group: ingester
41+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-a
42+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
4343
{{- with .Values.ingester.updateStrategy }}
4444
updateStrategy:
4545
{{- tpl (. | toYaml) $ | nindent 4 }}
@@ -60,8 +60,8 @@ spec:
6060
labels:
6161
{{- include "loki.ingesterSelectorLabels" . | nindent 8 }}
6262
app.kubernetes.io/part-of: memberlist
63-
name: ingester-zone-a
64-
rollout-group: ingester
63+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-a
64+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
6565
{{- with .Values.loki.podLabels }}
6666
{{- toYaml . | nindent 8 }}
6767
{{- end }}
@@ -164,11 +164,11 @@ spec:
164164
- key: rollout-group
165165
operator: In
166166
values:
167-
- ingester
167+
- {{ include "loki.prefixRolloutGroup" . }}ingester
168168
- key: name
169169
operator: NotIn
170170
values:
171-
- ingester-zone-a
171+
- {{ include "loki.prefixIngesterName" . }}ingester-zone-a
172172
topologyKey: kubernetes.io/hostname
173173
{{- with .Values.ingester.zoneAwareReplication.zoneA.extraAffinity }}
174174
{{- toYaml . | nindent 8 }}

‎production/helm/loki/templates/ingester/statefulset-ingester-zone-b.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ metadata:
99
labels:
1010
{{- include "loki.ingesterLabels" . | nindent 4 }}
1111
app.kubernetes.io/part-of: memberlist
12-
rollout-group: ingester
13-
name: ingester-zone-b
12+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-b
13+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
1414
annotations:
1515
rollout-max-unavailable: "{{ include "loki.ingester.maxUnavailable" (dict "ctx" . "replicas" $replicas)}}"
1616
{{- with .Values.loki.annotations }}
@@ -38,8 +38,8 @@ spec:
3838
selector:
3939
matchLabels:
4040
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }}
41-
name: ingester-zone-b
42-
rollout-group: ingester
41+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-b
42+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
4343
{{- with .Values.ingester.updateStrategy }}
4444
updateStrategy:
4545
{{- tpl (. | toYaml) $ | nindent 4 }}
@@ -60,8 +60,8 @@ spec:
6060
labels:
6161
{{- include "loki.ingesterSelectorLabels" . | nindent 8 }}
6262
app.kubernetes.io/part-of: memberlist
63-
name: ingester-zone-b
64-
rollout-group: ingester
63+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-b
64+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
6565
{{- with .Values.loki.podLabels }}
6666
{{- toYaml . | nindent 8 }}
6767
{{- end }}
@@ -164,11 +164,11 @@ spec:
164164
- key: rollout-group
165165
operator: In
166166
values:
167-
- ingester
167+
- {{ include "loki.prefixRolloutGroup" . }}ingester
168168
- key: name
169169
operator: NotIn
170170
values:
171-
- ingester-zone-b
171+
- {{ include "loki.prefixIngesterName" . }}ingester-zone-b
172172
topologyKey: kubernetes.io/hostname
173173
{{- with .Values.ingester.zoneAwareReplication.zoneB.extraAffinity }}
174174
{{- toYaml . | nindent 8 }}

‎production/helm/loki/templates/ingester/statefulset-ingester-zone-c.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ metadata:
99
labels:
1010
{{- include "loki.ingesterLabels" . | nindent 4 }}
1111
app.kubernetes.io/part-of: memberlist
12-
rollout-group: ingester
13-
name: ingester-zone-c
12+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-c
13+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
1414
annotations:
1515
rollout-max-unavailable: "{{ include "loki.ingester.maxUnavailable" (dict "ctx" . "replicas" $replicas)}}"
1616
{{- with .Values.loki.annotations }}
@@ -38,8 +38,8 @@ spec:
3838
selector:
3939
matchLabels:
4040
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }}
41-
name: ingester-zone-c
42-
rollout-group: ingester
41+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-c
42+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
4343
{{- with .Values.ingester.updateStrategy }}
4444
updateStrategy:
4545
{{- tpl (. | toYaml) $ | nindent 4 }}
@@ -60,8 +60,8 @@ spec:
6060
labels:
6161
{{- include "loki.ingesterSelectorLabels" . | nindent 8 }}
6262
app.kubernetes.io/part-of: memberlist
63-
name: ingester-zone-c
64-
rollout-group: ingester
63+
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-c
64+
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
6565
{{- with .Values.loki.podLabels }}
6666
{{- toYaml . | nindent 8 }}
6767
{{- end }}
@@ -164,11 +164,11 @@ spec:
164164
- key: rollout-group
165165
operator: In
166166
values:
167-
- ingester
167+
- {{ include "loki.prefixIngesterName" . }}ingester
168168
- key: name
169169
operator: NotIn
170170
values:
171-
- ingester-zone-c
171+
- {{ include "loki.prefixIngesterName" . }}ingester-zone-c
172172
topologyKey: kubernetes.io/hostname
173173
{{- with .Values.ingester.zoneAwareReplication.zoneC.extraAffinity }}
174174
{{- toYaml . | nindent 8 }}

‎production/helm/loki/values.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,12 @@ ingester:
18931893
excludeDefaultZone: false
18941894
readPath: false
18951895
writePath: false
1896+
1897+
# optionally allow adding arbitrary prefix to the ingester rollout-group label
1898+
rolloutGroupPrefix: null
1899+
# optionally allow adding 'loki-' prefix to ingester name label
1900+
addIngesterNamePrefix: false
1901+
18961902
# -- Configuration for the distributor
18971903
distributor:
18981904
# -- Number of replicas for the distributor

0 commit comments

Comments
 (0)