Skip to content

Commit 5ada92b

Browse files
fix(helm): fixed ingress paths mapping (#12932)
1 parent cb1f5d9 commit 5ada92b

File tree

6 files changed

+165
-54
lines changed

6 files changed

+165
-54
lines changed

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

+79-15
Original file line numberDiff line numberDiff line change
@@ -5086,29 +5086,37 @@ null
50865086
"ingressClassName": "",
50875087
"labels": {},
50885088
"paths": {
5089-
"read": [
5090-
"/api/prom/tail",
5091-
"/loki/api/v1/tail",
5092-
"/loki/api",
5093-
"/api/prom/rules",
5094-
"/loki/api/v1/rules",
5095-
"/prometheus/api/v1/rules",
5096-
"/prometheus/api/v1/alerts"
5097-
],
5098-
"singleBinary": [
5089+
"distributor": [
50995090
"/api/prom/push",
51005091
"/loki/api/v1/push",
5092+
"/otlp/v1/logs"
5093+
],
5094+
"queryFrontend": [
5095+
"/api/prom/query",
5096+
"/api/prom/label",
5097+
"/api/prom/series",
51015098
"/api/prom/tail",
5099+
"/loki/api/v1/query",
5100+
"/loki/api/v1/query_range",
51025101
"/loki/api/v1/tail",
5103-
"/loki/api",
5102+
"/loki/api/v1/label",
5103+
"/loki/api/v1/labels",
5104+
"/loki/api/v1/series",
5105+
"/loki/api/v1/index/stats",
5106+
"/loki/api/v1/index/volume",
5107+
"/loki/api/v1/index/volume_range",
5108+
"/loki/api/v1/format_query",
5109+
"/loki/api/v1/detected_fields",
5110+
"/loki/api/v1/detected_labels",
5111+
"/loki/api/v1/patterns"
5112+
],
5113+
"ruler": [
51045114
"/api/prom/rules",
5115+
"/api/prom/api/v1/rules",
5116+
"/api/prom/api/v1/alerts",
51055117
"/loki/api/v1/rules",
51065118
"/prometheus/api/v1/rules",
51075119
"/prometheus/api/v1/alerts"
5108-
],
5109-
"write": [
5110-
"/api/prom/push",
5111-
"/loki/api/v1/push"
51125120
]
51135121
},
51145122
"tls": []
@@ -5125,6 +5133,62 @@ null
51255133
"loki.example.com"
51265134
]
51275135
</pre>
5136+
</td>
5137+
</tr>
5138+
<tr>
5139+
<td>ingress.paths.distributor</td>
5140+
<td>list</td>
5141+
<td>Paths that are exposed by Loki Distributor. If deployment mode is Distributed, the requests are forwarded to the service: `{{"loki.distributorFullname"}}`. If deployment mode is SimpleScalable, the requests are forwarded to write k8s service: `{{"loki.writeFullname"}}`. If deployment mode is SingleBinary, the requests are forwarded to the central/single k8s service: `{{"loki.singleBinaryFullname"}}`</td>
5142+
<td><pre lang="json">
5143+
[
5144+
"/api/prom/push",
5145+
"/loki/api/v1/push",
5146+
"/otlp/v1/logs"
5147+
]
5148+
</pre>
5149+
</td>
5150+
</tr>
5151+
<tr>
5152+
<td>ingress.paths.queryFrontend</td>
5153+
<td>list</td>
5154+
<td>Paths that are exposed by Loki Query Frontend. If deployment mode is Distributed, the requests are forwarded to the service: `{{"loki.queryFrontendFullname"}}`. If deployment mode is SimpleScalable, the requests are forwarded to write k8s service: `{{"loki.readFullname"}}`. If deployment mode is SingleBinary, the requests are forwarded to the central/single k8s service: `{{"loki.singleBinaryFullname"}}`</td>
5155+
<td><pre lang="json">
5156+
[
5157+
"/api/prom/query",
5158+
"/api/prom/label",
5159+
"/api/prom/series",
5160+
"/api/prom/tail",
5161+
"/loki/api/v1/query",
5162+
"/loki/api/v1/query_range",
5163+
"/loki/api/v1/tail",
5164+
"/loki/api/v1/label",
5165+
"/loki/api/v1/labels",
5166+
"/loki/api/v1/series",
5167+
"/loki/api/v1/index/stats",
5168+
"/loki/api/v1/index/volume",
5169+
"/loki/api/v1/index/volume_range",
5170+
"/loki/api/v1/format_query",
5171+
"/loki/api/v1/detected_fields",
5172+
"/loki/api/v1/detected_labels",
5173+
"/loki/api/v1/patterns"
5174+
]
5175+
</pre>
5176+
</td>
5177+
</tr>
5178+
<tr>
5179+
<td>ingress.paths.ruler</td>
5180+
<td>list</td>
5181+
<td>Paths that are exposed by Loki Ruler. If deployment mode is Distributed, the requests are forwarded to the service: `{{"loki.rulerFullname"}}`. If deployment mode is SimpleScalable, the requests are forwarded to k8s service: `{{"loki.backendFullname"}}`. If deployment mode is SimpleScalable but `read.legacyReadTarget` is `true`, the requests are forwarded to k8s service: `{{"loki.readFullname"}}`. If deployment mode is SingleBinary, the requests are forwarded to the central/single k8s service: `{{"loki.singleBinaryFullname"}}`</td>
5182+
<td><pre lang="json">
5183+
[
5184+
"/api/prom/rules",
5185+
"/api/prom/api/v1/rules",
5186+
"/api/prom/api/v1/alerts",
5187+
"/loki/api/v1/rules",
5188+
"/prometheus/api/v1/rules",
5189+
"/prometheus/api/v1/alerts"
5190+
]
5191+
</pre>
51285192
</td>
51295193
</tr>
51305194
<tr>

production/helm/loki/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ 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+
## 6.5.2
17+
18+
- [BUGFIX] Fixed Ingress routing for all deployment modes.
19+
1620
## 6.5.0
1721

1822
- [CHANGE] Changed version of Grafana Enterprise Logs to v3.0.1

production/helm/loki/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: loki
33
description: Helm chart for Grafana Loki and Grafana Enterprise Logs supporting both simple, scalable and distributed modes.
44
type: application
55
appVersion: 3.0.0
6-
version: 6.5.1
6+
version: 6.5.2
77
home: https://grafana.github.io/helm-charts
88
sources:
99
- https://github.com/grafana/loki

production/helm/loki/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# loki
22

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

55
Helm chart for Grafana Loki and Grafana Enterprise Logs supporting both simple, scalable and distributed modes.
66

production/helm/loki/templates/_helpers.tpl

+44-24
Original file line numberDiff line numberDiff line change
@@ -607,33 +607,68 @@ Return if ingress supports pathType.
607607
Generate list of ingress service paths based on deployment type
608608
*/}}
609609
{{- define "loki.ingress.servicePaths" -}}
610-
{{- if (eq (include "loki.deployment.isScalable" .) "true") -}}
610+
{{- if (eq (include "loki.deployment.isSingleBinary" .) "true") -}}
611+
{{- include "loki.ingress.singleBinaryServicePaths" . }}
612+
{{- else if (eq (include "loki.deployment.isDistributed" .) "true") -}}
613+
{{- include "loki.ingress.distributedServicePaths" . }}
614+
{{- else if and (eq (include "loki.deployment.isScalable" .) "true") (not .Values.read.legacyReadTarget ) -}}
611615
{{- include "loki.ingress.scalableServicePaths" . }}
612616
{{- else -}}
613-
{{- include "loki.ingress.singleBinaryServicePaths" . }}
617+
{{- include "loki.ingress.legacyScalableServicePaths" . }}
618+
{{- end -}}
614619
{{- end -}}
620+
621+
622+
{{/*
623+
Ingress service paths for distributed deployment
624+
*/}}
625+
{{- define "loki.ingress.distributedServicePaths" -}}
626+
{{- $distributorServiceName := include "loki.distributorFullname" . }}
627+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $distributorServiceName "paths" .Values.ingress.paths.distributor )}}
628+
{{- $queryFrontendServiceName := include "loki.queryFrontendFullname" . }}
629+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $queryFrontendServiceName "paths" .Values.ingress.paths.queryFrontend )}}
630+
{{- $rulerServiceName := include "loki.rulerFullname" . }}
631+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $rulerServiceName "paths" .Values.ingress.paths.ruler)}}
615632
{{- end -}}
616633

617634
{{/*
618-
Ingress service paths for scalable deployment
635+
Ingress service paths for legacy simple scalable deployment when backend components were part of read component.
619636
*/}}
620637
{{- define "loki.ingress.scalableServicePaths" -}}
621-
{{- include "loki.ingress.servicePath" (dict "ctx" . "svcName" "read" "paths" .Values.ingress.paths.read )}}
622-
{{- include "loki.ingress.servicePath" (dict "ctx" . "svcName" "write" "paths" .Values.ingress.paths.write )}}
638+
{{- $readServiceName := include "loki.readFullname" . }}
639+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $readServiceName "paths" .Values.ingress.paths.queryFrontend )}}
640+
{{- $writeServiceName := include "loki.writeFullname" . }}
641+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $writeServiceName "paths" .Values.ingress.paths.distributor )}}
642+
{{- $backendServiceName := include "loki.backendFullname" . }}
643+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $backendServiceName "paths" .Values.ingress.paths.ruler )}}
644+
{{- end -}}
645+
646+
{{/*
647+
Ingress service paths for legacy simple scalable deployment
648+
*/}}
649+
{{- define "loki.ingress.legacyScalableServicePaths" -}}
650+
{{- $readServiceName := include "loki.readFullname" . }}
651+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $readServiceName "paths" .Values.ingress.paths.queryFrontend )}}
652+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $readServiceName "paths" .Values.ingress.paths.ruler )}}
653+
{{- $writeServiceName := include "loki.writeFullname" . }}
654+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $writeServiceName "paths" .Values.ingress.paths.distributor )}}
623655
{{- end -}}
624656

625657
{{/*
626658
Ingress service paths for single binary deployment
627659
*/}}
628660
{{- define "loki.ingress.singleBinaryServicePaths" -}}
629-
{{- include "loki.ingress.servicePath" (dict "ctx" . "svcName" "singleBinary" "paths" .Values.ingress.paths.singleBinary )}}
661+
{{- $serviceName := include "loki.singleBinaryFullname" . }}
662+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $serviceName "paths" .Values.ingress.paths.distributor )}}
663+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $serviceName "paths" .Values.ingress.paths.queryFrontend )}}
664+
{{- include "loki.ingress.servicePath" (dict "ctx" . "serviceName" $serviceName "paths" .Values.ingress.paths.ruler )}}
630665
{{- end -}}
631666

632667
{{/*
633668
Ingress service path helper function
634669
Params:
635670
ctx = . context
636-
svcName = service name without the "loki.fullname" part (ie. read, write)
671+
serviceName = fully qualified k8s service name
637672
paths = list of url paths to allow ingress for
638673
*/}}
639674
{{- define "loki.ingress.servicePath" -}}
@@ -645,33 +680,18 @@ Params:
645680
pathType: Prefix
646681
{{- end }}
647682
backend:
648-
{{- $serviceName := include "loki.ingress.serviceName" (dict "ctx" $.ctx "svcName" $.svcName) }}
649683
{{- if $ingressApiIsStable }}
650684
service:
651-
name: {{ $serviceName }}
685+
name: {{ $.serviceName }}
652686
port:
653687
number: {{ $.ctx.Values.loki.server.http_listen_port }}
654688
{{- else }}
655-
serviceName: {{ $serviceName }}
689+
serviceName: {{ $.serviceName }}
656690
servicePort: {{ $.ctx.Values.loki.server.http_listen_port }}
657691
{{- end -}}
658692
{{- end -}}
659693
{{- end -}}
660694

661-
{{/*
662-
Ingress service name helper function
663-
Params:
664-
ctx = . context
665-
svcName = service name without the "loki.fullname" part (ie. read, write)
666-
*/}}
667-
{{- define "loki.ingress.serviceName" -}}
668-
{{- if (eq .svcName "singleBinary") }}
669-
{{- printf "%s" (include "loki.singleBinaryFullname" .ctx) }}
670-
{{- else }}
671-
{{- printf "%s-%s" (include "loki.name" .ctx) .svcName }}
672-
{{- end -}}
673-
{{- end -}}
674-
675695
{{/*
676696
Create the service endpoint including port for MinIO.
677697
*/}}

production/helm/loki/values.yaml

+36-13
Original file line numberDiff line numberDiff line change
@@ -1131,24 +1131,47 @@ ingress:
11311131
labels: {}
11321132
# blackbox.monitoring.exclude: "true"
11331133
paths:
1134-
write:
1135-
- /api/prom/push
1136-
- /loki/api/v1/push
1137-
read:
1138-
- /api/prom/tail
1139-
- /loki/api/v1/tail
1140-
- /loki/api
1141-
- /api/prom/rules
1142-
- /loki/api/v1/rules
1143-
- /prometheus/api/v1/rules
1144-
- /prometheus/api/v1/alerts
1145-
singleBinary:
1134+
# -- Paths that are exposed by Loki Distributor.
1135+
# If deployment mode is Distributed, the requests are forwarded to the service: `{{"loki.distributorFullname"}}`.
1136+
# If deployment mode is SimpleScalable, the requests are forwarded to write k8s service: `{{"loki.writeFullname"}}`.
1137+
# If deployment mode is SingleBinary, the requests are forwarded to the central/single k8s service: `{{"loki.singleBinaryFullname"}}`
1138+
distributor:
11461139
- /api/prom/push
11471140
- /loki/api/v1/push
1141+
- /otlp/v1/logs
1142+
# -- Paths that are exposed by Loki Query Frontend.
1143+
# If deployment mode is Distributed, the requests are forwarded to the service: `{{"loki.queryFrontendFullname"}}`.
1144+
# If deployment mode is SimpleScalable, the requests are forwarded to write k8s service: `{{"loki.readFullname"}}`.
1145+
# If deployment mode is SingleBinary, the requests are forwarded to the central/single k8s service: `{{"loki.singleBinaryFullname"}}`
1146+
queryFrontend:
1147+
- /api/prom/query
1148+
# this path covers labels and labelValues endpoints
1149+
- /api/prom/label
1150+
- /api/prom/series
11481151
- /api/prom/tail
1152+
- /loki/api/v1/query
1153+
- /loki/api/v1/query_range
11491154
- /loki/api/v1/tail
1150-
- /loki/api
1155+
# this path covers labels and labelValues endpoints
1156+
- /loki/api/v1/label
1157+
- /loki/api/v1/labels
1158+
- /loki/api/v1/series
1159+
- /loki/api/v1/index/stats
1160+
- /loki/api/v1/index/volume
1161+
- /loki/api/v1/index/volume_range
1162+
- /loki/api/v1/format_query
1163+
- /loki/api/v1/detected_fields
1164+
- /loki/api/v1/detected_labels
1165+
- /loki/api/v1/patterns
1166+
# -- Paths that are exposed by Loki Ruler.
1167+
# If deployment mode is Distributed, the requests are forwarded to the service: `{{"loki.rulerFullname"}}`.
1168+
# If deployment mode is SimpleScalable, the requests are forwarded to k8s service: `{{"loki.backendFullname"}}`.
1169+
# If deployment mode is SimpleScalable but `read.legacyReadTarget` is `true`, the requests are forwarded to k8s service: `{{"loki.readFullname"}}`.
1170+
# If deployment mode is SingleBinary, the requests are forwarded to the central/single k8s service: `{{"loki.singleBinaryFullname"}}`
1171+
ruler:
11511172
- /api/prom/rules
1173+
- /api/prom/api/v1/rules
1174+
- /api/prom/api/v1/alerts
11521175
- /loki/api/v1/rules
11531176
- /prometheus/api/v1/rules
11541177
- /prometheus/api/v1/alerts

0 commit comments

Comments
 (0)