Skip to content

Commit d10549e

Browse files
helm: release a new helm charts to use k8s service for discover query-scheduler replicas (#9477)
**What this PR does / why we need it**: Currently, we have a bug in our code when running Loki in SSD mode and using the ring for query-scheduler discovery. It causes queries to not be distributed to all the available read pods. I have explained the issue in detail in [the PR which fixes the code](#9471). Since this bug causes a major query performance impact and code release might take time, in this PR we are doing a new helm release which fixes the issue by using the k8s service for discovering `query-scheduler` replicas. **Which issue(s) this PR fixes**: Fixes #9195
1 parent aeba51a commit d10549e

File tree

7 files changed

+73
-2
lines changed

7 files changed

+73
-2
lines changed

‎docs/sources/installation/helm/reference.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,24 @@ true
17071707
<td><pre lang="json">
17081708
{}
17091709
</pre>
1710+
</td>
1711+
</tr>
1712+
<tr>
1713+
<td>loki.frontend.scheduler_address</td>
1714+
<td>string</td>
1715+
<td></td>
1716+
<td><pre lang="json">
1717+
"{{ include \"loki.querySchedulerAddress\" . }}"
1718+
</pre>
1719+
</td>
1720+
</tr>
1721+
<tr>
1722+
<td>loki.frontend_worker.scheduler_address</td>
1723+
<td>string</td>
1724+
<td></td>
1725+
<td><pre lang="json">
1726+
"{{ include \"loki.querySchedulerAddress\" . }}"
1727+
</pre>
17101728
</td>
17111729
</tr>
17121730
<tr>

‎production/helm/loki/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Entries should include a reference to the pull request that introduced the chang
1515

1616
- [CHANGE] Add clusterLabelOverride for alert label overrides.
1717

18+
## 5.5.3
19+
20+
- [BUGFIX] Fix issue in distribution of queries to available read pods by using k8s service for discovering query-scheduler replicas
21+
1822
## 5.5.2
1923

2024
- [BUGFIX] Use $.Release.Namespace consistently

‎production/helm/loki/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: loki
33
description: Helm chart for Grafana Loki in simple, scalable mode
44
type: application
55
appVersion: 2.8.2
6-
version: 5.5.2
6+
version: 5.5.3
77
home: https://grafana.github.io/helm-charts
88
sources:
99
- https://github.com/grafana/loki

‎production/helm/loki/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# loki
22

3-
![Version: 5.5.2](https://img.shields.io/badge/Version-5.5.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.8.2](https://img.shields.io/badge/AppVersion-2.8.2-informational?style=flat-square)
3+
![Version: 5.5.3](https://img.shields.io/badge/Version-5.5.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.8.2](https://img.shields.io/badge/AppVersion-2.8.2-informational?style=flat-square)
44

55
Helm chart for Grafana Loki in simple, scalable mode
66

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,3 +762,12 @@ enableServiceLinks: false
762762
{{- printf "%s" $compactorAddress }}
763763
{{- end }}
764764

765+
{{/* Determine query-scheduler address */}}
766+
{{- define "loki.querySchedulerAddress" -}}
767+
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
768+
{{- $schedulerAddress := ""}}
769+
{{- if and $isSimpleScalable (not .Values.read.legacyReadTarget ) -}}
770+
{{- $schedulerAddress = printf "query-scheduler-discovery.%s.svc.%s.:9095" .Release.Namespace .Values.global.clusterDomain -}}
771+
{{- end -}}
772+
{{- printf "%s" $schedulerAddress }}
773+
{{- end }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
2+
{{- if and $isSimpleScalable (not .Values.read.legacyReadTarget ) }}
3+
---
4+
apiVersion: v1
5+
kind: Service
6+
metadata:
7+
name: query-scheduler-discovery
8+
labels:
9+
{{- include "loki.backendSelectorLabels" . | nindent 4 }}
10+
prometheus.io/service-monitor: "false"
11+
spec:
12+
type: ClusterIP
13+
clusterIP: None
14+
publishNotReadyAddresses: true
15+
ports:
16+
- name: http-metrics
17+
port: 3100
18+
targetPort: http-metrics
19+
protocol: TCP
20+
- name: grpc
21+
port: 9095
22+
targetPort: grpc
23+
protocol: TCP
24+
selector:
25+
{{- include "loki.backendSelectorLabels" . | nindent 4 }}
26+
{{- end }}

‎production/helm/loki/values.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ loki:
207207
index_gateway:
208208
{{- tpl (. | toYaml) $ | nindent 4 }}
209209
{{- end }}
210+
211+
{{- with .Values.loki.frontend }}
212+
frontend:
213+
{{- tpl (. | toYaml) $ | nindent 4 }}
214+
{{- end }}
215+
216+
{{- with .Values.loki.frontend_worker }}
217+
frontend_worker:
218+
{{- tpl (. | toYaml) $ | nindent 4 }}
219+
{{- end }}
210220
# Should authentication be enabled
211221
auth_enabled: true
212222
# Extra memberlist configuration
@@ -302,6 +312,10 @@ loki:
302312
# -- Optional index gateway configuration
303313
index_gateway:
304314
mode: ring
315+
frontend:
316+
scheduler_address: '{{ include "loki.querySchedulerAddress" . }}'
317+
frontend_worker:
318+
scheduler_address: '{{ include "loki.querySchedulerAddress" . }}'
305319
enterprise:
306320
# Enable enterprise features, license must be provided
307321
enabled: false

0 commit comments

Comments
 (0)