From 770c6f210cda49089338b2b2009f4d1956a2005d Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 21:49:30 +0100 Subject: [PATCH 01/18] remove namespace --- kubernetes/helm/templates/ollama-namespace.yaml | 4 ---- kubernetes/helm/templates/ollama-service.yaml | 3 +-- kubernetes/helm/templates/ollama-statefulset.yaml | 3 +-- kubernetes/helm/templates/webui-deployment.yaml | 3 +-- kubernetes/helm/templates/webui-ingress.yaml | 1 - kubernetes/helm/templates/webui-pvc.yaml | 5 ++--- kubernetes/helm/templates/webui-service.yaml | 3 +-- kubernetes/helm/values.yaml | 4 +--- 8 files changed, 7 insertions(+), 19 deletions(-) delete mode 100644 kubernetes/helm/templates/ollama-namespace.yaml diff --git a/kubernetes/helm/templates/ollama-namespace.yaml b/kubernetes/helm/templates/ollama-namespace.yaml deleted file mode 100644 index 59f794477..000000000 --- a/kubernetes/helm/templates/ollama-namespace.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: {{ .Values.namespace }} \ No newline at end of file diff --git a/kubernetes/helm/templates/ollama-service.yaml b/kubernetes/helm/templates/ollama-service.yaml index 54558473a..a993b6189 100644 --- a/kubernetes/helm/templates/ollama-service.yaml +++ b/kubernetes/helm/templates/ollama-service.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: Service metadata: name: ollama-service - namespace: {{ .Values.namespace }} spec: type: {{ .Values.ollama.service.type }} selector: @@ -10,4 +9,4 @@ spec: ports: - protocol: TCP port: {{ .Values.ollama.servicePort }} - targetPort: {{ .Values.ollama.servicePort }} \ No newline at end of file + targetPort: {{ .Values.ollama.servicePort }} diff --git a/kubernetes/helm/templates/ollama-statefulset.yaml b/kubernetes/helm/templates/ollama-statefulset.yaml index 83cb6883f..76b1988f9 100644 --- a/kubernetes/helm/templates/ollama-statefulset.yaml +++ b/kubernetes/helm/templates/ollama-statefulset.yaml @@ -2,7 +2,6 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: ollama - namespace: {{ .Values.namespace }} spec: serviceName: "ollama" replicas: {{ .Values.ollama.replicaCount }} @@ -52,4 +51,4 @@ spec: accessModes: [ "ReadWriteOnce" ] resources: requests: - storage: {{ .Values.ollama.volumeSize }} \ No newline at end of file + storage: {{ .Values.ollama.volumeSize }} diff --git a/kubernetes/helm/templates/webui-deployment.yaml b/kubernetes/helm/templates/webui-deployment.yaml index 08c966886..af42cecab 100644 --- a/kubernetes/helm/templates/webui-deployment.yaml +++ b/kubernetes/helm/templates/webui-deployment.yaml @@ -2,7 +2,6 @@ apiVersion: apps/v1 kind: Deployment metadata: name: open-webui-deployment - namespace: {{ .Values.namespace }} spec: replicas: 1 selector: @@ -35,4 +34,4 @@ spec: volumes: - name: webui-volume persistentVolumeClaim: - claimName: open-webui-pvc \ No newline at end of file + claimName: open-webui-pvc diff --git a/kubernetes/helm/templates/webui-ingress.yaml b/kubernetes/helm/templates/webui-ingress.yaml index cbd456d3f..28b90dc47 100644 --- a/kubernetes/helm/templates/webui-ingress.yaml +++ b/kubernetes/helm/templates/webui-ingress.yaml @@ -3,7 +3,6 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: open-webui-ingress - namespace: {{ .Values.namespace }} {{- if .Values.webui.ingress.annotations }} annotations: {{ toYaml .Values.webui.ingress.annotations | trimSuffix "\n" | indent 4 }} diff --git a/kubernetes/helm/templates/webui-pvc.yaml b/kubernetes/helm/templates/webui-pvc.yaml index d090fe872..0db77c677 100644 --- a/kubernetes/helm/templates/webui-pvc.yaml +++ b/kubernetes/helm/templates/webui-pvc.yaml @@ -1,12 +1,11 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: + name: open-webui-pvc labels: app: open-webui - name: open-webui-pvc - namespace: {{ .Values.namespace }} spec: accessModes: [ "ReadWriteOnce" ] resources: requests: - storage: {{ .Values.webui.volumeSize }} \ No newline at end of file + storage: {{ .Values.webui.volumeSize }} diff --git a/kubernetes/helm/templates/webui-service.yaml b/kubernetes/helm/templates/webui-service.yaml index afd526a15..8a96bd152 100644 --- a/kubernetes/helm/templates/webui-service.yaml +++ b/kubernetes/helm/templates/webui-service.yaml @@ -2,7 +2,6 @@ apiVersion: v1 kind: Service metadata: name: open-webui-service - namespace: {{ .Values.namespace }} spec: type: {{ .Values.webui.service.type }} # Default: NodePort # Use LoadBalancer if you're on a cloud that supports it selector: @@ -12,4 +11,4 @@ spec: port: {{ .Values.webui.servicePort }} targetPort: {{ .Values.webui.servicePort }} # If using NodePort, you can optionally specify the nodePort: - # nodePort: 30000 \ No newline at end of file + # nodePort: 30000 diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index 63781f6cc..ff96fa277 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -1,5 +1,3 @@ -namespace: open-webui - ollama: replicaCount: 1 image: ollama/ollama:latest @@ -41,4 +39,4 @@ webui: nodeSelector: {} tolerations: [] service: - type: NodePort \ No newline at end of file + type: NodePort From cbaada1410bbfb6caa0f4b5726b30a499ed30616 Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 21:58:25 +0100 Subject: [PATCH 02/18] add define names --- kubernetes/helm/templates/_helpers.tpl | 7 +++++++ kubernetes/helm/templates/ollama-service.yaml | 2 +- kubernetes/helm/templates/ollama-statefulset.yaml | 4 ++-- kubernetes/helm/templates/webui-deployment.yaml | 8 ++++---- kubernetes/helm/templates/webui-ingress.yaml | 2 +- kubernetes/helm/templates/webui-pvc.yaml | 2 +- kubernetes/helm/templates/webui-service.yaml | 2 +- 7 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 kubernetes/helm/templates/_helpers.tpl diff --git a/kubernetes/helm/templates/_helpers.tpl b/kubernetes/helm/templates/_helpers.tpl new file mode 100644 index 000000000..16a6f947b --- /dev/null +++ b/kubernetes/helm/templates/_helpers.tpl @@ -0,0 +1,7 @@ +{{- define "open-webui.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end -}} + +{{- define "ollama.name" -}} +ollama +{{- end -}} diff --git a/kubernetes/helm/templates/ollama-service.yaml b/kubernetes/helm/templates/ollama-service.yaml index a993b6189..a8459b52f 100644 --- a/kubernetes/helm/templates/ollama-service.yaml +++ b/kubernetes/helm/templates/ollama-service.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: ollama-service + name: {{ include "ollama.name" . }} spec: type: {{ .Values.ollama.service.type }} selector: diff --git a/kubernetes/helm/templates/ollama-statefulset.yaml b/kubernetes/helm/templates/ollama-statefulset.yaml index 76b1988f9..dfbf5ba4d 100644 --- a/kubernetes/helm/templates/ollama-statefulset.yaml +++ b/kubernetes/helm/templates/ollama-statefulset.yaml @@ -1,9 +1,9 @@ apiVersion: apps/v1 kind: StatefulSet metadata: - name: ollama + name: {{ include "ollama.name" . }} spec: - serviceName: "ollama" + serviceName: {{ include "ollama.name" . }} replicas: {{ .Values.ollama.replicaCount }} selector: matchLabels: diff --git a/kubernetes/helm/templates/webui-deployment.yaml b/kubernetes/helm/templates/webui-deployment.yaml index af42cecab..e62421298 100644 --- a/kubernetes/helm/templates/webui-deployment.yaml +++ b/kubernetes/helm/templates/webui-deployment.yaml @@ -1,7 +1,7 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: open-webui-deployment + name: {{ include "open-webui.name" . }} spec: replicas: 1 selector: @@ -13,7 +13,7 @@ spec: app: open-webui spec: containers: - - name: open-webui + - name: {{ .Chart.Name }} image: {{ .Values.webui.image }} ports: - containerPort: 8080 @@ -25,7 +25,7 @@ spec: mountPath: /app/backend/data env: - name: OLLAMA_API_BASE_URL - value: "http://ollama-service.{{ .Values.namespace }}.svc.cluster.local:{{ .Values.ollama.servicePort }}/api" + value: {{ printf "http://%s.%s.svc.cluster.local:%s/api" (include "ollama.name" .) (.Release.Namespace) (.Values.ollama.servicePort) | quote }} tty: true {{- with .Values.webui.nodeSelector }} nodeSelector: @@ -34,4 +34,4 @@ spec: volumes: - name: webui-volume persistentVolumeClaim: - claimName: open-webui-pvc + claimName: {{ include "open-webui.name" . }} diff --git a/kubernetes/helm/templates/webui-ingress.yaml b/kubernetes/helm/templates/webui-ingress.yaml index 28b90dc47..18fcd6cce 100644 --- a/kubernetes/helm/templates/webui-ingress.yaml +++ b/kubernetes/helm/templates/webui-ingress.yaml @@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: - name: open-webui-ingress + name: {{ include "open-webui.name" . }} {{- if .Values.webui.ingress.annotations }} annotations: {{ toYaml .Values.webui.ingress.annotations | trimSuffix "\n" | indent 4 }} diff --git a/kubernetes/helm/templates/webui-pvc.yaml b/kubernetes/helm/templates/webui-pvc.yaml index 0db77c677..2b8d7d1cb 100644 --- a/kubernetes/helm/templates/webui-pvc.yaml +++ b/kubernetes/helm/templates/webui-pvc.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: - name: open-webui-pvc + name: {{ include "open-webui.name" . }} labels: app: open-webui spec: diff --git a/kubernetes/helm/templates/webui-service.yaml b/kubernetes/helm/templates/webui-service.yaml index 8a96bd152..7ecf796d1 100644 --- a/kubernetes/helm/templates/webui-service.yaml +++ b/kubernetes/helm/templates/webui-service.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: Service metadata: - name: open-webui-service + name: {{ include "open-webui.name" . }} spec: type: {{ .Values.webui.service.type }} # Default: NodePort # Use LoadBalancer if you're on a cloud that supports it selector: From 0b7f183a038fc84d29a5a92e62b963ac61f34973 Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 22:23:36 +0100 Subject: [PATCH 03/18] add labels and selectors --- kubernetes/helm/templates/_helpers.tpl | 36 +++++++++++++++++++ kubernetes/helm/templates/ollama-service.yaml | 13 ++++--- .../helm/templates/ollama-statefulset.yaml | 12 ++++--- .../helm/templates/webui-deployment.yaml | 10 +++--- kubernetes/helm/templates/webui-ingress.yaml | 6 ++-- kubernetes/helm/templates/webui-pvc.yaml | 2 +- kubernetes/helm/templates/webui-service.yaml | 19 ++++++---- 7 files changed, 75 insertions(+), 23 deletions(-) diff --git a/kubernetes/helm/templates/_helpers.tpl b/kubernetes/helm/templates/_helpers.tpl index 16a6f947b..0ed9ddeae 100644 --- a/kubernetes/helm/templates/_helpers.tpl +++ b/kubernetes/helm/templates/_helpers.tpl @@ -5,3 +5,39 @@ {{- define "ollama.name" -}} ollama {{- end -}} + +{{- define "chart.name" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{- define "base.labels" -}} +helm.sh/chart: {{ include "chart.name" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{- define "base.selectorLabels" -}} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{- define "open-webui.selectorLabels" -}} +{{ include "base.selectorLabels" . }} +app.kubernetes.io/component: {{ .Chart.Name }} +{{- end }} + +{{- define "open-webui.labels" -}} +{{ include "base.labels" . }} +{{ include "open-webui.selectorLabels" . }} +{{- end }} + +{{- define "ollama.selectorLabels" -}} +{{ include "base.selectorLabels" . }} +app.kubernetes.io/component: {{ include "ollama.name" . }} +{{- end }} + +{{- define "ollama.labels" -}} +{{ include "base.labels" . }} +{{ include "ollama.selectorLabels" . }} +{{- end }} diff --git a/kubernetes/helm/templates/ollama-service.yaml b/kubernetes/helm/templates/ollama-service.yaml index a8459b52f..f1512c5a4 100644 --- a/kubernetes/helm/templates/ollama-service.yaml +++ b/kubernetes/helm/templates/ollama-service.yaml @@ -2,11 +2,16 @@ apiVersion: v1 kind: Service metadata: name: {{ include "ollama.name" . }} + labels: + {{- include "ollama.labels" . | nindent 4 }} spec: - type: {{ .Values.ollama.service.type }} selector: - app: ollama + {{- include "ollama.selectorLabels" . | nindent 4 }} +{{- with .Values.ollama.service }} + type: {{ .type }} ports: - protocol: TCP - port: {{ .Values.ollama.servicePort }} - targetPort: {{ .Values.ollama.servicePort }} + name: http + port: {{ .port }} + targetPort: {{ .containerPort }} +{{- end }} diff --git a/kubernetes/helm/templates/ollama-statefulset.yaml b/kubernetes/helm/templates/ollama-statefulset.yaml index dfbf5ba4d..cc37a2316 100644 --- a/kubernetes/helm/templates/ollama-statefulset.yaml +++ b/kubernetes/helm/templates/ollama-statefulset.yaml @@ -2,19 +2,21 @@ apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "ollama.name" . }} + labels: + {{- include "ollama.labels" . | nindent 4 }} spec: serviceName: {{ include "ollama.name" . }} replicas: {{ .Values.ollama.replicaCount }} selector: matchLabels: - app: ollama + {{- include "ollama.selectorLabels" . | nindent 6 }} template: metadata: labels: - app: ollama + {{- include "ollama.selectorLabels" . | nindent 8 }} spec: containers: - - name: ollama + - name: {{ include "ollama.name" . }} image: {{ .Values.ollama.image }} ports: - containerPort: {{ .Values.ollama.servicePort }} @@ -27,8 +29,8 @@ spec: - name: NVIDIA_DRIVER_CAPABILITIES value: compute,utility {{- end}} - {{- if .Values.ollama.resources }} - resources: {{- toYaml .Values.ollama.resources | nindent 10 }} + {{- with .Values.ollama.resources }} + resources: {{- toYaml . | nindent 10 }} {{- end }} volumeMounts: - name: ollama-volume diff --git a/kubernetes/helm/templates/webui-deployment.yaml b/kubernetes/helm/templates/webui-deployment.yaml index e62421298..4b08da785 100644 --- a/kubernetes/helm/templates/webui-deployment.yaml +++ b/kubernetes/helm/templates/webui-deployment.yaml @@ -2,23 +2,25 @@ apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "open-webui.name" . }} + labels: + {{- include "open-webui.labels" . | nindent 4 }} spec: replicas: 1 selector: matchLabels: - app: open-webui + {{- include "open-webui.selectorLabels" . | nindent 6 }} template: metadata: labels: - app: open-webui + {{- include "open-webui.selectorLabels" . | nindent 8 }} spec: containers: - name: {{ .Chart.Name }} image: {{ .Values.webui.image }} ports: - containerPort: 8080 - {{- if .Values.webui.resources }} - resources: {{- toYaml .Values.webui.resources | nindent 10 }} + {{- with .Values.webui.resources }} + resources: {{- toYaml . | nindent 10 }} {{- end }} volumeMounts: - name: webui-volume diff --git a/kubernetes/helm/templates/webui-ingress.yaml b/kubernetes/helm/templates/webui-ingress.yaml index 18fcd6cce..9d943c07e 100644 --- a/kubernetes/helm/templates/webui-ingress.yaml +++ b/kubernetes/helm/templates/webui-ingress.yaml @@ -3,9 +3,11 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: {{ include "open-webui.name" . }} -{{- if .Values.webui.ingress.annotations }} + labels: + {{- include "open-webui.labels" . | nindent 4 }} +{{- with .Values.webui.ingress.annotations }} annotations: -{{ toYaml .Values.webui.ingress.annotations | trimSuffix "\n" | indent 4 }} + {{- toYaml . | nindent 4 }} {{- end }} spec: rules: diff --git a/kubernetes/helm/templates/webui-pvc.yaml b/kubernetes/helm/templates/webui-pvc.yaml index 2b8d7d1cb..711117fb9 100644 --- a/kubernetes/helm/templates/webui-pvc.yaml +++ b/kubernetes/helm/templates/webui-pvc.yaml @@ -3,7 +3,7 @@ kind: PersistentVolumeClaim metadata: name: {{ include "open-webui.name" . }} labels: - app: open-webui + {{- include "open-webui.labels" . | nindent 4 }} spec: accessModes: [ "ReadWriteOnce" ] resources: diff --git a/kubernetes/helm/templates/webui-service.yaml b/kubernetes/helm/templates/webui-service.yaml index 7ecf796d1..d126968d3 100644 --- a/kubernetes/helm/templates/webui-service.yaml +++ b/kubernetes/helm/templates/webui-service.yaml @@ -2,13 +2,18 @@ apiVersion: v1 kind: Service metadata: name: {{ include "open-webui.name" . }} + labels: + {{- include "open-webui.labels" . | nindent 4 }} spec: - type: {{ .Values.webui.service.type }} # Default: NodePort # Use LoadBalancer if you're on a cloud that supports it selector: - app: open-webui + {{- include "open-webui.selectorLabels" . | nindent 4 }} +{{- with .Values.webui.service }} + type: {{ .type }} ports: - - protocol: TCP - port: {{ .Values.webui.servicePort }} - targetPort: {{ .Values.webui.servicePort }} - # If using NodePort, you can optionally specify the nodePort: - # nodePort: 30000 + - protocol: TCP + port: {{ .port }} + targetPort: {{ .containerPort }} + {{- if .nodePort }} + nodePort: {{ .nodePort }} + {{- end }} +{{- end }} From 05e31494c2ce13b9254922816d611cff4f52a9a8 Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 22:33:22 +0100 Subject: [PATCH 04/18] rename ports, labels and service settings --- kubernetes/helm/templates/ollama-service.yaml | 4 ++-- kubernetes/helm/templates/ollama-statefulset.yaml | 5 +++-- kubernetes/helm/templates/webui-deployment.yaml | 7 ++++--- kubernetes/helm/templates/webui-ingress.yaml | 4 ++-- kubernetes/helm/templates/webui-pvc.yaml | 4 ++-- kubernetes/helm/templates/webui-service.yaml | 4 ++-- kubernetes/helm/values.yaml | 15 ++++++++++----- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/kubernetes/helm/templates/ollama-service.yaml b/kubernetes/helm/templates/ollama-service.yaml index f1512c5a4..be5a6657e 100644 --- a/kubernetes/helm/templates/ollama-service.yaml +++ b/kubernetes/helm/templates/ollama-service.yaml @@ -12,6 +12,6 @@ spec: ports: - protocol: TCP name: http - port: {{ .port }} - targetPort: {{ .containerPort }} + port: http + targetPort: {{ .port }} {{- end }} diff --git a/kubernetes/helm/templates/ollama-statefulset.yaml b/kubernetes/helm/templates/ollama-statefulset.yaml index cc37a2316..19204347a 100644 --- a/kubernetes/helm/templates/ollama-statefulset.yaml +++ b/kubernetes/helm/templates/ollama-statefulset.yaml @@ -13,13 +13,14 @@ spec: template: metadata: labels: - {{- include "ollama.selectorLabels" . | nindent 8 }} + {{- include "ollama.labels" . | nindent 8 }} spec: containers: - name: {{ include "ollama.name" . }} image: {{ .Values.ollama.image }} ports: - - containerPort: {{ .Values.ollama.servicePort }} + - name: http + containerPort: {{ .Values.ollama.service.containerPort }} env: {{- if .Values.ollama.gpu.enabled }} - name: PATH diff --git a/kubernetes/helm/templates/webui-deployment.yaml b/kubernetes/helm/templates/webui-deployment.yaml index 4b08da785..3e62ac9f2 100644 --- a/kubernetes/helm/templates/webui-deployment.yaml +++ b/kubernetes/helm/templates/webui-deployment.yaml @@ -5,20 +5,21 @@ metadata: labels: {{- include "open-webui.labels" . | nindent 4 }} spec: - replicas: 1 + replicas: {{ .Values.webui.replicaCount }} selector: matchLabels: {{- include "open-webui.selectorLabels" . | nindent 6 }} template: metadata: labels: - {{- include "open-webui.selectorLabels" . | nindent 8 }} + {{- include "open-webui.labels" . | nindent 8 }} spec: containers: - name: {{ .Chart.Name }} image: {{ .Values.webui.image }} ports: - - containerPort: 8080 + - name: http + containerPort: {{ .Values.webui.service.containerPort }} {{- with .Values.webui.resources }} resources: {{- toYaml . | nindent 10 }} {{- end }} diff --git a/kubernetes/helm/templates/webui-ingress.yaml b/kubernetes/helm/templates/webui-ingress.yaml index 9d943c07e..4cb1b1390 100644 --- a/kubernetes/helm/templates/webui-ingress.yaml +++ b/kubernetes/helm/templates/webui-ingress.yaml @@ -18,7 +18,7 @@ spec: pathType: Prefix backend: service: - name: open-webui-service + name: {{ include "open-webui.name" . }} port: - number: {{ .Values.webui.servicePort }} + number: {{ .Values.webui.service.port }} {{- end }} diff --git a/kubernetes/helm/templates/webui-pvc.yaml b/kubernetes/helm/templates/webui-pvc.yaml index 711117fb9..3ceed2ca6 100644 --- a/kubernetes/helm/templates/webui-pvc.yaml +++ b/kubernetes/helm/templates/webui-pvc.yaml @@ -3,9 +3,9 @@ kind: PersistentVolumeClaim metadata: name: {{ include "open-webui.name" . }} labels: - {{- include "open-webui.labels" . | nindent 4 }} + {{- include "open-webui.selectorLabels" . | nindent 4 }} spec: accessModes: [ "ReadWriteOnce" ] resources: requests: - storage: {{ .Values.webui.volumeSize }} + storage: {{ .Values.webui.persistence.size }} diff --git a/kubernetes/helm/templates/webui-service.yaml b/kubernetes/helm/templates/webui-service.yaml index d126968d3..bd87c853d 100644 --- a/kubernetes/helm/templates/webui-service.yaml +++ b/kubernetes/helm/templates/webui-service.yaml @@ -11,8 +11,8 @@ spec: type: {{ .type }} ports: - protocol: TCP - port: {{ .port }} - targetPort: {{ .containerPort }} + port: http + targetPort: {{ .port }} {{- if .nodePort }} nodePort: {{ .nodePort }} {{- end }} diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index ff96fa277..3e9f6a958 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -1,7 +1,6 @@ ollama: replicaCount: 1 image: ollama/ollama:latest - servicePort: 11434 resources: requests: cpu: "2000m" @@ -15,13 +14,14 @@ ollama: tolerations: [] service: type: ClusterIP + port: 80 + containerPort: 11434 gpu: enabled: false webui: replicaCount: 1 image: ghcr.io/open-webui/open-webui:main - servicePort: 8080 resources: requests: cpu: "500m" @@ -31,12 +31,17 @@ webui: memory: "1Gi" ingress: enabled: true - annotations: + annotations: {} # Use appropriate annotations for your Ingress controller, e.g., for NGINX: # nginx.ingress.kubernetes.io/rewrite-target: / host: open-webui.minikube.local - volumeSize: 2Gi + persistence: + enabled: true + size: 2Gi nodeSelector: {} tolerations: [] service: - type: NodePort + type: ClusterIP + port: 80 + containerPort: 8080 + nodePort: "" From 0d803aa0fda8fde7d3375f09471ccebf85701a8f Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 22:43:03 +0100 Subject: [PATCH 05/18] update image repository and storage --- .../helm/templates/ollama-statefulset.yaml | 17 +++++++++-------- .../helm/templates/webui-deployment.yaml | 5 ++++- kubernetes/helm/values.yaml | 19 +++++++++++++++---- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/kubernetes/helm/templates/ollama-statefulset.yaml b/kubernetes/helm/templates/ollama-statefulset.yaml index 19204347a..393787163 100644 --- a/kubernetes/helm/templates/ollama-statefulset.yaml +++ b/kubernetes/helm/templates/ollama-statefulset.yaml @@ -17,7 +17,10 @@ spec: spec: containers: - name: {{ include "ollama.name" . }} - image: {{ .Values.ollama.image }} + {{- with .Values.ollama.image }} + image: {{ .repository }}:{{ .tag }} + imagePullPolicy: {{ .pullPolicy }} + {{- end }} ports: - name: http containerPort: {{ .Values.ollama.service.containerPort }} @@ -29,7 +32,7 @@ spec: value: /usr/local/nvidia/lib:/usr/local/nvidia/lib64 - name: NVIDIA_DRIVER_CAPABILITIES value: compute,utility - {{- end}} + {{- end }} {{- with .Values.ollama.resources }} resources: {{- toYaml . | nindent 10 }} {{- end }} @@ -41,12 +44,10 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.ollama.tolerations }} tolerations: - {{- if .Values.ollama.gpu.enabled }} - - key: nvidia.com/gpu - operator: Exists - effect: NoSchedule - {{- end }} + {{- toYaml . | nindent 8 }} + {{- end }} volumeClaimTemplates: - metadata: name: ollama-volume @@ -54,4 +55,4 @@ spec: accessModes: [ "ReadWriteOnce" ] resources: requests: - storage: {{ .Values.ollama.volumeSize }} + storage: {{ .Values.ollama.persistence.size }} diff --git a/kubernetes/helm/templates/webui-deployment.yaml b/kubernetes/helm/templates/webui-deployment.yaml index 3e62ac9f2..9250d315c 100644 --- a/kubernetes/helm/templates/webui-deployment.yaml +++ b/kubernetes/helm/templates/webui-deployment.yaml @@ -16,7 +16,10 @@ spec: spec: containers: - name: {{ .Chart.Name }} - image: {{ .Values.webui.image }} + {{- with .Values.webui.image }} + image: {{ .repository }}:{{ .tag }} + imagePullPolicy: {{ .pullPolicy }} + {{- end }} ports: - name: http containerPort: {{ .Values.webui.service.containerPort }} diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index 3e9f6a958..dde2db17d 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -1,6 +1,9 @@ ollama: replicaCount: 1 - image: ollama/ollama:latest + image: + repository: ollama/ollama + tag: latest + pullPolicy: Always resources: requests: cpu: "2000m" @@ -9,9 +12,14 @@ ollama: cpu: "4000m" memory: "4Gi" nvidia.com/gpu: "0" - volumeSize: 30Gi + persistence: + enabled: true + size: 30Gi nodeSelector: {} - tolerations: [] + tolerations: + - key: nvidia.com/gpu + operator: Exists + effect: NoSchedule service: type: ClusterIP port: 80 @@ -21,7 +29,10 @@ ollama: webui: replicaCount: 1 - image: ghcr.io/open-webui/open-webui:main + image: + repository: ghcr.io/open-webui/open-webui + tag: main + pullPolicy: Always resources: requests: cpu: "500m" From 75a52df8897502d03788a573868c02fdb2f7170d Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 22:45:48 +0100 Subject: [PATCH 06/18] remove default resources allocation --- kubernetes/helm/values.yaml | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index dde2db17d..813fee12a 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -4,14 +4,7 @@ ollama: repository: ollama/ollama tag: latest pullPolicy: Always - resources: - requests: - cpu: "2000m" - memory: "2Gi" - limits: - cpu: "4000m" - memory: "4Gi" - nvidia.com/gpu: "0" + resources: {} persistence: enabled: true size: 30Gi @@ -33,19 +26,13 @@ webui: repository: ghcr.io/open-webui/open-webui tag: main pullPolicy: Always - resources: - requests: - cpu: "500m" - memory: "500Mi" - limits: - cpu: "1000m" - memory: "1Gi" + resources: {} ingress: - enabled: true + enabled: disable + # -- Use appropriate annotations for your Ingress controller, e.g., for NGINX: + # nginx.ingress.kubernetes.io/rewrite-target: / annotations: {} - # Use appropriate annotations for your Ingress controller, e.g., for NGINX: - # nginx.ingress.kubernetes.io/rewrite-target: / - host: open-webui.minikube.local + host: "" persistence: enabled: true size: 2Gi From 62e00968177b2a185f2dc6c2015fdf74e0f038eb Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 22:51:57 +0100 Subject: [PATCH 07/18] add chart details --- kubernetes/helm/Chart.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/kubernetes/helm/Chart.yaml b/kubernetes/helm/Chart.yaml index c35338c84..c05b44235 100644 --- a/kubernetes/helm/Chart.yaml +++ b/kubernetes/helm/Chart.yaml @@ -1,5 +1,21 @@ apiVersion: v2 name: open-webui -description: "Open WebUI: A User-Friendly Web Interface for Chat Interactions 👋" version: 1.0.0 +appVersion: 1.0.0-alpha.100 + +home: https://www.openwebui.com/ icon: https://raw.githubusercontent.com/open-webui/open-webui/main/static/favicon.png + +description: "Open WebUI: A User-Friendly Web Interface for Chat Interactions 👋" +keywords: +- llm +- chat +- web-ui + +sources: +- https://github.com/open-webui/open-webui/tree/main/kubernetes/helm +- https://hub.docker.com/r/ollama/ollama +- https://github.com/open-webui/open-webui/pkgs/container/open-webui + +annotations: + licenses: MIT From 4608afa5b9fa25491f5ee3041599654e79ab4a7b Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 22:55:22 +0100 Subject: [PATCH 08/18] fix values and update docker tag --- kubernetes/helm/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index 813fee12a..60234bb35 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -24,11 +24,11 @@ webui: replicaCount: 1 image: repository: ghcr.io/open-webui/open-webui - tag: main + tag: latest pullPolicy: Always resources: {} ingress: - enabled: disable + enabled: false # -- Use appropriate annotations for your Ingress controller, e.g., for NGINX: # nginx.ingress.kubernetes.io/rewrite-target: / annotations: {} From 34b7fd18c70d4a561d32639dbd702031980371d3 Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 23:18:06 +0100 Subject: [PATCH 09/18] update storage definition --- .../helm/templates/ollama-statefulset.yaml | 35 ++++++++++++++++--- .../helm/templates/webui-deployment.yaml | 13 +++++-- kubernetes/helm/templates/webui-pvc.yaml | 16 ++++++++- kubernetes/helm/values.yaml | 14 +++++++- 4 files changed, 69 insertions(+), 9 deletions(-) diff --git a/kubernetes/helm/templates/ollama-statefulset.yaml b/kubernetes/helm/templates/ollama-statefulset.yaml index 393787163..38d4e8b48 100644 --- a/kubernetes/helm/templates/ollama-statefulset.yaml +++ b/kubernetes/helm/templates/ollama-statefulset.yaml @@ -21,6 +21,7 @@ spec: image: {{ .repository }}:{{ .tag }} imagePullPolicy: {{ .pullPolicy }} {{- end }} + tty: true ports: - name: http containerPort: {{ .Values.ollama.service.containerPort }} @@ -37,9 +38,8 @@ spec: resources: {{- toYaml . | nindent 10 }} {{- end }} volumeMounts: - - name: ollama-volume + - name: data mountPath: /root/.ollama - tty: true {{- with .Values.ollama.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -48,11 +48,36 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} + volumes: + {{- if and .Values.ollama.persistence.enabled .Values.ollama.persistence.existingClaim }} + - name: data + persistentVolumeClaim: + claimName: {{ .Values.ollama.persistence.existingClaim }} + {{- else if not .Values.ollama.persistence.enabled }} + - name: data + emptyDir: {} + {{- else if and .Values.ollama.persistence.enabled (not .Values.ollama.persistence.existingClaim) }} + {} volumeClaimTemplates: - metadata: - name: ollama-volume + name: data + labels: + {{- include "ollama.selectorLabels" . | nindent 8 }} + {{- with .Values.ollama.persistence.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} spec: - accessModes: [ "ReadWriteOnce" ] + accessModes: + {{- range .Values.ollama.persistence.accessModes }} + - {{ . | quote }} + {{- end }} resources: requests: - storage: {{ .Values.ollama.persistence.size }} + storage: {{ .Values.ollama.persistence.size | quote }} + storageClass: {{ .Values.ollama.persistence.storageClass }} + {{- with .Values.ollama.persistence.selector }} + selector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- end }} diff --git a/kubernetes/helm/templates/webui-deployment.yaml b/kubernetes/helm/templates/webui-deployment.yaml index 9250d315c..effac745d 100644 --- a/kubernetes/helm/templates/webui-deployment.yaml +++ b/kubernetes/helm/templates/webui-deployment.yaml @@ -27,7 +27,7 @@ spec: resources: {{- toYaml . | nindent 10 }} {{- end }} volumeMounts: - - name: webui-volume + - name: data mountPath: /app/backend/data env: - name: OLLAMA_API_BASE_URL @@ -38,6 +38,15 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} volumes: - - name: webui-volume + {{- if and .Values.webui.persistence.enabled .Values.webui.persistence.existingClaim }} + - name: data + persistentVolumeClaim: + claimName: {{ .Values.webui.persistence.existingClaim }} + {{- else if not .Values.webui.persistence.enabled }} + - name: data + emptyDir: {} + {{- else if and .Values.webui.persistence.enabled (not .Values.webui.persistence.existingClaim) }} + - name: data persistentVolumeClaim: claimName: {{ include "open-webui.name" . }} + {{- end }} diff --git a/kubernetes/helm/templates/webui-pvc.yaml b/kubernetes/helm/templates/webui-pvc.yaml index 3ceed2ca6..06b2cc4a4 100644 --- a/kubernetes/helm/templates/webui-pvc.yaml +++ b/kubernetes/helm/templates/webui-pvc.yaml @@ -1,11 +1,25 @@ +{{- if and .Values.webui.persistence.enabled (not .Values.webui.persistence.existingClaim) }} apiVersion: v1 kind: PersistentVolumeClaim metadata: name: {{ include "open-webui.name" . }} labels: {{- include "open-webui.selectorLabels" . | nindent 4 }} + {{- with .Values.webui.persistence.annotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} spec: - accessModes: [ "ReadWriteOnce" ] + accessModes: + {{- range .Values.webui.persistence.accessModes }} + - {{ . | quote }} + {{- end }} resources: requests: storage: {{ .Values.webui.persistence.size }} + storageClass: {{ .Values.webui.persistence.storageClass }} + {{- with .Values.webui.persistence.selector }} + selector: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index 60234bb35..41d430594 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -8,6 +8,11 @@ ollama: persistence: enabled: true size: 30Gi + accessModes: + - ReadWriteOnce + storageClass: "" + selector: {} + annotations: {} nodeSelector: {} tolerations: - key: nvidia.com/gpu @@ -18,6 +23,7 @@ ollama: port: 80 containerPort: 11434 gpu: + # -- Enable additional ENV values to help Ollama discover GPU usage enabled: false webui: @@ -35,7 +41,13 @@ webui: host: "" persistence: enabled: true - size: 2Gi + size: 30Gi + # -- If using multiple replicas, you must update accessModes to ReadWriteMany + accessModes: + - ReadWriteOnce + storageClass: "" + selector: {} + annotations: {} nodeSelector: {} tolerations: [] service: From f82347ead68b986ffbe8cca255fd7cc89b7d58f8 Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 23:22:10 +0100 Subject: [PATCH 10/18] add annotations --- kubernetes/helm/templates/ollama-service.yaml | 4 ++++ kubernetes/helm/templates/ollama-statefulset.yaml | 8 ++++++++ kubernetes/helm/templates/webui-deployment.yaml | 8 ++++++++ kubernetes/helm/templates/webui-ingress.yaml | 4 ++-- kubernetes/helm/values.yaml | 6 ++++++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/kubernetes/helm/templates/ollama-service.yaml b/kubernetes/helm/templates/ollama-service.yaml index be5a6657e..75d06e69d 100644 --- a/kubernetes/helm/templates/ollama-service.yaml +++ b/kubernetes/helm/templates/ollama-service.yaml @@ -4,6 +4,10 @@ metadata: name: {{ include "ollama.name" . }} labels: {{- include "ollama.labels" . | nindent 4 }} + {{- with .Values.ollama.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: selector: {{- include "ollama.selectorLabels" . | nindent 4 }} diff --git a/kubernetes/helm/templates/ollama-statefulset.yaml b/kubernetes/helm/templates/ollama-statefulset.yaml index 38d4e8b48..da88de82c 100644 --- a/kubernetes/helm/templates/ollama-statefulset.yaml +++ b/kubernetes/helm/templates/ollama-statefulset.yaml @@ -4,6 +4,10 @@ metadata: name: {{ include "ollama.name" . }} labels: {{- include "ollama.labels" . | nindent 4 }} + {{- with .Values.ollama.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: serviceName: {{ include "ollama.name" . }} replicas: {{ .Values.ollama.replicaCount }} @@ -14,6 +18,10 @@ spec: metadata: labels: {{- include "ollama.labels" . | nindent 8 }} + {{- with .Values.ollama.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} spec: containers: - name: {{ include "ollama.name" . }} diff --git a/kubernetes/helm/templates/webui-deployment.yaml b/kubernetes/helm/templates/webui-deployment.yaml index effac745d..766cd1887 100644 --- a/kubernetes/helm/templates/webui-deployment.yaml +++ b/kubernetes/helm/templates/webui-deployment.yaml @@ -4,6 +4,10 @@ metadata: name: {{ include "open-webui.name" . }} labels: {{- include "open-webui.labels" . | nindent 4 }} + {{- with .Values.webui.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.webui.replicaCount }} selector: @@ -13,6 +17,10 @@ spec: metadata: labels: {{- include "open-webui.labels" . | nindent 8 }} + {{- with .Values.webui.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} spec: containers: - name: {{ .Chart.Name }} diff --git a/kubernetes/helm/templates/webui-ingress.yaml b/kubernetes/helm/templates/webui-ingress.yaml index 4cb1b1390..2c6b045f3 100644 --- a/kubernetes/helm/templates/webui-ingress.yaml +++ b/kubernetes/helm/templates/webui-ingress.yaml @@ -5,10 +5,10 @@ metadata: name: {{ include "open-webui.name" . }} labels: {{- include "open-webui.labels" . | nindent 4 }} -{{- with .Values.webui.ingress.annotations }} + {{- with .Values.webui.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} -{{- end }} + {{- end }} spec: rules: - host: {{ .Values.webui.ingress.host }} diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index 41d430594..d7db1d663 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -1,4 +1,6 @@ ollama: + annotations: {} + podAnnotations: {} replicaCount: 1 image: repository: ollama/ollama @@ -20,6 +22,7 @@ ollama: effect: NoSchedule service: type: ClusterIP + annotations: {} port: 80 containerPort: 11434 gpu: @@ -27,6 +30,8 @@ ollama: enabled: false webui: + annotations: {} + podAnnotations: {} replicaCount: 1 image: repository: ghcr.io/open-webui/open-webui @@ -52,6 +57,7 @@ webui: tolerations: [] service: type: ClusterIP + annotations: {} port: 80 containerPort: 8080 nodePort: "" From 18463d935e734383cf928b0215674cc896723f20 Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 23:32:50 +0100 Subject: [PATCH 11/18] pod optimization and advanced settings --- kubernetes/helm/templates/_helpers.tpl | 4 ++++ kubernetes/helm/templates/ollama-statefulset.yaml | 5 +++++ kubernetes/helm/templates/webui-deployment.yaml | 4 +++- kubernetes/helm/templates/webui-ingress.yaml | 2 +- kubernetes/helm/values.yaml | 4 ++++ 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/kubernetes/helm/templates/_helpers.tpl b/kubernetes/helm/templates/_helpers.tpl index 0ed9ddeae..0647a42ae 100644 --- a/kubernetes/helm/templates/_helpers.tpl +++ b/kubernetes/helm/templates/_helpers.tpl @@ -6,6 +6,10 @@ ollama {{- end -}} +{{- define "ollama.url" -}} +{{- printf "http://%s.%s.svc.cluster.local:%d/api" (include "ollama.name" .) (.Release.Namespace) (.Values.ollama.service.port | int) }} +{{- end }} + {{- define "chart.name" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} {{- end }} diff --git a/kubernetes/helm/templates/ollama-statefulset.yaml b/kubernetes/helm/templates/ollama-statefulset.yaml index da88de82c..db7ffe456 100644 --- a/kubernetes/helm/templates/ollama-statefulset.yaml +++ b/kubernetes/helm/templates/ollama-statefulset.yaml @@ -23,6 +23,11 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: + enableServiceLinks: false + automountServiceAccountToken: false + {{- with .Values.ollama.runtimeClassName }} + runtimeClassName: {{ . }} + {{- end }} containers: - name: {{ include "ollama.name" . }} {{- with .Values.ollama.image }} diff --git a/kubernetes/helm/templates/webui-deployment.yaml b/kubernetes/helm/templates/webui-deployment.yaml index 766cd1887..4b6605e18 100644 --- a/kubernetes/helm/templates/webui-deployment.yaml +++ b/kubernetes/helm/templates/webui-deployment.yaml @@ -22,6 +22,8 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: + enableServiceLinks: false + automountServiceAccountToken: false containers: - name: {{ .Chart.Name }} {{- with .Values.webui.image }} @@ -39,7 +41,7 @@ spec: mountPath: /app/backend/data env: - name: OLLAMA_API_BASE_URL - value: {{ printf "http://%s.%s.svc.cluster.local:%s/api" (include "ollama.name" .) (.Release.Namespace) (.Values.ollama.servicePort) | quote }} + value: {{ include "ollama.url" . | quote }} tty: true {{- with .Values.webui.nodeSelector }} nodeSelector: diff --git a/kubernetes/helm/templates/webui-ingress.yaml b/kubernetes/helm/templates/webui-ingress.yaml index 2c6b045f3..4513b39de 100644 --- a/kubernetes/helm/templates/webui-ingress.yaml +++ b/kubernetes/helm/templates/webui-ingress.yaml @@ -20,5 +20,5 @@ spec: service: name: {{ include "open-webui.name" . }} port: - number: {{ .Values.webui.service.port }} + name: http {{- end }} diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index d7db1d663..fa8cca52f 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -1,3 +1,5 @@ +nameOverride: "" + ollama: annotations: {} podAnnotations: {} @@ -16,6 +18,8 @@ ollama: selector: {} annotations: {} nodeSelector: {} + # -- If using a special runtime container such as nvidia, set it here. + runtimeClassName: "" tolerations: - key: nvidia.com/gpu operator: Exists From 2f0ed3becbc34b6526665954b4927100b2d688b0 Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 23:37:05 +0100 Subject: [PATCH 12/18] add ingress tls and settings --- kubernetes/helm/templates/webui-ingress.yaml | 9 +++++++++ kubernetes/helm/values.yaml | 3 +++ 2 files changed, 12 insertions(+) diff --git a/kubernetes/helm/templates/webui-ingress.yaml b/kubernetes/helm/templates/webui-ingress.yaml index 4513b39de..ea9f95e16 100644 --- a/kubernetes/helm/templates/webui-ingress.yaml +++ b/kubernetes/helm/templates/webui-ingress.yaml @@ -10,6 +10,15 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} spec: + {{- with .Values.webui.ingress.class }} + ingressClassName: {{ . }} + {{- end }} + {{- if .Values.webui.ingress.tls }} + tls: + - hosts: + - {{ .Values.webui.ingress.host | quote }} + secretName: {{ default (printf "%s-tls" .Release.Name) .Values.webui.ingress.existingSecret }} + {{- end }} rules: - host: {{ .Values.webui.ingress.host }} http: diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index fa8cca52f..bdc1d902d 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -44,10 +44,13 @@ webui: resources: {} ingress: enabled: false + class: "" # -- Use appropriate annotations for your Ingress controller, e.g., for NGINX: # nginx.ingress.kubernetes.io/rewrite-target: / annotations: {} host: "" + tls: false + existingSecret: "" persistence: enabled: true size: 30Gi From a91a22567d03ff66c7867c6c9ca87390e455509b Mon Sep 17 00:00:00 2001 From: duhow Date: Mon, 19 Feb 2024 23:39:09 +0100 Subject: [PATCH 13/18] add values-minikube --- kubernetes/helm/.helmignore | 1 + kubernetes/helm/values-minikube.yaml | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 kubernetes/helm/values-minikube.yaml diff --git a/kubernetes/helm/.helmignore b/kubernetes/helm/.helmignore index e69de29bb..e8065247a 100644 --- a/kubernetes/helm/.helmignore +++ b/kubernetes/helm/.helmignore @@ -0,0 +1 @@ +values-minikube.yaml diff --git a/kubernetes/helm/values-minikube.yaml b/kubernetes/helm/values-minikube.yaml new file mode 100644 index 000000000..1b67b0b7c --- /dev/null +++ b/kubernetes/helm/values-minikube.yaml @@ -0,0 +1,27 @@ +ollama: + resources: + requests: + cpu: "2000m" + memory: "2Gi" + limits: + cpu: "4000m" + memory: "4Gi" + nvidia.com/gpu: "0" + service: + type: ClusterIP + gpu: + enabled: false + +webui: + resources: + requests: + cpu: "500m" + memory: "500Mi" + limits: + cpu: "1000m" + memory: "1Gi" + ingress: + enabled: true + host: open-webui.minikube.local + service: + type: NodePort From f5ac3a1ebf4678cca42c559bd1628aae3bbcca0e Mon Sep 17 00:00:00 2001 From: duhow Date: Tue, 20 Feb 2024 00:06:53 +0100 Subject: [PATCH 14/18] update webui size --- kubernetes/helm/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index bdc1d902d..0245f4a69 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -53,7 +53,7 @@ webui: existingSecret: "" persistence: enabled: true - size: 30Gi + size: 2Gi # -- If using multiple replicas, you must update accessModes to ReadWriteMany accessModes: - ReadWriteOnce From 7d947c2988bc18696d670ebc8ae264d35adc1bf2 Mon Sep 17 00:00:00 2001 From: duhow Date: Fri, 23 Feb 2024 11:09:25 +0100 Subject: [PATCH 15/18] fix types --- kubernetes/helm/templates/ollama-service.yaml | 4 ++-- kubernetes/helm/templates/ollama-statefulset.yaml | 2 +- kubernetes/helm/templates/webui-service.yaml | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kubernetes/helm/templates/ollama-service.yaml b/kubernetes/helm/templates/ollama-service.yaml index 75d06e69d..becb6ad27 100644 --- a/kubernetes/helm/templates/ollama-service.yaml +++ b/kubernetes/helm/templates/ollama-service.yaml @@ -16,6 +16,6 @@ spec: ports: - protocol: TCP name: http - port: http - targetPort: {{ .port }} + port: {{ .port }} + targetPort: http {{- end }} diff --git a/kubernetes/helm/templates/ollama-statefulset.yaml b/kubernetes/helm/templates/ollama-statefulset.yaml index db7ffe456..a87aeab09 100644 --- a/kubernetes/helm/templates/ollama-statefulset.yaml +++ b/kubernetes/helm/templates/ollama-statefulset.yaml @@ -70,7 +70,7 @@ spec: - name: data emptyDir: {} {{- else if and .Values.ollama.persistence.enabled (not .Values.ollama.persistence.existingClaim) }} - {} + [] volumeClaimTemplates: - metadata: name: data diff --git a/kubernetes/helm/templates/webui-service.yaml b/kubernetes/helm/templates/webui-service.yaml index bd87c853d..bfae9294d 100644 --- a/kubernetes/helm/templates/webui-service.yaml +++ b/kubernetes/helm/templates/webui-service.yaml @@ -11,9 +11,9 @@ spec: type: {{ .type }} ports: - protocol: TCP - port: http - targetPort: {{ .port }} + port: {{ .port }} + targetPort: http {{- if .nodePort }} - nodePort: {{ .nodePort }} + nodePort: {{ .nodePort | int }} {{- end }} {{- end }} From dd64b1e693787e1fd0b7db2024cdaa0845444279 Mon Sep 17 00:00:00 2001 From: duhow Date: Fri, 23 Feb 2024 11:24:19 +0100 Subject: [PATCH 16/18] use "latest" as appVersion --- kubernetes/helm/Chart.yaml | 2 +- kubernetes/helm/templates/webui-deployment.yaml | 2 +- kubernetes/helm/values.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kubernetes/helm/Chart.yaml b/kubernetes/helm/Chart.yaml index c05b44235..ab5b41df6 100644 --- a/kubernetes/helm/Chart.yaml +++ b/kubernetes/helm/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: open-webui version: 1.0.0 -appVersion: 1.0.0-alpha.100 +appVersion: "latest" home: https://www.openwebui.com/ icon: https://raw.githubusercontent.com/open-webui/open-webui/main/static/favicon.png diff --git a/kubernetes/helm/templates/webui-deployment.yaml b/kubernetes/helm/templates/webui-deployment.yaml index 4b6605e18..df13a14b6 100644 --- a/kubernetes/helm/templates/webui-deployment.yaml +++ b/kubernetes/helm/templates/webui-deployment.yaml @@ -27,7 +27,7 @@ spec: containers: - name: {{ .Chart.Name }} {{- with .Values.webui.image }} - image: {{ .repository }}:{{ .tag }} + image: {{ .repository }}:{{ .tag | default $.Chart.AppVersion }} imagePullPolicy: {{ .pullPolicy }} {{- end }} ports: diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index 0245f4a69..02e87e809 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -39,7 +39,7 @@ webui: replicaCount: 1 image: repository: ghcr.io/open-webui/open-webui - tag: latest + tag: "" pullPolicy: Always resources: {} ingress: From 9ee64d88c61b6b1e1047eb5911f5ff4c1823165a Mon Sep 17 00:00:00 2001 From: duhow Date: Fri, 23 Feb 2024 17:41:17 +0100 Subject: [PATCH 17/18] add missing existingClaim name --- kubernetes/helm/values.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index 02e87e809..3104dc842 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -12,6 +12,7 @@ ollama: persistence: enabled: true size: 30Gi + existingClaim: "" accessModes: - ReadWriteOnce storageClass: "" @@ -54,6 +55,7 @@ webui: persistence: enabled: true size: 2Gi + existingClaim: "" # -- If using multiple replicas, you must update accessModes to ReadWriteMany accessModes: - ReadWriteOnce From 8eb6a68fcffbf58cf277ab532fd80e0b7a8c41e8 Mon Sep 17 00:00:00 2001 From: duhow Date: Fri, 23 Feb 2024 23:58:10 +0100 Subject: [PATCH 18/18] fix webui-service --- kubernetes/helm/templates/webui-service.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kubernetes/helm/templates/webui-service.yaml b/kubernetes/helm/templates/webui-service.yaml index bfae9294d..58da030d3 100644 --- a/kubernetes/helm/templates/webui-service.yaml +++ b/kubernetes/helm/templates/webui-service.yaml @@ -4,6 +4,10 @@ metadata: name: {{ include "open-webui.name" . }} labels: {{- include "open-webui.labels" . | nindent 4 }} + {{- with .Values.webui.service.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} spec: selector: {{- include "open-webui.selectorLabels" . | nindent 4 }} @@ -11,6 +15,7 @@ spec: type: {{ .type }} ports: - protocol: TCP + name: http port: {{ .port }} targetPort: http {{- if .nodePort }}