apiVersion: apps/v1
kind: Deployment
metadata:
  name: ollama-server-1
  labels:
    app.kubernetes.io/controller: server-1
    app.kubernetes.io/instance: ollama
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: ollama
    helm.sh/chart: ollama-5.0.1
  namespace: ollama
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/controller: server-1
      app.kubernetes.io/name: ollama
      app.kubernetes.io/instance: ollama
  template:
    metadata:
      labels:
        app.kubernetes.io/controller: server-1
        app.kubernetes.io/instance: ollama
        app.kubernetes.io/name: ollama
        ollama-type: server
    spec:
      enableServiceLinks: false
      serviceAccountName: ollama
      automountServiceAccountToken: false
      hostIPC: false
      hostNetwork: false
      hostPID: false
      dnsPolicy: ClusterFirst
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: ollama-type
                    operator: In
                    values:
                      - server
              topologyKey: kubernetes.io/hostname
      containers:
        - env:
            - name: OLLAMA_KEEP_ALIVE
              value: 24h
            - name: OLLAMA_HOST
              value: 0.0.0.0
          image: ollama/ollama:0.24.0@sha256:a6149234667efc71d37766d61c1a16f24c33e4cd7a0bf4125c44a7e47e2419c4
          name: main
          resources:
            limits:
              gpu.intel.com/i915: 1
            requests:
              cpu: 10m
              gpu.intel.com/i915: 1
              memory: 20Mi
          volumeMounts:
            - mountPath: /root/.ollama
              name: server-1
      volumes:
        - name: server-1
          persistentVolumeClaim:
            claimName: ollama-server-1
