Skip to content

Commit 57d8ff6

Browse files
committed
Add sealed secret + patch job for open-webui
1 parent 8d0991c commit 57d8ff6

File tree

5 files changed

+108
-3
lines changed

5 files changed

+108
-3
lines changed

docs/SETUP.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,6 @@ cat mysecret.yaml
758758
kubeseal --controller-name=sealed-secrets \
759759
--controller-namespace=kube-system \
760760
--format yaml \
761-
--scope namespace-wide \
762761
< mysecret.yaml \
763762
> mysealedsecret.yaml
764763

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if .Values.patchJob.create -}}
2+
apiVersion: batch/v1
3+
kind: Job
4+
metadata:
5+
name: {{ include "open-webui.name" . }}-lb-ip-patch
6+
namespace: {{ include "open-webui.namespace" . }}
7+
labels:
8+
{{- include "open-webui.labels" . | nindent 4 }}
9+
annotations:
10+
argocd.argoproj.io/hook: PostSync
11+
argocd.argoproj.io/hook-delete-policy: HookSucceeded
12+
spec:
13+
ttlSecondsAfterFinished: 30
14+
template:
15+
metadata:
16+
name: {{ include "open-webui.name" . }}-lb-ip-patch
17+
spec:
18+
serviceAccountName: {{ .Values.serviceAccount.name | default (include "open-webui.name" .) }}
19+
restartPolicy: OnFailure
20+
containers:
21+
- name: kubectl
22+
image: bitnami/kubectl:latest
23+
command: ["/bin/sh", "-c"]
24+
args:
25+
- |
26+
set -e
27+
IP=$(kubectl get secret {{ include "open-webui.name" . }}-lb-ip -n {{ include "open-webui.namespace" . }} -o jsonpath="{.data.LOAD_BALANCER_IP}" | base64 -d)
28+
CURRENT_IP=$(kubectl get svc {{ include "open-webui.name" . }} -n {{ include "open-webui.namespace" . }} -o jsonpath="{.spec.loadBalancerIP}" 2>/dev/null || echo "")
29+
if [[ "$CURRENT_IP" != "$IP" ]]; then
30+
kubectl patch svc {{ include "open-webui.name" . }} -n {{ include "open-webui.namespace" . }} -p '{"spec":{"loadBalancerIP":"'$IP'"}}' --type=merge
31+
fi
32+
{{- end }}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{- if .Values.rbac.create -}}
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: Role
4+
metadata:
5+
name: {{ include "open-webui.name" . }}-service-patch
6+
namespace: {{ include "open-webui.namespace" . }}
7+
labels:
8+
{{- include "open-webui.labels" . | nindent 4 }}
9+
rules:
10+
- apiGroups: [""]
11+
resources: ["secrets"]
12+
verbs: ["get"]
13+
- apiGroups: [""]
14+
resources: ["services"]
15+
verbs: ["get", "patch"]
16+
---
17+
apiVersion: rbac.authorization.k8s.io/v1
18+
kind: RoleBinding
19+
metadata:
20+
name: {{ include "open-webui.name" . }}-service-patch
21+
namespace: {{ include "open-webui.namespace" . }}
22+
labels:
23+
{{- include "open-webui.labels" . | nindent 4 }}
24+
roleRef:
25+
apiGroup: rbac.authorization.k8s.io
26+
kind: Role
27+
name: {{ include "open-webui.name" . }}-service-patch
28+
subjects:
29+
- kind: ServiceAccount
30+
name: {{ .Values.serviceAccount.name | default (include "open-webui.name" .) }}
31+
namespace: {{ include "open-webui.namespace" . }}
32+
{{- end }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- if .Values.sealedSecret.create -}}
2+
apiVersion: bitnami.com/v1alpha1
3+
kind: SealedSecret
4+
metadata:
5+
name: {{ include "open-webui.name" . }}-lb-ip
6+
namespace: {{ include "open-webui.namespace" . }}
7+
labels:
8+
{{- include "open-webui.labels" . | nindent 4 }}
9+
spec:
10+
encryptedData:
11+
LOAD_BALANCER_IP: {{ .Values.sealedSecret.encryptedData.LOAD_BALANCER_IP }}
12+
template:
13+
metadata:
14+
name: {{ include "open-webui.name" . }}-lb-ip
15+
namespace: {{ include "open-webui.namespace" . }}
16+
labels:
17+
{{- include "open-webui.labels" . | nindent 8 }}
18+
{{- end }}

helm/open-webui/values.yaml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ image:
153153
repository: ghcr.io/open-webui/open-webui
154154
# -- Open WebUI image tag (Open WebUI image tags can be found here: https://github.com/open-webui/open-webui)
155155
# @section -- Image configuration
156-
tag: ""
156+
tag: "0.6.36"
157157
# -- Open WebUI image pull policy
158158
# @section -- Image configuration
159159
pullPolicy: "IfNotPresent"
@@ -393,7 +393,7 @@ hostAliases: []
393393
service:
394394
# -- Service type to expose Open WebUI pods to cluster. Options are ClusterIP, NodePort, LoadBalancer, or ExternalName
395395
# @section -- Service configuration
396-
type: ClusterIP
396+
type: LoadBalancer
397397
# -- Additional annotations to add to the Service
398398
# @section -- Service configuration
399399
annotations: {}
@@ -412,6 +412,9 @@ service:
412412
# -- Load balancer class to use if service type is LoadBalancer (e.g., for GKE use "gce")
413413
# @section -- Service configuration
414414
loadBalancerClass: ""
415+
# -- Load balancer IP to use if service type is LoadBalancer
416+
# @section -- Service configuration
417+
loadBalancerIP: ""
415418

416419
# -- Enables the use of OpenAI APIs
417420
# @section -- OpenAI API configuration
@@ -704,3 +707,24 @@ logging:
704707
# -- Set the log level for the Authentication Webhook component
705708
# @section -- Logging configuration
706709
webhook: ""
710+
711+
# -- Sealed Secret configuration for LoadBalancer IP
712+
# @section -- Sealed Secret configuration
713+
sealedSecret:
714+
# -- Create a SealedSecret for the LoadBalancer IP
715+
create: true
716+
# -- Encrypted data for the SealedSecret (leave empty string and update after deployment)
717+
encryptedData:
718+
LOAD_BALANCER_IP: AgCzLa8Mqxe2Tm8lwEFDbI5cydEu9cn2a+H+J+xRNhqDa3lz21tn+mLBpBN53uPiYxnsqXQ1WAIWFyLse0XqYRd3G9LvuEe85D3SYgI6qGwt73AWWz0CSN71w+LjpZ87sOtlbk6l77ulL0qbIddnR06zalPy3NrMgwxwYD/0z2CBif9R+6FDGK8713y/8czdaZtdwd9LSkNowXS2XtKXCue7nDj5Q3WeaA5HWlfabz5R5TW8OEr9vV8Z34sb+2g3kSQNZiwFM21VD5SZCSx10163De+q/2aRXB09RrLQVyNbbOqODzr1ZneQDeJ4QqZ+NSYAjcSxAUiAzrBXr2f5mBULdJd488p4jdDY5VCUJ6zl3ekhXQ9lt01t/z7OYo2zvaYIK4JvCJy2jWO/KsX2RI9jmwcyveT5xT+vCqYJgAFYvixT1lLrADkfLnj4+E1XkP7MFfviZEDkJKaj4PRM2MO3mmBRyhacdTo4qMzT1BSuJEhP8o0NxrwG7BPEc2DF0fnMdnf5l9MT8dwZ+g0xx59q1CYROY+4o0MjCjIoCo5D8qb/ZCciJJnsOfEcBRQ2h68CdqPB10lT6mGtJh0Ij9++GjBRhJlKOoo4+7J1BkZ+3C+vNNHEfNUEyafXFaJW5tVQiFuxry7fBtt/IOa560qtabhdqTBTATrDDmZ7Vr2th1EvwjVvyHlBqOtY4zt2/VexyakkXvJXvfpZ
719+
720+
# -- Patch Job configuration to apply LoadBalancer IP from SealedSecret
721+
# @section -- Patch Job configuration
722+
patchJob:
723+
# -- Create a patch job to update the service with the LoadBalancer IP from the SealedSecret
724+
create: true
725+
726+
# -- RBAC configuration for service patching
727+
# @section -- RBAC configuration
728+
rbac:
729+
# -- Create RBAC resources (Role and RoleBinding) for the patch job
730+
create: true

0 commit comments

Comments
 (0)