From 7cd4890fdac7afe0a156f49b114bad0bea0bb7a7 Mon Sep 17 00:00:00 2001 From: christianjedroCDT <100683342+christianjedroCDT@users.noreply.github.com> Date: Wed, 16 Aug 2023 11:55:51 +0200 Subject: [PATCH] helm: use tpl for ingress hosts (#10175) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **What this PR does / why we need it**: Use tpl for ingress hosts. Needed for values passed from globals in umbrella charts. We´re already using this in [Grafana Helm Chart](https://github.com/grafana/helm-charts/blob/d8a64071970b5928cf990dce480925ff6b8edb56/charts/grafana/templates/ingress.yaml#L37). **Which issue(s) this PR fixes**: Fixes # **Special notes for your reviewer**: **Checklist** - [x] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [x] Documentation added - [ ] Tests updated - [x] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/setup/upgrade/_index.md` - [x] For Helm chart changes bump the Helm chart version in `production/helm/loki/Chart.yaml` and update `production/helm/loki/CHANGELOG.md` and `production/helm/loki/README.md`. [Example PR](https://github.com/grafana/loki/commit/d10549e3ece02120974929894ee333d07755d213) --------- Co-authored-by: Michel Hollands <42814411+MichelHollands@users.noreply.github.com> --- docs/sources/setup/install/helm/reference.md | 16 +++++++++------- production/helm/loki/CHANGELOG.md | 4 ++++ production/helm/loki/Chart.yaml | 2 +- production/helm/loki/README.md | 2 +- .../loki/templates/gateway/ingress-gateway.yaml | 4 ++-- production/helm/loki/templates/ingress.yaml | 4 ++-- production/helm/loki/values.yaml | 6 ++++-- 7 files changed, 23 insertions(+), 15 deletions(-) diff --git a/docs/sources/setup/install/helm/reference.md b/docs/sources/setup/install/helm/reference.md index 76873897cd880..4b5da3dda702e 100644 --- a/docs/sources/setup/install/helm/reference.md +++ b/docs/sources/setup/install/helm/reference.md @@ -1094,7 +1094,7 @@ false gateway.ingress.hosts list - Hosts configuration for the gateway ingress + Hosts configuration for the gateway ingress, passed through the `tpl` function to allow templating
 [
   {
@@ -1130,7 +1130,7 @@ false
 		
 			gateway.ingress.tls
 			list
-			TLS configuration for the gateway ingress
+			TLS configuration for the gateway ingress. Hosts passed through the `tpl` function to allow templating
 			
 [
   {
@@ -1482,11 +1482,13 @@ false
 
 		
 		
-			ingress.hosts[0]
-			string
-			
+			ingress.hosts
+			list
+			Hosts configuration for the ingress, passed through the `tpl` function to allow templating
 			
-"loki.example.com"
+[
+  "loki.example.com"
+]
 
@@ -1673,7 +1675,7 @@ false ingress.tls list - + TLS configuration for the ingress. Hosts passed through the `tpl` function to allow templating
 []
 
diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md index 633f96e779789..6465686364195 100644 --- a/production/helm/loki/CHANGELOG.md +++ b/production/helm/loki/CHANGELOG.md @@ -13,6 +13,10 @@ Entries should include a reference to the pull request that introduced the chang [//]: # ( : 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.) +## 5.12.0 + +- [ENHANCEMENT] Use tpl function in ingress and gateway-ingress for hosts + ## 5.11.0 - [CHANGE] Changed version of Loki to 2.8.4 diff --git a/production/helm/loki/Chart.yaml b/production/helm/loki/Chart.yaml index b11291f5c033f..0d2f3fda43cd0 100644 --- a/production/helm/loki/Chart.yaml +++ b/production/helm/loki/Chart.yaml @@ -3,7 +3,7 @@ name: loki description: Helm chart for Grafana Loki in simple, scalable mode type: application appVersion: 2.8.4 -version: 5.11.0 +version: 5.12.0 home: https://grafana.github.io/helm-charts sources: - https://github.com/grafana/loki diff --git a/production/helm/loki/README.md b/production/helm/loki/README.md index 24c8f54572991..0f9c0b8f1627e 100644 --- a/production/helm/loki/README.md +++ b/production/helm/loki/README.md @@ -1,6 +1,6 @@ # loki -![Version: 5.11.0](https://img.shields.io/badge/Version-5.11.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.8.4](https://img.shields.io/badge/AppVersion-2.8.4-informational?style=flat-square) +![Version: 5.12.0](https://img.shields.io/badge/Version-5.12.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.8.4](https://img.shields.io/badge/AppVersion-2.8.4-informational?style=flat-square) Helm chart for Grafana Loki in simple, scalable mode diff --git a/production/helm/loki/templates/gateway/ingress-gateway.yaml b/production/helm/loki/templates/gateway/ingress-gateway.yaml index 44885f6bba90b..6f18e3396f009 100644 --- a/production/helm/loki/templates/gateway/ingress-gateway.yaml +++ b/production/helm/loki/templates/gateway/ingress-gateway.yaml @@ -26,7 +26,7 @@ spec: {{- range .Values.gateway.ingress.tls }} - hosts: {{- range .hosts }} - - {{ . | quote }} + - {{ tpl . $ | quote }} {{- end }} {{- with .secretName }} secretName: {{ . }} @@ -35,7 +35,7 @@ spec: {{- end }} rules: {{- range .Values.gateway.ingress.hosts }} - - host: {{ .host | quote }} + - host: {{ tpl .host $ | quote }} http: paths: {{- range .paths }} diff --git a/production/helm/loki/templates/ingress.yaml b/production/helm/loki/templates/ingress.yaml index d4c2a09356fe7..ddbcf7fdb618a 100644 --- a/production/helm/loki/templates/ingress.yaml +++ b/production/helm/loki/templates/ingress.yaml @@ -23,7 +23,7 @@ spec: {{- range .Values.ingress.tls }} - hosts: {{- range .hosts }} - - {{ . | quote }} + - {{ tpl . $ | quote }} {{- end }} {{- with .secretName }} secretName: {{ . }} @@ -32,7 +32,7 @@ spec: {{- end }} rules: {{- range $.Values.ingress.hosts }} - - host: {{ . | quote }} + - host: {{ tpl . $ | quote }} http: paths: {{- include "loki.ingress.servicePaths" $ | indent 10}} diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index a99bf96b6b093..4c09000e2e36b 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -1152,8 +1152,10 @@ ingress: - /loki/api/v1/rules - /prometheus/api/v1/rules - /prometheus/api/v1/alerts + # -- Hosts configuration for the ingress, passed through the `tpl` function to allow templating hosts: - loki.example.com + # -- TLS configuration for the ingress. Hosts passed through the `tpl` function to allow templating tls: [] # - hosts: # - loki.example.com @@ -1287,14 +1289,14 @@ gateway: annotations: {} # -- Labels for the gateway ingress labels: {} - # -- Hosts configuration for the gateway ingress + # -- Hosts configuration for the gateway ingress, passed through the `tpl` function to allow templating hosts: - host: gateway.loki.example.com paths: - path: / # -- pathType (e.g. ImplementationSpecific, Prefix, .. etc.) might also be required by some Ingress Controllers # pathType: Prefix - # -- TLS configuration for the gateway ingress + # -- TLS configuration for the gateway ingress. Hosts passed through the `tpl` function to allow templating tls: - secretName: loki-gateway-tls hosts: