feat(ollama-web): add front-end for LLM servers

This commit is contained in:
Tommy 2024-02-07 19:37:47 +01:00
parent b66049b6e3
commit 30e15df64f
No known key found for this signature in database
5 changed files with 147 additions and 0 deletions

View file

@ -0,0 +1,15 @@
apiVersion: v2
name: ollama-web
description: ChatGPT-Style Web UI Client for Ollama 🦙
type: application
version: 0.1.0
appVersion: "main"
icon: https://avatars.githubusercontent.com/u/147204191?s=200&v=4
maintainers:
- name: Tommy Skaug
email: tommy@skaug.me
keywords:
- llm
- llama
sources:
- https://ollama.ai

View file

@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ollama.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "ollama.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "ollama.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "ollama.labels" -}}
helm.sh/chart: {{ include "ollama.chart" . }}
{{ include "ollama.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}
{{/*
Selector labels
*/}}
{{- define "ollama.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ollama.fullname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{/*
Create the name of the service account to use
*/}}
{{- define "ollama.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ollama.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ollama.fullname" . }}
labels:
{{- include "ollama.labels" . | nindent 4 }}
spec:
replicas: 1
selector:
matchLabels:
app: {{ include "ollama.fullname" . }}
template:
metadata:
labels:
app: {{ include "ollama.fullname" . }}
spec:
containers:
- name: {{ include "ollama.fullname" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
ports:
- containerPort: 8080
{{- if .Values.resources }}
resources: {{- toYaml .Values.resources | nindent 10 }}
{{- end }}
volumeMounts:
- name: web-volume
mountPath: /app/backend/data
env:
- name: OLLAMA_API_BASE_URL
value: {{ .Values.apiUrl }}
tty: true
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: web-volume
persistentVolumeClaim:
claimName: {{ .Values.persistence.existingClaim }}

View file

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "ollama.fullname" . }}-service
spec:
type: ClusterIP
selector:
app: {{ include "ollama.fullname" . }}
ports:
- protocol: TCP
port: {{ .Values.servicePort }}
targetPort: {{ .Values.servicePort }}
# If using NodePort, you can optionally specify the nodePort:
# nodePort: 30000

View file

@ -0,0 +1,17 @@
replicaCount: 1
image:
repository: ghcr.io/ollama-webui/ollama-webui
tag: "main"
apiUrl: "http://ollama.llm.svc.cluster.local:11434/api"
servicePort: 8080
resources:
limits:
cpu: "500m"
memory: "500Mi"
volumeSize: 1Gi
nodeSelector: {}
tolerations: []
service:
type: NodePort
persistence:
existingClaim: ollama-web