helm: values to override read/write/backend paths in gateway config (#8490)

**What this PR does / why we need it**:
Add configurations to override the generated read/write/backend URLs for the gateway.

**Which issue(s) this PR fixes**:
Fixes #8488
pull/8502/head^2
Hervé Nicol 3 years ago committed by GitHub
parent d1d47b2fb2
commit f4119de4df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      docs/sources/installation/helm/reference.md
  2. 2
      production/helm/loki/CHANGELOG.md
  3. 48
      production/helm/loki/templates/_helpers.tpl
  4. 6
      production/helm/loki/values.yaml

@ -1013,6 +1013,33 @@ false
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>gateway.nginxConfig.customBackendUrl</td>
<td>string</td>
<td>Override Backend URL</td>
<td><pre lang="json">
null
</pre>
</td>
</tr>
<tr>
<td>gateway.nginxConfig.customReadUrl</td>
<td>string</td>
<td>Override Read URL</td>
<td><pre lang="json">
null
</pre>
</td>
</tr>
<tr>
<td>gateway.nginxConfig.customWriteUrl</td>
<td>string</td>
<td>Override Write URL</td>
<td><pre lang="json">
null
</pre>
</td>
</tr>
<tr>

@ -13,6 +13,8 @@ Entries should include a reference to the pull request that introduced the chang
[//]: # (<AUTOMATED_UPDATES_LOCATOR> : 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.

@ -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 }}

@ -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: |

Loading…
Cancel
Save