Skip to content

Commit

Permalink
Helm - Templatable host for gateway ingress/route (#7218)
Browse files Browse the repository at this point in the history
* feat: added host templating for gateway ingress

* feat: added host templating for gateway route

* fix: missing ctx ref

* Revert "fix: missing ctx ref"

This reverts commit cf956fb.

* fix: missing ctx ref

* ci: ran make build-helm-tests

* updated CHANGELOG.md

* fix: re-ordered changelog

* feat: added templating to global ingress

* fix: added templating to host rules

* docs: values.yaml examples

* test: rebuild tests according to examples

---------

Co-authored-by: Dimitar Dimitrov <dimitar.dimitrov@grafana.com>
  • Loading branch information
Itaykal and dimitarvdimitrov authored Feb 8, 2024
1 parent a7406fa commit 01d1d09
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 17 deletions.
1 change: 1 addition & 0 deletions operations/helm/charts/mimir-distributed/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Entries should include a reference to the Pull Request that introduced the chang
* [ENHANCEMENT] Query-frontend: configured `-shutdown-delay`, `-server.grpc.keepalive.max-connection-age` and termination grace period to reduce the likelihood of queries hitting terminated query-frontends. #7129
* [ENHANCEMENT] Add the possibility to create a dedicated serviceAccount for the `ruler` component by setting `ruler.serivceAcount.create` to true in the values. #7132
* [ENHANCEMENT] nginx, Gateway: set `proxy_http_version: 1.1` to proxy to HTTP 1.1. #5040
* [ENHANCEMENT] Gateway: make Ingress/Route host templateable. #7218
* [BUGFIX] Metamonitoring: update dashboards to drop unsupported `step` parameter in targets. #7157
* [ENHANCEMENT] Make the PSP template configurable via `rbac.podSecurityPolicy`. #7190

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
{{- range . }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
- {{ tpl . $ | quote }}
{{- end }}
{{- with .secretName }}
secretName: {{ . }}
Expand All @@ -28,7 +28,7 @@ spec:
{{- end }}
rules:
{{- range .Values.gateway.ingress.hosts }}
- host: {{ .host | quote }}
- host: {{ tpl .host $ | quote }}
http:
paths:
{{- range .paths }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
{{- end }}
namespace: {{ .Release.Namespace | quote }}
spec:
host: {{ .Values.gateway.route.host }}
host: {{ tpl .Values.gateway.route.host $ | quote }}
to:
kind: Service
name: {{ include "mimir.gateway.service.name" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
{{- range . }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
- {{ tpl . $ | quote }}
{{- end }}
{{- with .secretName }}
secretName: {{ . }}
Expand All @@ -28,7 +28,7 @@ spec:
{{- end }}
rules:
{{- range $.Values.ingress.hosts }}
- host: {{ . | quote }}
- host: {{ tpl . $ | quote }}
http:
paths:
{{- range $svcName, $paths := $.Values.ingress.paths }}
Expand Down
10 changes: 6 additions & 4 deletions operations/helm/charts/mimir-distributed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2753,24 +2753,26 @@ gateway:
annotations: {}
# -- Hosts configuration for the Ingress
hosts:
- host: mimir.example.com
# -- Passed through the `tpl` function to allow templating.
- host: '{{ .Release.Name }}.mimir.example.com'
paths:
- path: /
# -- pathType (e.g. ImplementationSpecific, Prefix, .. etc.) might also be required by some Ingress Controllers
# pathType: Prefix
# -- TLS configuration for the nginx ingress
tls:
- secretName: mimir-tls
# -- Hosts included in the tls certificate. Passed through the `tpl` function to allow templating.
hosts:
- mimir.example.com
- '{{ .Release.Name }}.mimir.example.com'

# -- OpenShift Route configuration
route:
enabled: false
# -- Annotations for the Route
annotations: {}

host: mimir.example.com
# -- Passed through the `tpl` function to allow templating.
host: '{{ .Release.Name }}.mimir.example.com'

tls:
# -- More details about TLS configuration and termination types: https://docs.openshift.com/container-platform/3.11/architecture/networking/routes.html#secured-routes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ metadata:
spec:
tls:
- hosts:
- "mimir.example.com"
- "gateway-enterprise-values.mimir.example.com"
secretName: mimir-tls
rules:
- host: "mimir.example.com"
- host: "gateway-enterprise-values.mimir.example.com"
http:
paths:
- path: /
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
app.kubernetes.io/managed-by: Helm
namespace: "citestns"
spec:
host: mimir.example.com
host: "gateway-enterprise-values.mimir.example.com"
to:
kind: Service
name: gateway-enterprise-values-mimir-gateway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ metadata:
spec:
tls:
- hosts:
- "mimir.example.com"
- "gateway-nginx-values.mimir.example.com"
secretName: mimir-tls
rules:
- host: "mimir.example.com"
- host: "gateway-nginx-values.mimir.example.com"
http:
paths:
- path: /
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ metadata:
app.kubernetes.io/managed-by: Helm
namespace: "citestns"
spec:
host: mimir.example.com
host: "gateway-nginx-values.mimir.example.com"
to:
kind: Service
name: gateway-nginx-values-mimir-gateway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ metadata:
spec:
tls:
- hosts:
- "mimir.example.com"
- "test-enterprise-values.mimir.example.com"
secretName: mimir-tls
rules:
- host: "mimir.example.com"
- host: "test-enterprise-values.mimir.example.com"
http:
paths:
- path: /
Expand Down

0 comments on commit 01d1d09

Please sign in to comment.