apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: plex
  namespace: media
spec:
  interval: 5m
  chart:
    spec:
      chart: app-template
      version: 1.3.x
      sourceRef:
        kind: HelmRepository
        name: bjws-charts
        namespace: flux-system

  values:

    image:
      repository: lscr.io/linuxserver/plex
      tag: "1.40.1"

    env:
      TZ: "America/New_York"
      PUID: "1000"
      PGID: "1000"
      VERSION: "docker"

    service:
      main:
        type: LoadBalancer

        annotations:
          metallb.universe.tf/loadBalancerIPs: "192.168.87.10"
          metallb.universe.tf/allow-shared-ip: "main-ip-192.168.87.10"

        ports:
          http:
            port: 32400
            targetPort: 32400

    probes:
      liveness:
        enabled: false

    ingress:
      main:
        enabled: true
        annotations:
          cert-manager.io/cluster-issuer: letsencrypt-production
          traefik.ingress.kubernetes.io/router.entrypoints: websecure
        hosts:
          - host: &host "plex.${SECRET_NEW_DOMAIN}"
            paths:
              - path: /
                pathType: Prefix
        tls:
          - hosts:
              - *host

    persistence:
      config:
        enabled: true
        type: hostPath
        hostPath: /mnt/MainPool/Kubernetes/plex
        mountPath: /config

      storage:
        enabled: true
        type: hostPath
        hostPath: /mnt/MainPool/Media/Media
        mountPath: /storage/Media

#      transcodes:
#        enabled: true
#        type: pvc
#        accessMode: ReadWriteOnce
#        size: 40Gi
#        mountPath: /transcode

    resources:
      requests:
        memory: 720Mi
        
      limits:
        memory: 5000Mi