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

feat: add Gateway API Route CR to loki-gateway #16799

Open
wants to merge 2 commits 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
56 changes: 56 additions & 0 deletions docs/sources/setup/install/helm/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -4497,6 +4497,62 @@ null
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>gateway.route</td>
<td>object</td>
<td>Gateway API Routes configuration</td>
<td><pre lang="json">
{
"main": {
"additionalRules": [],
"annotations": {},
"apiVersion": "gateway.networking.k8s.io/v1",
"enabled": false,
"filters": [],
"hostnames": [],
"kind": "HTTPRoute",
"labels": {},
"matches": [
{
"path": {
"type": "PathPrefix",
"value": "/"
}
}
],
"parentRefs": []
}
}
</pre>
</td>
</tr>
<tr>
<td>gateway.route.main.apiVersion</td>
<td>string</td>
<td>Set the route apiVersion, e.g. gateway.networking.k8s.io/v1 or gateway.networking.k8s.io/v1alpha2</td>
<td><pre lang="json">
"gateway.networking.k8s.io/v1"
</pre>
</td>
</tr>
<tr>
<td>gateway.route.main.enabled</td>
<td>bool</td>
<td>Enables or disables the route</td>
<td><pre lang="json">
false
</pre>
</td>
</tr>
<tr>
<td>gateway.route.main.kind</td>
<td>string</td>
<td>Set the route kind Valid options are GRPCRoute, HTTPRoute, TCPRoute, TLSRoute, UDPRoute</td>
<td><pre lang="json">
"HTTPRoute"
</pre>
</td>
</tr>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ 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.)

- [FEATURE] Add Gateway API Route CR support for Loki Gateway

- [BUGFIX] Inadvertent merge() accumulation of podLabels on various resources

## 6.29.0

- [FEATURE] Added support to copy the following headers into X-Query-Tags as key/value pairs:, X-Grafana-User, X-Dashboard-Uid, X-Dashboard-Title, X-Panel-Id, X-Panel-Title, X-Rule-Uid, X-Rule-Name, X-Rule-Folder, X-Rule-Version, X-Rule-Source, X-Rule-Type


## 6.28.0

- [CHANGE] Add extraContainers parameter for the backend pod
Expand Down
45 changes: 45 additions & 0 deletions production/helm/loki/templates/gateway/route-gateway.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{- if .Values.gateway.enabled -}}
{{- range $name, $route := .Values.gateway.route }}
{{- if $route.enabled -}}
---
apiVersion: {{ $route.apiVersion | default "gateway.networking.k8s.io/v1" }}
kind: {{ $route.kind | default "HTTPRoute" }}
metadata:
name: {{ include "loki.gatewayFullname" $ }}{{ if ne $name "main" }}-{{ $name }}{{ end }}
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki.gatewayLabels" $ | nindent 4 }}
{{- with $route.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $route.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with $route.parentRefs }}
parentRefs:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $route.hostnames }}
hostnames:
{{- tpl (toYaml .) $ | nindent 4 }}
{{- end }}
rules:
{{- if $route.additionalRules }}
{{- tpl (toYaml $route.additionalRules) $ | nindent 4 }}
{{- end }}
- backendRefs:
- name: {{ include "loki.gatewayFullname" $ }}
port: {{ $.Values.service.port }}
{{- with $route.filters }}
filters:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $route.matches }}
matches:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
30 changes: 30 additions & 0 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,36 @@ gateway:
- secretName: loki-gateway-tls
hosts:
- gateway.loki.example.com
# -- Gateway API Routes configuration
route:
main:
# -- Enables or disables the route
enabled: false

# -- Set the route apiVersion, e.g. gateway.networking.k8s.io/v1 or gateway.networking.k8s.io/v1alpha2
apiVersion: gateway.networking.k8s.io/v1
# -- Set the route kind
# Valid options are GRPCRoute, HTTPRoute, TCPRoute, TLSRoute, UDPRoute
kind: HTTPRoute

annotations: {}
labels: {}

hostnames: []
# - my-filter.example.com
parentRefs: []
# - name: acme-gw

matches:
- path:
type: PathPrefix
value: /

## Filters define the filters that are applied to requests that match this rule.
filters: []

## Additional custom rules that can be added to the route
additionalRules: []
# Basic auth configuration
basicAuth:
# -- Enables basic authentication for the gateway
Expand Down