apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Release.Name }}
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: jellyfin
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: jellyfin
    spec:
      securityContext:
        runAsUser: 1000
        runAsGroup: 1000
        fsGroup: 1000
      tolerations:
      - key: "node.kubernetes.io/unreachable"
        operator: "Exists"
        effect: "NoExecute"
        tolerationSeconds: 1
      - key: "node.kubernetes.io/not-ready"
        operator: "Exists"
        effect: "NoExecute"
        tolerationSeconds: 1
      containers:
      - name: jellyfin
        image: {{ .Values.jellyfin.image }}
        ports:
          - containerPort: 8096
            name: http
        volumeMounts:
          - mountPath: /config
            name: config
          - mountPath: /cache
            name: cache
          - mountPath: /movies
            name: movies
          - mountPath: /shows
            name: shows
          - mountPath: /videos
            name: videos
        resources:
          requests:
            memory: "1Gi"
            cpu: "1m"
          limits:
            memory: "8Gi"
            cpu: "24"
      volumes:
      - name: config
        persistentVolumeClaim:
          claimName: {{ .Release.Name }}-config
      - name: cache
        persistentVolumeClaim:
          claimName: {{ .Release.Name }}-cache
      - name: movies
        nfs:
          server: driveripper-lab.reeselink.com
          path: /mnt/enc0/smb/media/Movies
          readOnly: true
      - name: shows
        nfs:
          server: driveripper-lab.reeselink.com
          path: /mnt/enc0/smb/media/Shows
          readOnly: true
      - name: videos
        nfs:
          server: driveripper-lab.reeselink.com
          path: /mnt/enc0/smb/media/Videos
          readOnly: true
