2023-12-24 15:34:33 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: StatefulSet
|
|
|
|
metadata:
|
2024-02-19 20:58:25 +00:00
|
|
|
name: {{ include "ollama.name" . }}
|
2024-02-19 21:23:36 +00:00
|
|
|
labels:
|
|
|
|
{{- include "ollama.labels" . | nindent 4 }}
|
2024-02-19 22:22:10 +00:00
|
|
|
{{- with .Values.ollama.annotations }}
|
|
|
|
annotations:
|
|
|
|
{{- toYaml . | nindent 4 }}
|
|
|
|
{{- end }}
|
2023-12-24 15:34:33 +00:00
|
|
|
spec:
|
2024-02-19 20:58:25 +00:00
|
|
|
serviceName: {{ include "ollama.name" . }}
|
2023-12-24 15:34:33 +00:00
|
|
|
replicas: {{ .Values.ollama.replicaCount }}
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
2024-02-19 21:23:36 +00:00
|
|
|
{{- include "ollama.selectorLabels" . | nindent 6 }}
|
2023-12-24 15:34:33 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
2024-02-19 21:33:22 +00:00
|
|
|
{{- include "ollama.labels" . | nindent 8 }}
|
2024-02-19 22:22:10 +00:00
|
|
|
{{- with .Values.ollama.podAnnotations }}
|
|
|
|
annotations:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
2023-12-24 15:34:33 +00:00
|
|
|
spec:
|
2024-02-19 22:32:50 +00:00
|
|
|
enableServiceLinks: false
|
|
|
|
automountServiceAccountToken: false
|
|
|
|
{{- with .Values.ollama.runtimeClassName }}
|
|
|
|
runtimeClassName: {{ . }}
|
|
|
|
{{- end }}
|
2023-12-24 15:34:33 +00:00
|
|
|
containers:
|
2024-02-19 21:23:36 +00:00
|
|
|
- name: {{ include "ollama.name" . }}
|
2024-02-19 21:43:03 +00:00
|
|
|
{{- with .Values.ollama.image }}
|
|
|
|
image: {{ .repository }}:{{ .tag }}
|
|
|
|
imagePullPolicy: {{ .pullPolicy }}
|
|
|
|
{{- end }}
|
2024-02-19 22:18:06 +00:00
|
|
|
tty: true
|
2023-12-24 15:34:33 +00:00
|
|
|
ports:
|
2024-02-19 21:33:22 +00:00
|
|
|
- name: http
|
|
|
|
containerPort: {{ .Values.ollama.service.containerPort }}
|
2023-12-28 15:28:09 +00:00
|
|
|
env:
|
|
|
|
{{- if .Values.ollama.gpu.enabled }}
|
|
|
|
- name: PATH
|
|
|
|
value: /usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
- name: LD_LIBRARY_PATH
|
|
|
|
value: /usr/local/nvidia/lib:/usr/local/nvidia/lib64
|
|
|
|
- name: NVIDIA_DRIVER_CAPABILITIES
|
|
|
|
value: compute,utility
|
2024-02-19 21:43:03 +00:00
|
|
|
{{- end }}
|
2024-02-19 21:23:36 +00:00
|
|
|
{{- with .Values.ollama.resources }}
|
|
|
|
resources: {{- toYaml . | nindent 10 }}
|
2023-12-28 15:28:09 +00:00
|
|
|
{{- end }}
|
2023-12-24 15:34:33 +00:00
|
|
|
volumeMounts:
|
2024-02-19 22:18:06 +00:00
|
|
|
- name: data
|
2023-12-24 15:34:33 +00:00
|
|
|
mountPath: /root/.ollama
|
2023-12-28 15:28:09 +00:00
|
|
|
{{- with .Values.ollama.nodeSelector }}
|
|
|
|
nodeSelector:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
2024-02-19 21:43:03 +00:00
|
|
|
{{- with .Values.ollama.tolerations }}
|
2023-12-28 15:28:09 +00:00
|
|
|
tolerations:
|
2024-02-19 21:43:03 +00:00
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
2024-02-19 22:18:06 +00:00
|
|
|
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) }}
|
2024-02-23 10:09:25 +00:00
|
|
|
[]
|
2023-12-24 15:34:33 +00:00
|
|
|
volumeClaimTemplates:
|
|
|
|
- metadata:
|
2024-02-19 22:18:06 +00:00
|
|
|
name: data
|
|
|
|
labels:
|
|
|
|
{{- include "ollama.selectorLabels" . | nindent 8 }}
|
|
|
|
{{- with .Values.ollama.persistence.annotations }}
|
|
|
|
annotations:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
2023-12-24 15:34:33 +00:00
|
|
|
spec:
|
2024-02-19 22:18:06 +00:00
|
|
|
accessModes:
|
|
|
|
{{- range .Values.ollama.persistence.accessModes }}
|
|
|
|
- {{ . | quote }}
|
|
|
|
{{- end }}
|
2023-12-24 15:34:33 +00:00
|
|
|
resources:
|
|
|
|
requests:
|
2024-02-19 22:18:06 +00:00
|
|
|
storage: {{ .Values.ollama.persistence.size | quote }}
|
2024-03-28 00:35:21 +00:00
|
|
|
storageClassName: {{ .Values.ollama.persistence.storageClass }}
|
2024-02-19 22:18:06 +00:00
|
|
|
{{- with .Values.ollama.persistence.selector }}
|
|
|
|
selector:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|