---
# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2beta2.schema.json
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: tautulli
spec:
  interval: 30m
  chart:
    spec:
      chart: app-template
      version: 3.1.0
      sourceRef:
        kind: HelmRepository
        name: bjw-s
        namespace: flux-system
  install:
    remediation:
      retries: 3
  upgrade:
    cleanupOnFail: true
    remediation:
      retries: 3
      strategy: rollback
  dependsOn:
    - name: rook-ceph-cluster
      namespace: rook-ceph
    - name: volsync
      namespace: volsync-system
  values:
    controllers:
      tautulli:
        annotations:
          reloader.stakater.com/auto: "true"
        containers:
          app:
            image:
              repository: ghcr.io/tautulli/tautulli
              tag: v2.13.4@sha256:fb5e22c7a4d9e770703a30d145f355786fecb28dfca6df56c5073c457f3c8a8e
            env:
              TZ: America/Chicago
            command: ["/usr/local/bin/python", "Tautulli.py"]
            args: [
              "--config", "/config/config.ini",
              "--datadir", "/config",
              "--port", "80"
            ]
            probes:
              liveness: &probes
                enabled: true
                custom: true
                spec:
                  httpGet:
                    path: /status
                    port: &port 80
                  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.2@sha256:2dc189a0886c0df1b5b0cc816c60b5fe0799230a5bb7e123aa28ff4f74ac988a
            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:
      app:
        controller: tautulli
        ports:
          http:
            port: *port
    ingress:
      app:
        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:
                  identifier: app
                  port: http
        tls:
          - hosts:
              - *host
    persistence:
      config:
        enabled: true
        existingClaim: tautulli
      tmp:
        type: emptyDir
      add-ons:
        type: emptyDir