make ollama install work with external urls

This commit is contained in:
robrakaric 2024-05-07 14:12:36 -07:00
parent aa04934217
commit 827d0f0dee
No known key found for this signature in database
GPG Key ID: 2C5BDB4E806BE943
6 changed files with 44 additions and 14 deletions

View File

@ -2,5 +2,5 @@ dependencies:
- name: ollama
repository: https://otwld.github.io/ollama-helm/
version: 0.24.1
digest: sha256:5f063bf2874fa7bbf38c3eb34094301f3a818cc13c0eeffb010dd09a42f0371d
generated: "2024-05-07T12:10:01.451609-07:00"
digest: sha256:81e6126e017a7063c0074cf7b38bca8537d220053255f0669c98a6f67e9360e6
generated: "2024-05-07T13:24:36.081504-07:00"

View File

@ -25,4 +25,8 @@ dependencies:
- name: ollama
repository: https://otwld.github.io/ollama-helm/
version: ">=0.24.0"
import-values:
- child: service
parent: ollama.service
condition: ollama.enabled

View File

@ -1,6 +1,6 @@
# open-webui
![Version: 1.0.1](https://img.shields.io/badge/Version-1.0.1-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)
![Version: 2.0.0](https://img.shields.io/badge/Version-2.0.0-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square)
Open WebUI: A User-Friendly Web Interface for Chat Interactions 👋
@ -9,8 +9,9 @@ Open WebUI: A User-Friendly Web Interface for Chat Interactions 👋
## Source Code
* <https://github.com/open-webui/helm-charts>
* <https://hub.docker.com/r/ollama/ollama>
* <https://github.com/open-webui/open-webui/pkgs/container/open-webui>
* <https://github.com/otwld/ollama-helm/>
* <https://hub.docker.com/r/ollama/ollama>
## Installing
@ -27,11 +28,19 @@ Now you can install the chart:
helm upgrade --install open-webui open-webui/open-webui
```
## Requirements
| Repository | Name | Version |
|------------|------|---------|
| https://otwld.github.io/ollama-helm/ | ollama | >=0.24.0 |
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| annotations | object | `{}` | |
| clusterDomain | string | `"cluster.local"` | Value of cluster domain |
| externalHosts | list | `[]` | A list of Ollama API endpoints. These can be added in lieu of automatically installing the Ollama Helm chart, or in addition to it. |
| image.pullPolicy | string | `"Always"` | |
| image.repository | string | `"ghcr.io/open-webui/open-webui"` | |
| image.tag | string | `""` | |
@ -43,7 +52,7 @@ helm upgrade --install open-webui open-webui/open-webui
| ingress.tls | bool | `false` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| ollama.enabled | bool | `false` | Automatically install Ollama Helm chart from https://otwld.github.io/ollama-helm/. Use [Helm Values](https://github.com/otwld/ollama-helm/#helm-values) to configure |
| ollama.enabled | bool | `true` | Automatically install Ollama Helm chart from https://otwld.github.io/ollama-helm/. Use [Helm Values](https://github.com/otwld/ollama-helm/#helm-values) to configure |
| persistence.accessModes | list | `["ReadWriteOnce"]` | If using multiple replicas, you must update accessModes to ReadWriteMany |
| persistence.annotations | object | `{}` | |
| persistence.enabled | bool | `true` | |

View File

@ -5,14 +5,27 @@
ollama
{{- end -}}
{{- define "ollama.url" -}}
{{- if .Values.ollama.externalHost }}
{{- printf .Values.externalHost }}
{{- else }}
{{- printf "http://%s.%s.svc.cluster.local:%d" (include "ollama.name" .) (.Release.Namespace) (.Values.ollama.service.port | int) }}
{{- define "externalHostUrls" -}}
{{- if .Values.externalHosts }}
{{- join ";" .Values.externalHosts }}
{{- end }}
{{- end }}
{{- define "ollamaLocalUrl" -}}
{{- if .Values.ollama.enabled -}}
{{- $clusterDomain := .Values.clusterDomain }}
{{- $ollamaServicePort := .Values.ollama.service.port | toString }}
{{- printf "http://open-webui-%s.%s.svc.%s:%s" (include "ollama.name" .) (.Release.Namespace) $clusterDomain $ollamaServicePort }}
{{- end }}
{{- end }}
{{- define "ollamaBaseUrls" -}}
{{- $ollamaLocalUrl := include "ollamaLocalUrl" . }}
{{- $externalHostUrls := include "externalHostUrls" . }}
{{- printf "%s;%s" $externalHostUrls $ollamaLocalUrl -}}
{{- end }}
{{- define "chart.name" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

View File

@ -40,8 +40,8 @@ spec:
- name: data
mountPath: /app/backend/data
env:
- name: OLLAMA_BASE_URL
value: {{ include "ollama.url" . | quote }}
- name: OLLAMA_BASE_URLS
value: {{ include "ollamaBaseUrls" . | quote }}
tty: true
{{- with .Values.nodeSelector }}
nodeSelector:

View File

@ -2,9 +2,13 @@ nameOverride: ""
ollama:
# -- Automatically install Ollama Helm chart from https://otwld.github.io/ollama-helm/. Use [Helm Values](https://github.com/otwld/ollama-helm/#helm-values) to configure
enabled: false
enabled: true
externalHosts:
# -- A list of Ollama API endpoints. These can be added in lieu of automatically installing the Ollama Helm chart, or in addition to it.
externalHosts: []
# -- Value of cluster domain
clusterDomain: cluster.local
annotations: {}
podAnnotations: {}