forked from open-webui/open-webui
add labels and selectors
This commit is contained in:
parent
cbaada1410
commit
0b7f183a03
7 changed files with 75 additions and 23 deletions
|
@ -5,3 +5,39 @@
|
||||||
{{- define "ollama.name" -}}
|
{{- define "ollama.name" -}}
|
||||||
ollama
|
ollama
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "chart.name" -}}
|
||||||
|
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "base.labels" -}}
|
||||||
|
helm.sh/chart: {{ include "chart.name" . }}
|
||||||
|
{{- if .Chart.AppVersion }}
|
||||||
|
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||||
|
{{- end }}
|
||||||
|
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "base.selectorLabels" -}}
|
||||||
|
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
{{- define "open-webui.selectorLabels" -}}
|
||||||
|
{{ include "base.selectorLabels" . }}
|
||||||
|
app.kubernetes.io/component: {{ .Chart.Name }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "open-webui.labels" -}}
|
||||||
|
{{ include "base.labels" . }}
|
||||||
|
{{ include "open-webui.selectorLabels" . }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "ollama.selectorLabels" -}}
|
||||||
|
{{ include "base.selectorLabels" . }}
|
||||||
|
app.kubernetes.io/component: {{ include "ollama.name" . }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
{{- define "ollama.labels" -}}
|
||||||
|
{{ include "base.labels" . }}
|
||||||
|
{{ include "ollama.selectorLabels" . }}
|
||||||
|
{{- end }}
|
||||||
|
|
|
@ -2,11 +2,16 @@ apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "ollama.name" . }}
|
name: {{ include "ollama.name" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "ollama.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
type: {{ .Values.ollama.service.type }}
|
|
||||||
selector:
|
selector:
|
||||||
app: ollama
|
{{- include "ollama.selectorLabels" . | nindent 4 }}
|
||||||
|
{{- with .Values.ollama.service }}
|
||||||
|
type: {{ .type }}
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: {{ .Values.ollama.servicePort }}
|
name: http
|
||||||
targetPort: {{ .Values.ollama.servicePort }}
|
port: {{ .port }}
|
||||||
|
targetPort: {{ .containerPort }}
|
||||||
|
{{- end }}
|
||||||
|
|
|
@ -2,19 +2,21 @@ apiVersion: apps/v1
|
||||||
kind: StatefulSet
|
kind: StatefulSet
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "ollama.name" . }}
|
name: {{ include "ollama.name" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "ollama.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
serviceName: {{ include "ollama.name" . }}
|
serviceName: {{ include "ollama.name" . }}
|
||||||
replicas: {{ .Values.ollama.replicaCount }}
|
replicas: {{ .Values.ollama.replicaCount }}
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: ollama
|
{{- include "ollama.selectorLabels" . | nindent 6 }}
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: ollama
|
{{- include "ollama.selectorLabels" . | nindent 8 }}
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: ollama
|
- name: {{ include "ollama.name" . }}
|
||||||
image: {{ .Values.ollama.image }}
|
image: {{ .Values.ollama.image }}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: {{ .Values.ollama.servicePort }}
|
- containerPort: {{ .Values.ollama.servicePort }}
|
||||||
|
@ -27,8 +29,8 @@ spec:
|
||||||
- name: NVIDIA_DRIVER_CAPABILITIES
|
- name: NVIDIA_DRIVER_CAPABILITIES
|
||||||
value: compute,utility
|
value: compute,utility
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{- if .Values.ollama.resources }}
|
{{- with .Values.ollama.resources }}
|
||||||
resources: {{- toYaml .Values.ollama.resources | nindent 10 }}
|
resources: {{- toYaml . | nindent 10 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: ollama-volume
|
- name: ollama-volume
|
||||||
|
|
|
@ -2,23 +2,25 @@ apiVersion: apps/v1
|
||||||
kind: Deployment
|
kind: Deployment
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "open-webui.name" . }}
|
name: {{ include "open-webui.name" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "open-webui.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
replicas: 1
|
replicas: 1
|
||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
app: open-webui
|
{{- include "open-webui.selectorLabels" . | nindent 6 }}
|
||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
labels:
|
labels:
|
||||||
app: open-webui
|
{{- include "open-webui.selectorLabels" . | nindent 8 }}
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
image: {{ .Values.webui.image }}
|
image: {{ .Values.webui.image }}
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
{{- if .Values.webui.resources }}
|
{{- with .Values.webui.resources }}
|
||||||
resources: {{- toYaml .Values.webui.resources | nindent 10 }}
|
resources: {{- toYaml . | nindent 10 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: webui-volume
|
- name: webui-volume
|
||||||
|
|
|
@ -3,9 +3,11 @@ apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "open-webui.name" . }}
|
name: {{ include "open-webui.name" . }}
|
||||||
{{- if .Values.webui.ingress.annotations }}
|
labels:
|
||||||
|
{{- include "open-webui.labels" . | nindent 4 }}
|
||||||
|
{{- with .Values.webui.ingress.annotations }}
|
||||||
annotations:
|
annotations:
|
||||||
{{ toYaml .Values.webui.ingress.annotations | trimSuffix "\n" | indent 4 }}
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
rules:
|
rules:
|
||||||
|
|
|
@ -3,7 +3,7 @@ kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "open-webui.name" . }}
|
name: {{ include "open-webui.name" . }}
|
||||||
labels:
|
labels:
|
||||||
app: open-webui
|
{{- include "open-webui.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
accessModes: [ "ReadWriteOnce" ]
|
accessModes: [ "ReadWriteOnce" ]
|
||||||
resources:
|
resources:
|
||||||
|
|
|
@ -2,13 +2,18 @@ apiVersion: v1
|
||||||
kind: Service
|
kind: Service
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ include "open-webui.name" . }}
|
name: {{ include "open-webui.name" . }}
|
||||||
|
labels:
|
||||||
|
{{- include "open-webui.labels" . | nindent 4 }}
|
||||||
spec:
|
spec:
|
||||||
type: {{ .Values.webui.service.type }} # Default: NodePort # Use LoadBalancer if you're on a cloud that supports it
|
|
||||||
selector:
|
selector:
|
||||||
app: open-webui
|
{{- include "open-webui.selectorLabels" . | nindent 4 }}
|
||||||
|
{{- with .Values.webui.service }}
|
||||||
|
type: {{ .type }}
|
||||||
ports:
|
ports:
|
||||||
- protocol: TCP
|
- protocol: TCP
|
||||||
port: {{ .Values.webui.servicePort }}
|
port: {{ .port }}
|
||||||
targetPort: {{ .Values.webui.servicePort }}
|
targetPort: {{ .containerPort }}
|
||||||
# If using NodePort, you can optionally specify the nodePort:
|
{{- if .nodePort }}
|
||||||
# nodePort: 30000
|
nodePort: {{ .nodePort }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
Loading…
Reference in a new issue