diff --git a/charts/ollama-web/Chart.yaml b/charts/ollama-web/Chart.yaml new file mode 100644 index 0000000..1bd9ee3 --- /dev/null +++ b/charts/ollama-web/Chart.yaml @@ -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 diff --git a/charts/ollama-web/templates/_helpers.tpl b/charts/ollama-web/templates/_helpers.tpl new file mode 100644 index 0000000..0c01a35 --- /dev/null +++ b/charts/ollama-web/templates/_helpers.tpl @@ -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 }} \ No newline at end of file diff --git a/charts/ollama-web/templates/deployment.yaml b/charts/ollama-web/templates/deployment.yaml new file mode 100644 index 0000000..6e1c89b --- /dev/null +++ b/charts/ollama-web/templates/deployment.yaml @@ -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 }} \ No newline at end of file diff --git a/charts/ollama-web/templates/service.yaml b/charts/ollama-web/templates/service.yaml new file mode 100644 index 0000000..b23b34e --- /dev/null +++ b/charts/ollama-web/templates/service.yaml @@ -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 \ No newline at end of file diff --git a/charts/ollama-web/values.yaml b/charts/ollama-web/values.yaml new file mode 100644 index 0000000..660e9b7 --- /dev/null +++ b/charts/ollama-web/values.yaml @@ -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