diff --git a/kubernetes/helm/templates/_helpers.tpl b/kubernetes/helm/templates/_helpers.tpl index 3f42735a6..0f5145230 100644 --- a/kubernetes/helm/templates/_helpers.tpl +++ b/kubernetes/helm/templates/_helpers.tpl @@ -7,8 +7,12 @@ ollama {{- end -}} {{- define "ollama.url" -}} +{{- if .Values.ollama.externalHost }} +{{- printf .Values.ollama.externalHost }} +{{- else }} {{- printf "http://%s.%s.svc.cluster.local:%d/" (include "ollama.name" .) (.Release.Namespace) (.Values.ollama.service.port | int) }} {{- end }} +{{- end }} {{- define "chart.name" -}} {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} diff --git a/kubernetes/helm/templates/ollama-service.yaml b/kubernetes/helm/templates/ollama-service.yaml index becb6ad27..32c93caec 100644 --- a/kubernetes/helm/templates/ollama-service.yaml +++ b/kubernetes/helm/templates/ollama-service.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.ollama.externalHost }} apiVersion: v1 kind: Service metadata: @@ -19,3 +20,4 @@ spec: port: {{ .port }} targetPort: http {{- end }} +{{- end }} diff --git a/kubernetes/helm/templates/ollama-statefulset.yaml b/kubernetes/helm/templates/ollama-statefulset.yaml index c348b04c0..2750956ab 100644 --- a/kubernetes/helm/templates/ollama-statefulset.yaml +++ b/kubernetes/helm/templates/ollama-statefulset.yaml @@ -1,3 +1,4 @@ +{{- if not .Values.ollama.externalHost }} apiVersion: apps/v1 kind: StatefulSet metadata: @@ -94,3 +95,4 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} {{- end }} +{{- end }} diff --git a/kubernetes/helm/values.yaml b/kubernetes/helm/values.yaml index 394e5a491..4437973e0 100644 --- a/kubernetes/helm/values.yaml +++ b/kubernetes/helm/values.yaml @@ -1,6 +1,7 @@ nameOverride: "" ollama: + externalHost: "" annotations: {} podAnnotations: {} replicaCount: 1