apiVersion: apps/v1
kind: Deployment
metadata:
  name: plex
  labels:
    app.kubernetes.io/controller: main
    app.kubernetes.io/instance: plex
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/name: plex
    helm.sh/chart: plex-5.0.1
  namespace: plex
spec:
  revisionHistoryLimit: 3
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/controller: main
      app.kubernetes.io/name: plex
      app.kubernetes.io/instance: plex
  template:
    metadata:
      labels:
        app.kubernetes.io/controller: main
        app.kubernetes.io/instance: plex
        app.kubernetes.io/name: plex
    spec:
      enableServiceLinks: false
      serviceAccountName: plex
      automountServiceAccountToken: false
      securityContext:
        fsGroup: 1000
        fsGroupChangePolicy: OnRootMismatch
      hostIPC: false
      hostNetwork: false
      hostPID: false
      dnsPolicy: ClusterFirst
      affinity:
        podAntiAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            - labelSelector:
                matchExpressions:
                  - key: app.kubernetes.io/name
                    operator: In
                    values:
                      - jellyfin
              topologyKey: kubernetes.io/hostname
      containers:
        - env:
            - name: TZ
              value: America/Chicago
            - name: VERSION
              value: docker
          image: ghcr.io/linuxserver/plex:1.43.2.10687-563d026ea-ls307@sha256:626eb0d52b4522db3be91110a89161be6ccffc0741e9abf0e93aaf4fea98ccb9
          name: main
          resources:
            limits:
              gpu.intel.com/i915: 1
            requests:
              cpu: 100m
              gpu.intel.com/i915: 1
              memory: 250Mi
          volumeMounts:
            - mountPath: /config
              name: config
            - mountPath: /mnt/store
              name: media
              readOnly: true
            - mountPath: /transcode
              name: transcode
      volumes:
        - name: config
          persistentVolumeClaim:
            claimName: plex-config
        - name: media
          persistentVolumeClaim:
            claimName: plex-nfs-storage
        - emptyDir: {}
          name: transcode
