diff --git a/Chart.yaml b/Chart.yaml deleted file mode 100644 index 57b448e..0000000 --- a/Chart.yaml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: v2 -name: ollama -description: Kubernetes Helm chart to deploy Ollama for Large Language Models - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.1 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "0.1.32" diff --git a/templates/NOTES.txt b/templates/NOTES.txt deleted file mode 100644 index 80022d3..0000000 --- a/templates/NOTES.txt +++ /dev/null @@ -1,20 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ui.ingress.enabled }} -{{- range $host := .Values.ui.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ui.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.ui.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ (printf "%s-webui" (include "ollama.fullname" .)) }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.ui.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "ollama.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ (printf "%s-webui" (include "ollama.fullname" .)) }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.ui.service.port }} -{{- else if contains "ClusterIP" .Values.ui.service.type }} - echo "Visit http://127.0.0.1:8080 to access Ollama WebUI." - kubectl --namespace {{ .Release.Namespace }} port-forward service/{{ (printf "%s-webui" (include "ollama.fullname" .)) }} 8080:{{ .Values.ui.service.port }} -{{- end }} diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl deleted file mode 100644 index eb4e71f..0000000 --- a/templates/_helpers.tpl +++ /dev/null @@ -1,70 +0,0 @@ -{{/* -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.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "ollama.selectorLabelsUI" -}} -app.kubernetes.io/name: {{ (printf "%s-webui" (include "ollama.name" .)) }} -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 }} diff --git a/templates/hpa.yaml b/templates/hpa.yaml deleted file mode 100644 index 9629c6b..0000000 --- a/templates/hpa.yaml +++ /dev/null @@ -1,32 +0,0 @@ -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "ollama.fullname" . }} - labels: - {{- include "ollama.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "ollama.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - target: - type: Utilization - averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - target: - type: Utilization - averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/templates/ingress.yaml b/templates/ingress.yaml deleted file mode 100644 index 913dc05..0000000 --- a/templates/ingress.yaml +++ /dev/null @@ -1,61 +0,0 @@ -{{- if .Values.ui.ingress.enabled -}} -{{- $fullName := include "ollama.fullname" . -}}-webui -{{- $svcPort := .Values.ui.service.port -}} -{{- if and .Values.ui.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ui.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ui.ingress.annotations "kubernetes.io/ingress.class" .Values.ui.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "ollama.labels" . | nindent 4 }} - {{- with .Values.ui.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ui.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ui.ingress.className }} - {{- end }} - {{- if .Values.ui.ingress.tls }} - tls: - {{- range .Values.ui.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ui.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/templates/llm-job.yaml b/templates/llm-job.yaml deleted file mode 100644 index 5f172f6..0000000 --- a/templates/llm-job.yaml +++ /dev/null @@ -1,31 +0,0 @@ -{{- if .Values.llm.models -}} -apiVersion: batch/v1 -kind: Job -metadata: - name: {{ (printf "%s-llm-puller" (include "ollama.fullname" .)) }} - labels: - {{- include "ollama.labels" . | nindent 4 }} -spec: - ttlSecondsAfterFinished: 100 - template: - spec: - containers: - - name: llm-puller - image: alpine - command: - - /bin/sh - - -c - - | - set -e - apk add --no-cache curl - ollama_service="http://{{ include "ollama.fullname" . }}:{{ .Values.service.port }}" - while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' ${ollama_service})" != "200" ]]; do - echo "Waiting for Ollama service to be ready..." - sleep 5 - done - {{- range $model := .Values.llm.models }} - echo "Pulling model: {{ $model }}" - curl -s ${ollama_service}/api/pull -d '{"name": "{{ $model }}"}' - {{- end }} - restartPolicy: Never -{{- end -}} diff --git a/templates/ollama-pvc.yaml b/templates/ollama-pvc.yaml deleted file mode 100644 index b675fa8..0000000 --- a/templates/ollama-pvc.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if .Values.persistentVolume.enabled -}} -{{- if not .Values.persistentVolume.claimName -}} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ include "ollama.fullname" . }} - labels: - {{- include "ollama.labels" . | nindent 4 }} -spec: - accessModes: -{{ toYaml .Values.persistentVolume.accessModes | indent 4 }} - storageClassName: "{{ .Values.persistentVolume.storageClass }}" - resources: - requests: - storage: "{{ .Values.persistentVolume.size }}" -{{- end -}} -{{- end -}} diff --git a/templates/ollama-service.yaml b/templates/ollama-service.yaml deleted file mode 100644 index 9df514f..0000000 --- a/templates/ollama-service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "ollama.fullname" . }} - labels: - {{- include "ollama.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: 11434 - protocol: TCP - name: http - selector: - {{- include "ollama.selectorLabels" . | nindent 4 }} diff --git a/templates/ollama.yaml b/templates/ollama.yaml deleted file mode 100644 index 6cf82fe..0000000 --- a/templates/ollama.yaml +++ /dev/null @@ -1,75 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "ollama.fullname" . }} - labels: - {{- include "ollama.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "ollama.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "ollama.labels" . | nindent 8 }} - {{- with .Values.podLabels }} - {{- toYaml . | nindent 8 }} - {{- end }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 11434 - protocol: TCP - livenessProbe: - {{- toYaml .Values.livenessProbe | nindent 12 }} - readinessProbe: - {{- toYaml .Values.readinessProbe | nindent 12 }} - resources: - {{- toYaml .Values.resources | nindent 12 }} - env: - - name: OLLAMA_ORIGINS - value: "*" - - name: OLLAMA_HOST - value: "0.0.0.0" - volumeMounts: - - name: llm-data - mountPath: /root/.ollama - volumes: - - name: llm-data - {{- if .Values.persistentVolume.enabled }} - persistentVolumeClaim: - claimName: {{ .Values.persistentVolume.claimName | default (printf "%s" (include "ollama.fullname" .)) }} - {{- else }} - emptyDir: { } - {{- end }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/templates/webui-pvc.yaml b/templates/webui-pvc.yaml deleted file mode 100644 index d57436d..0000000 --- a/templates/webui-pvc.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if .Values.ui.persistentVolume.enabled -}} -{{- if not .Values.ui.persistentVolume.claimName -}} -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: {{ (printf "%s-webui" (include "ollama.fullname" .)) }} - labels: - {{- include "ollama.labels" . | nindent 4 }} -spec: - accessModes: -{{ toYaml .Values.ui.persistentVolume.accessModes | indent 4 }} - storageClassName: "{{ .Values.ui.persistentVolume.storageClass }}" - resources: - requests: - storage: "{{ .Values.ui.persistentVolume.size }}" -{{- end -}} -{{- end -}} diff --git a/templates/webui-service.yaml b/templates/webui-service.yaml deleted file mode 100644 index f6d8beb..0000000 --- a/templates/webui-service.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ (printf "%s-webui" (include "ollama.fullname" .)) }} - labels: - {{- include "ollama.labels" . | nindent 4 }} -spec: - type: {{ .Values.ui.service.type }} - ports: - - port: {{ .Values.ui.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "ollama.selectorLabelsUI" . | nindent 4 }} diff --git a/templates/webui.yaml b/templates/webui.yaml deleted file mode 100644 index 38242b9..0000000 --- a/templates/webui.yaml +++ /dev/null @@ -1,74 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ (printf "%s-webui" (include "ollama.fullname" .)) }} - labels: - {{- include "ollama.labels" . | nindent 4 }} -spec: - replicas: {{ .Values.ui.replicaCount }} - selector: - matchLabels: - {{- include "ollama.selectorLabelsUI" . | nindent 6 }} - template: - metadata: - labels: - {{- include "ollama.labels" . | nindent 8 }} - {{- include "ollama.selectorLabelsUI" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - containers: - - name: webui - image: "{{ .Values.ui.image.repository }}:{{ .Values.ui.image.tag }}" - imagePullPolicy: {{ .Values.ui.image.pullPolicy }} - ports: - - name: http - {{- if eq .Values.ui.type "open-webui" }} - containerPort: 8080 - {{- else if eq .Values.ui.type "lobe-chat" }} - containerPort: 3210 - {{- end }} - protocol: TCP - resources: - requests: - cpu: "100m" - memory: "50Mi" - limits: - cpu: "1000m" - memory: "1Gi" - env: - - name: OLLAMA_BASE_URL - value: {{ (printf "http://%s" (include "ollama.fullname" .)) }}:{{ .Values.service.port }} - - name: OLLAMA_PROXY_URL - value: {{ (printf "http://%s" (include "ollama.fullname" .)) }}:{{ .Values.service.port }} - - name: DATA_DIR - value: "/data" - livenessProbe: - {{- toYaml .Values.livenessProbe | nindent 12 }} - readinessProbe: - {{- toYaml .Values.readinessProbe | nindent 12 }} - volumeMounts: - - name: webui-data - mountPath: /data - volumes: - - name: webui-data - {{- if .Values.ui.persistentVolume.enabled }} - persistentVolumeClaim: - claimName: {{ .Values.ui.persistentVolume.claimName | default (printf "%s-webui" (include "ollama.fullname" .)) }} - {{- else }} - emptyDir: { } - {{- end }} - {{- with .Values.ui.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.ui.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.ui.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/values.yaml b/values.yaml deleted file mode 100644 index 3459d0d..0000000 --- a/values.yaml +++ /dev/null @@ -1,119 +0,0 @@ -############ Configuration for Ollama ############ -image: - repository: ollama/ollama - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - -replicaCount: 1 # Number of replicas, need storge class support of multiple read when pvc enabled and replica > 1 - -llm: - models: ["phi3", "llama3"] # List of models to be pre-loaded (refer https://ollama.com/library for the supported models) - -persistentVolume: # If true, use a Persistent Volume Claim, If false, use emptyDir - enabled: true - storageClass: "default" - accessModes: - - ReadWriteOnce - size: 30Gi - claimName: "" # set to non-empty value to use an existing PVC - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" -podAnnotations: {} -podLabels: {} - -podSecurityContext: - {} - # fsGroup: 2000 - -securityContext: - {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 11434 - -resources: - limits: - cpu: 4 - memory: 4Gi - nvidia.com/gpu: "1" - # amd.com/gpu: "1" - requests: - cpu: 100m - memory: 128Mi - nvidia.com/gpu: "1" - # amd.com/gpu: "1" - -livenessProbe: - httpGet: - path: / - port: http -readinessProbe: - httpGet: - path: / - port: http - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: - - key: kubernetes.azure.com/scalesetpriority - operator: Exists - -affinity: {} - -############ Configuration for Ollama WebUI ############ -ui: - enabled: true - replicaCount: 1 - type: "lobe-chat" # Supported values are "open-webui" and "lobe-chat" - image: - repository: lobehub/lobe-chat # or use ghcr.io/open-webui/open-webui for "open-webui" - pullPolicy: IfNotPresent - tag: "latest" - service: - type: ClusterIP - port: 80 - nodeSelector: {} - tolerations: {} - affinity: {} - - ingress: - enabled: false - className: "" - annotations: - {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - - persistentVolume: # If true, use a Persistent Volume Claim, If false, use emptyDir - enabled: true - storageClass: "default" - accessModes: - - ReadWriteOnce - size: 10Gi - claimName: "" # set to non-empty value to use an existing PVC