Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(helm/loki): Allow prefixing of rollout-group value and ingester name #15063

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/sources/setup/install/helm/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -5012,6 +5012,7 @@ null
<td>Configuration for the ingester</td>
<td><pre lang="json">
{
"addIngesterNamePrefix": false,
"affinity": {
"podAntiAffinity": {
"requiredDuringSchedulingIgnoredDuringExecution": [
Expand Down Expand Up @@ -5080,6 +5081,7 @@ null
"readinessProbe": {},
"replicas": 0,
"resources": {},
"rolloutGroupPrefix": null,
"serviceAnnotations": {},
"serviceLabels": {},
"terminationGracePeriodSeconds": 300,
Expand Down
20 changes: 19 additions & 1 deletion production/helm/loki/templates/ingester/_helpers-ingester.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,22 @@ expects a dict
*/}}
{{- define "loki.ingester.maxUnavailable" -}}
{{- ceil (mulf .replicas (divf (int .ctx.Values.ingester.zoneAwareReplication.maxUnavailablePct) 100)) -}}
{{- end -}}
{{- end -}}

{{/*
Return rollout-group prefix if it is set
*/}}
{{- define "loki.prefixRolloutGroup" -}}
{{- if .Values.ingester.rolloutGroupPrefix -}}
{{- .Values.ingester.rolloutGroupPrefix -}}-
{{- end -}}
{{- end -}}

{{/*
Return ingester name prefix if required
*/}}
{{- define "loki.prefixIngesterName" -}}
{{- if .Values.ingester.addIngesterNamePrefix -}}
loki-
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ metadata:
spec:
selector:
matchLabels:
rollout-group: ingester
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
{{- with .Values.ingester.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
- key: rollout-group
operator: NotIn
values:
- "ingester"
- '{{ include "loki.prefixRolloutGroup" . }}ingester'
{{- with .Values.ingester.maxUnavailable }}
maxUnavailable: {{ . }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ spec:
{{- end }}
selector:
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }}
name: ingester-zone-a
rollout-group: ingester
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-a
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ spec:
{{- end }}
selector:
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }}
name: ingester-zone-b
rollout-group: ingester
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-b
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ spec:
{{- end }}
selector:
{{- include "loki.ingesterSelectorLabels" . | nindent 4 }}
name: ingester-zone-c
rollout-group: ingester
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-c
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ metadata:
labels:
{{- include "loki.ingesterLabels" . | nindent 4 }}
app.kubernetes.io/part-of: memberlist
rollout-group: ingester
name: ingester-zone-a
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-a
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
annotations:
rollout-max-unavailable: "{{ include "loki.ingester.maxUnavailable" (dict "ctx" . "replicas" $replicas)}}"
{{- with .Values.loki.annotations }}
Expand Down Expand Up @@ -38,8 +38,8 @@ spec:
selector:
matchLabels:
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }}
name: ingester-zone-a
rollout-group: ingester
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-a
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
{{- with .Values.ingester.updateStrategy }}
updateStrategy:
{{- tpl (. | toYaml) $ | nindent 4 }}
Expand All @@ -60,8 +60,8 @@ spec:
labels:
{{- include "loki.ingesterSelectorLabels" . | nindent 8 }}
app.kubernetes.io/part-of: memberlist
name: ingester-zone-a
rollout-group: ingester
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-a
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
{{- with .Values.loki.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -164,11 +164,11 @@ spec:
- key: rollout-group
operator: In
values:
- ingester
- {{ include "loki.prefixRolloutGroup" . }}ingester
- key: name
operator: NotIn
values:
- ingester-zone-a
- {{ include "loki.prefixIngesterName" . }}ingester-zone-a
topologyKey: kubernetes.io/hostname
{{- with .Values.ingester.zoneAwareReplication.zoneA.extraAffinity }}
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ metadata:
labels:
{{- include "loki.ingesterLabels" . | nindent 4 }}
app.kubernetes.io/part-of: memberlist
rollout-group: ingester
name: ingester-zone-b
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-b
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
annotations:
rollout-max-unavailable: "{{ include "loki.ingester.maxUnavailable" (dict "ctx" . "replicas" $replicas)}}"
{{- with .Values.loki.annotations }}
Expand Down Expand Up @@ -38,8 +38,8 @@ spec:
selector:
matchLabels:
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }}
name: ingester-zone-b
rollout-group: ingester
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-b
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
{{- with .Values.ingester.updateStrategy }}
updateStrategy:
{{- tpl (. | toYaml) $ | nindent 4 }}
Expand All @@ -60,8 +60,8 @@ spec:
labels:
{{- include "loki.ingesterSelectorLabels" . | nindent 8 }}
app.kubernetes.io/part-of: memberlist
name: ingester-zone-b
rollout-group: ingester
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-b
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
{{- with .Values.loki.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -164,11 +164,11 @@ spec:
- key: rollout-group
operator: In
values:
- ingester
- {{ include "loki.prefixRolloutGroup" . }}ingester
- key: name
operator: NotIn
values:
- ingester-zone-b
- {{ include "loki.prefixIngesterName" . }}ingester-zone-b
topologyKey: kubernetes.io/hostname
{{- with .Values.ingester.zoneAwareReplication.zoneB.extraAffinity }}
{{- toYaml . | nindent 8 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ metadata:
labels:
{{- include "loki.ingesterLabels" . | nindent 4 }}
app.kubernetes.io/part-of: memberlist
rollout-group: ingester
name: ingester-zone-c
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-c
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
annotations:
rollout-max-unavailable: "{{ include "loki.ingester.maxUnavailable" (dict "ctx" . "replicas" $replicas)}}"
{{- with .Values.loki.annotations }}
Expand Down Expand Up @@ -38,8 +38,8 @@ spec:
selector:
matchLabels:
{{- include "loki.ingesterSelectorLabels" . | nindent 6 }}
name: ingester-zone-c
rollout-group: ingester
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-c
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
{{- with .Values.ingester.updateStrategy }}
updateStrategy:
{{- tpl (. | toYaml) $ | nindent 4 }}
Expand All @@ -60,8 +60,8 @@ spec:
labels:
{{- include "loki.ingesterSelectorLabels" . | nindent 8 }}
app.kubernetes.io/part-of: memberlist
name: ingester-zone-c
rollout-group: ingester
name: {{ include "loki.prefixIngesterName" . }}ingester-zone-c
rollout-group: {{ include "loki.prefixRolloutGroup" . }}ingester
{{- with .Values.loki.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
Expand Down Expand Up @@ -164,11 +164,11 @@ spec:
- key: rollout-group
operator: In
values:
- ingester
- {{ include "loki.prefixIngesterName" . }}ingester

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line in statefulset-ingester-zone-c.yaml does not match the other files and should probably be

                      - {{ include "loki.prefixRolloutGroup" . }}ingester

- key: name
operator: NotIn
values:
- ingester-zone-c
- {{ include "loki.prefixIngesterName" . }}ingester-zone-c
topologyKey: kubernetes.io/hostname
{{- with .Values.ingester.zoneAwareReplication.zoneC.extraAffinity }}
{{- toYaml . | nindent 8 }}
Expand Down
6 changes: 6 additions & 0 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1893,6 +1893,12 @@ ingester:
excludeDefaultZone: false
readPath: false
writePath: false

# optionally allow adding arbitrary prefix to the ingester rollout-group label
rolloutGroupPrefix: null
# optionally allow adding 'loki-' prefix to ingester name label
addIngesterNamePrefix: false

# -- Configuration for the distributor
distributor:
# -- Number of replicas for the distributor
Expand Down
Loading