Skip to content

Commit 9fc8df0

Browse files
committed
Update ollama urls value with patch job
1 parent 57d8ff6 commit 9fc8df0

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

argocd/apps/applications/open-webui/open-webui-app.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,9 @@ spec:
1818
syncOptions:
1919
- CreateNamespace=true
2020
- Prune=true
21+
ignoreDifferences:
22+
- group: apps
23+
kind: StatefulSet
24+
name: open-webui
25+
jqPathExpressions:
26+
- '.spec.template.spec.containers[0].env[] | select(.name == "OLLAMA_BASE_URLS") | .value'

helm/ollama/values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ ollama:
2121
- qwen3-coder:30b
2222
- qwen3:30b
2323
create:
24-
- name: gpt-oss:20b-131k-context
24+
- name: gpt-oss:20b
2525
template: |
2626
FROM gpt-oss:20b
2727
PARAMETER num_ctx 131072
28-
- name: qwen3-coder:30b-32k-context
28+
- name: qwen3-coder:30b
2929
template: |
3030
FROM qwen3-coder:30b
3131
PARAMETER num_ctx 32768
32-
- name: qwen3:30b-32k-context
32+
- name: qwen3:30b
3333
template: |
3434
FROM qwen3:30b
3535
PARAMETER num_ctx 32768

helm/open-webui/templates/patch-job.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ spec:
1616
name: {{ include "open-webui.name" . }}-lb-ip-patch
1717
spec:
1818
serviceAccountName: {{ .Values.serviceAccount.name | default (include "open-webui.name" .) }}
19+
automountServiceAccountToken: true
1920
restartPolicy: OnFailure
2021
containers:
2122
- name: kubectl
@@ -24,9 +25,28 @@ spec:
2425
args:
2526
- |
2627
set -e
28+
29+
# Patch the open-webui service with its LoadBalancer IP
2730
IP=$(kubectl get secret {{ include "open-webui.name" . }}-lb-ip -n {{ include "open-webui.namespace" . }} -o jsonpath="{.data.LOAD_BALANCER_IP}" | base64 -d)
2831
CURRENT_IP=$(kubectl get svc {{ include "open-webui.name" . }} -n {{ include "open-webui.namespace" . }} -o jsonpath="{.spec.loadBalancerIP}" 2>/dev/null || echo "")
2932
if [[ "$CURRENT_IP" != "$IP" ]]; then
3033
kubectl patch svc {{ include "open-webui.name" . }} -n {{ include "open-webui.namespace" . }} -p '{"spec":{"loadBalancerIP":"'$IP'"}}' --type=merge
34+
echo "Service LoadBalancer IP patched to: $IP"
3135
fi
36+
37+
# Get Ollama LoadBalancer IP from ollama-app-lb-ip secret
38+
OLLAMA_IP=$(kubectl get secret ollama-app-lb-ip -n {{ include "open-webui.namespace" . }} -o jsonpath="{.data.loadBalancerIP}" 2>/dev/null | base64 -d)
39+
if [[ -z "$OLLAMA_IP" ]]; then
40+
echo "ERROR: Failed to read Ollama IP from secret ollama-app-lb-ip"
41+
echo "Available secrets:"
42+
kubectl get secrets -n {{ include "open-webui.namespace" . }}
43+
exit 1
44+
fi
45+
OLLAMA_URL="http://${OLLAMA_IP}:11434"
46+
echo "Ollama URL: $OLLAMA_URL"
47+
48+
# Patch the StatefulSet with OLLAMA_BASE_URLS environment variable (using set env to merge, not replace)
49+
kubectl set env statefulset/{{ include "open-webui.name" . }} -n {{ include "open-webui.namespace" . }} OLLAMA_BASE_URLS="$OLLAMA_URL"
50+
51+
echo "StatefulSet patched with Ollama URL: $OLLAMA_URL"
3252
{{- end }}

helm/open-webui/templates/rbac.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ rules:
1313
- apiGroups: [""]
1414
resources: ["services"]
1515
verbs: ["get", "patch"]
16+
- apiGroups: ["apps"]
17+
resources: ["statefulsets"]
18+
verbs: ["get", "patch"]
1619
---
1720
apiVersion: rbac.authorization.k8s.io/v1
1821
kind: RoleBinding

helm/open-webui/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ollama:
1010
# A list of Ollama API endpoints. These can be added in lieu of automatically installing the Ollama Helm chart, or in addition to it.
1111
# This will be patched during deployment
1212
# @section -- External Tools configuration
13-
ollamaUrls: []
13+
ollamaUrls: ["http://placeholder-will-be-patched:11434"]
1414

1515
# -- Disables taking Ollama Urls from `ollamaUrls` list
1616
# @section -- External Tools configuration

0 commit comments

Comments
 (0)