---
{{- if not .Values.knative.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ include "ollama.fullname" . }}
  namespace: {{ include "ollama.namespace" . }}
  labels:
    {{- include "ollama.labels" . | nindent 4 }}
  {{- with .Values.service.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: http
      {{- if contains "NodePort" .Values.service.type }}
      nodePort: {{ .Values.service.nodePort }}
      {{- end }}
{{- if .Values.service.loadBalancerIP }}
  loadBalancerIP: {{ .Values.service.loadBalancerIP | quote }}
{{- end }}
  selector:
    {{- include "ollama.selectorLabels" . | nindent 4 }}
{{- end }}
