---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: plex
  namespace: default
spec:
  interval: 5m
  chart:
    spec:
      # renovate: registryUrl=https://k8s-at-home.com/charts/
      chart: plex
      version: 6.2.1
      sourceRef:
        kind: HelmRepository
        name: k8s-at-home
        namespace: kube-system
      interval: 5m
  valuesFrom:
  - kind: Secret
    name: plex-values
    optional: false
  # All values at https://github.com/k8s-at-home/charts/blob/main/charts/plex/values.yaml
  values:
    image:
      repository: plexinc/pms-docker
      tag: 1.43.5.11029-6bf8af3f0
      pullPolicy: Always
    service:
      main:
        primary: true
        type: NodePort
        ports:
          http:
            nodePort: 32400
            port: 32400
    env:
      TZ: "${CLUSTER_TIME_ZONE}"
      ADVERTISE_IP: "http://${DYN_DNS_NAME}:32400/,http://${CONTROL_PLANE_IP}:32400/"
    probes:
      liveness:
        enabled: true
      readiness:
        enabled: true
      startup:
        enabled: true
    persistence:
      config:
        enabled: true
        type: pvc
        existingClaim: yasr-volume
        subPath: configs/plex
## Data is in the individual plex-values for each cluster
#      data:
#        enabled: true
#        type: pvc
#        existingClaim: main-volume
#        subPath:
#          - path: public
#            mountPath: /data
      transcode:
        enabled: true
        type: pvc
        size: ${PLEX_TRANSCODE_SIZE:=60Gi}
        accessMode: ReadWriteOnce
    resources:
      limits:
        memory: 4900Mi
      requests:
        cpu: 35m
        memory: 1500Mi
    podSecurityContext:
      # Hardware acceleration using an Intel iGPU w/ QuickSync
      # These IDs below should be matched to your `video` and `render` group on the host
      # To obtain those IDs run the following grep statement on the host:
      # $ cat /etc/group | grep "video\|render"
      # video:x:44:
      # render:x:109:
      supplementalGroups:
       - 39
       - 998
