---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: plex
  namespace: media
  labels:
    app: plex
spec:
  replicas: 1
  selector:
    matchLabels:
      app: plex
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: plex
    spec:
      containers:
        - name: plex
          image: lscr.io/linuxserver/plex:1.25.3.5409-f11334058-ls97
          env:
            - name: TZ
              value: Europe/Zurich
            - name: PGID
              value: "2000"
            - name: PUID
              value: "2000"
            - name: VERSION
              value: latest
          ports:
            - name: http
              containerPort: 32400
          startupProbe:
            httpGet:
              path: /web/index.html
              port: http
            initialDelaySeconds: 15
            failureThreshold: 60
            timeoutSeconds: 3
            periodSeconds: 3
          livenessProbe:
            httpGet:
              path: /web/index.html
              port: http
            failureThreshold: 2
            timeoutSeconds: 3
            periodSeconds: 30
          resources:
            limits:
              gpu.intel.com/i915: 1
          volumeMounts:
            - name: data
              mountPath: /config
            - name: backup
              mountPath: /backup
            - name: transcode
              mountPath: /transcode
            - name: media
              mountPath: /media
      restartPolicy: Always
      automountServiceAccountToken: false
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: plex-data
        - name: backup
          persistentVolumeClaim:
            claimName: plex-backup
        - name: transcode
          emptyDir:
            medium: Memory
        - name: media
          hostPath:
            path: /mnt/storage
            type: Directory
