---
# yaml-language-server: $schema=https://ks.hsn.dev/helm.toolkit.fluxcd.io/helmrelease_v2beta2.json
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: tautulli
spec:
  interval: 30m
  chart:
    spec:
      chart: app-template
      version: 2.5.0
      sourceRef:
        kind: HelmRepository
        name: bjw-s
        namespace: flux-system
  install:
    remediation:
      retries: 3
  upgrade:
    cleanupOnFail: true
    remediation:
      retries: 3
  uninstall:
    keepHistory: false
  dependsOn:
    - name: rook-ceph-cluster
      namespace: rook-ceph
    - name: volsync
      namespace: storage
  values:
    controllers:
      main:
        annotations:
          reloader.stakater.com/auto: "true"
        containers:
          main:
            image:
              repository: ghcr.io/onedr0p/tautulli
              tag: 2.13.4@sha256:7682cdcf98dbdd236a21d1a7b7b380928dbd67283dce9a76398a7c1461b0f802
            env:
              TZ: America/Chicago
            probes:
              liveness: &probes
                enabled: true
                custom: true
                spec:
                  httpGet:
                    path: /status
                    port: &port 8181
                  initialDelaySeconds: 0
                  periodSeconds: 10
                  timeoutSeconds: 1
                  failureThreshold: 3
              readiness: *probes
              startup:
                enabled: false
            securityContext: &securityContext
              allowPrivilegeEscalation: false
              readOnlyRootFilesystem: true
              capabilities: { drop: ["ALL"] }
            resources:
              requests:
                cpu: 10m
              limits:
                memory: 1Gi
          jbops:
            image:
              repository: registry.k8s.io/git-sync/git-sync
              tag: v4.2.0@sha256:d277810f72bc30bf0e276db609c0b606a83b5698606d92b6b14f50ea5f54de5f
            env:
              GITSYNC_REPO: https://github.com/blacktwin/JBOPS
              GITSYNC_REF: master
              GITSYNC_PERIOD: 24h
              GITSYNC_ROOT: /add-ons
            securityContext: *securityContext
            resources:
              requests:
                cpu: 10m
              limits:
                memory: 128Mi
        pod:
          securityContext:
            runAsUser: 568
            runAsGroup: 568
            fsGroup: 568
            fsGroupChangePolicy: OnRootMismatch
    service:
      main:
        ports:
          http:
            port: *port
    ingress:
      main:
        enabled: true
        className: external-nginx
        annotations:
          external-dns.alpha.kubernetes.io/cloudflare-proxied: "true"
          external-dns.alpha.kubernetes.io/target: external.hsn.dev
        hosts:
          - host: &host "t.hsn.dev"
            paths:
              - path: /
                service:
                  name: main
                  port: http
        tls:
          - hosts:
              - *host
    persistence:
      config:
        enabled: true
        existingClaim: tautulli
      tmp:
        type: emptyDir
      add-ons:
        type: emptyDir