---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sonarr
  namespace: media
  labels:
    app: sonarr
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sonarr
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: sonarr
    spec:
      containers:
        - name: sonarr
          image: lscr.io/linuxserver/sonarr:3.0.6.1342-ls132
          env:
            - name: TZ
              value: Europe/Zurich
            - name: PGID
              value: "2000"
            - name: PUID
              value: "2000"
          ports:
            - name: http
              containerPort: 8989
          startupProbe:
            tcpSocket:
              port: http
            initialDelaySeconds: 5
            failureThreshold: 30
            timeoutSeconds: 3
            periodSeconds: 3
          livenessProbe:
            tcpSocket:
              port: http
            failureThreshold: 2
            timeoutSeconds: 3
            periodSeconds: 30
          volumeMounts:
            - name: data
              mountPath: /config
            - name: backup
              mountPath: /config/Backups
            - name: tv-shows
              mountPath: /tv
            - name: downloads
              mountPath: /downloads
      restartPolicy: Always
      automountServiceAccountToken: false
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: sonarr-data
        - name: backup
          persistentVolumeClaim:
            claimName: sonarr-backup
        - name: tv-shows
          hostPath:
            path: /mnt/storage/serien
            type: Directory
        - name: downloads
          hostPath:
            path: /mnt/sabnzbd/tv
            type: Directory
