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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions production/helm/loki/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Entries should include a reference to the pull request that introduced the chang

[//]: # (<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.)

## 6.20.1
- [BUGFIX] Optionally allow prefixing in Ingester rollout-group labels with user defined string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do not add your own version. See the comment above, we'll automatically add the version for all unreleased features in the weekly release.

- [BUGFIX] Optionally allow prefixing Ingester StatefulSet name to avoid __ with rollout-operator

## 6.20.0

- [CHANGE] Changed version of Grafana Loki to 3.3.0
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: loki
description: Helm chart for Grafana Loki and Grafana Enterprise Logs supporting both simple, scalable and distributed modes.
type: application
appVersion: 3.3.0
version: 6.21.0
version: 6.21.1
home: https://grafana.github.io/helm-charts
sources:
- https://github.com/grafana/loki
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
- 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 @@ -1891,6 +1891,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