diff --git a/docs/sources/installation/helm/reference.md b/docs/sources/installation/helm/reference.md index dbb3bc95a7..a8836f1bf7 100644 --- a/docs/sources/installation/helm/reference.md +++ b/docs/sources/installation/helm/reference.md @@ -1013,6 +1013,33 @@ false
 {}
 
+ + + + gateway.nginxConfig.customBackendUrl + string + Override Backend URL +
+null
+
+ + + + gateway.nginxConfig.customReadUrl + string + Override Read URL +
+null
+
+ + + + gateway.nginxConfig.customWriteUrl + string + Override Write URL +
+null
+
diff --git a/production/helm/loki/CHANGELOG.md b/production/helm/loki/CHANGELOG.md index 44b7064b32..54919cbe57 100644 --- a/production/helm/loki/CHANGELOG.md +++ b/production/helm/loki/CHANGELOG.md @@ -13,6 +13,8 @@ Entries should include a reference to the pull request that introduced the chang [//]: # ( : do not remove this line. Add your changelog bellow this line. This locator is used by CI pipeline to find the place where to put changelog entry.) +- [FEATURE] add `gateway.nginxConfig.customReadUrl`, `gateway.nginxConfig.customWriteUrl` and `gateway.nginxConfig.customBackendUrl` to override read/write/backend paths. + ## 4.5.1 - [BUGFIX] Fix rendering of namespace in provisioner job. diff --git a/production/helm/loki/templates/_helpers.tpl b/production/helm/loki/templates/_helpers.tpl index af5291fc79..bf1a08dfb6 100644 --- a/production/helm/loki/templates/_helpers.tpl +++ b/production/helm/loki/templates/_helpers.tpl @@ -588,73 +588,87 @@ http { {{- $writeHost = include "loki.singleBinaryFullname" .}} {{- end }} + {{- $writeUrl := printf "http://%s.%s.svc.%s:3100" $writeHost .Release.Namespace .Values.global.clusterDomain }} + {{- $readUrl := printf "http://%s.%s.svc.%s:3100" $readHost .Release.Namespace .Values.global.clusterDomain }} + {{- $backendUrl := printf "http://%s.%s.svc.%s:3100" $backendHost .Release.Namespace .Values.global.clusterDomain }} + + {{- if .Values.gateway.nginxConfig.customWriteUrl }} + {{- $writeUrl = .Values.gateway.nginxConfig.customWriteUrl }} + {{- end }} + {{- if .Values.gateway.nginxConfig.customReadUrl }} + {{- $readUrl = .Values.gateway.nginxConfig.customReadUrl }} + {{- end }} + {{- if .Values.gateway.nginxConfig.customBackendUrl }} + {{- $backendUrl = .Values.gateway.nginxConfig.customBackendUrl }} + {{- end }} + location = /api/prom/push { - proxy_pass http://{{ $writeHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $writeUrl }}$request_uri; } location = /api/prom/tail { - proxy_pass http://{{ $readHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $readUrl }}$request_uri; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location ~ /api/prom/.* { - proxy_pass http://{{ $readHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $readUrl }}$request_uri; } location ~ /prometheus/api/v1/alerts.* { - proxy_pass http://{{ $backendHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $backendUrl }}$request_uri; } location ~ /prometheus/api/v1/rules.* { - proxy_pass http://{{ $backendHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $backendUrl }}$request_uri; } location ~ /ruler/.* { - proxy_pass http://{{ $backendHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $backendUrl }}$request_uri; } location = /loki/api/v1/push { - proxy_pass http://{{ $writeHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $writeUrl }}$request_uri; } location = /loki/api/v1/tail { - proxy_pass http://{{ $readHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $readUrl }}$request_uri; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location ~ /compactor/.* { - proxy_pass http://{{ $backendHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $backendUrl }}$request_uri; } location ~ /distributor/.* { - proxy_pass http://{{ $writeHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $writeUrl }}$request_uri; } location ~ /ring { - proxy_pass http://{{ $writeHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $writeUrl }}$request_uri; } location ~ /ingester/.* { - proxy_pass http://{{ $writeHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $writeUrl }}$request_uri; } location ~ /store-gateway/.* { - proxy_pass http://{{ $backendHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $backendUrl }}$request_uri; } location ~ /query-scheduler/.* { - proxy_pass http://{{ $backendHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $backendUrl }}$request_uri; } location ~ /scheduler/.* { - proxy_pass http://{{ $backendHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $backendUrl }}$request_uri; } location ~ /loki/api/.* { - proxy_pass http://{{ $readHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $readUrl }}$request_uri; } location ~ /admin/api/.* { - proxy_pass http://{{ $writeHost }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:3100$request_uri; + proxy_pass {{ $writeUrl }}$request_uri; } {{- with .Values.gateway.nginxConfig.serverSnippet }} diff --git a/production/helm/loki/values.yaml b/production/helm/loki/values.yaml index 6058d18983..2eb05cd2ba 100644 --- a/production/helm/loki/values.yaml +++ b/production/helm/loki/values.yaml @@ -1197,6 +1197,12 @@ gateway: serverSnippet: "" # -- Allows appending custom configuration to the http block httpSnippet: "" + # -- Override Read URL + customReadUrl: null + # -- Override Write URL + customWriteUrl: null + # -- Override Backend URL + customBackendUrl: null # -- Config file contents for Nginx. Passed through the `tpl` function to allow templating # @default -- See values.yaml file: |