From e0fb7815355a7e21348fa16ce8ee9a3b13829506 Mon Sep 17 00:00:00 2001 From: Zadjad Rezai <121857296+zadjadr@users.noreply.github.com> Date: Tue, 3 Jun 2025 13:47:19 +0200 Subject: [PATCH] Allow setting WEBUI_URL manually We use a redirect in our setup, which means the ingress host is different then the WEBUI_URL. This change allows to set the WEBUI_URL either manually via extraenv or via ingress.host --- charts/open-webui/templates/_helpers.tpl | 19 ++++++++++++++----- .../templates/workload-manager.yaml | 10 ++++++++-- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/charts/open-webui/templates/_helpers.tpl b/charts/open-webui/templates/_helpers.tpl index 9fde487..57fb40f 100644 --- a/charts/open-webui/templates/_helpers.tpl +++ b/charts/open-webui/templates/_helpers.tpl @@ -239,9 +239,18 @@ Constructs a string containing the URLs of the Open WebUI based on the ingress c used to populate the variable WEBUI_URL */ -}} {{- define "openweb-ui.url" -}} - {{- $proto := "http" -}} - {{- if .Values.ingress.tls -}} - {{- $proto = "https" -}} - {{- end -}} - {{- printf "%s://%s" $proto $.Values.ingress.host }} + {{- $url := "" -}} + {{- range .Values.extraEnvVars }} + {{- if and (eq .name "WEBUI_URL") .value }} + {{- $url = .value }} + {{- end }} + {{- end }} + {{- if not $url }} + {{- $proto := "http" -}} + {{- if .Values.ingress.tls }} + {{- $proto = "https" -}} + {{- end }} + {{- $url = printf "%s://%s" $proto .Values.ingress.host }} + {{- end }} + {{- $url }} {{- end }} diff --git a/charts/open-webui/templates/workload-manager.yaml b/charts/open-webui/templates/workload-manager.yaml index bad45df..6bf1242 100644 --- a/charts/open-webui/templates/workload-manager.yaml +++ b/charts/open-webui/templates/workload-manager.yaml @@ -119,9 +119,15 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} env: - {{- if .Values.ingress.enabled }} + {{- $hasCustomWebUIUrl := false }} + {{- range .Values.extraEnvVars }} + {{- if eq .name "WEBUI_URL" }} + {{- $hasCustomWebUIUrl = true }} + {{- end }} + {{- end }} + {{- if and .Values.ingress.enabled (not $hasCustomWebUIUrl) }} - name: WEBUI_URL - value: {{ include "openweb-ui.url" . }} + value: {{ include "openweb-ui.url" . | quote }} {{- end }} {{- if .Values.ollamaUrlsFromExtraEnv}} {{- else if or .Values.ollamaUrls .Values.ollama.enabled }}