# yaml-language-server: $schema=https://raw.githubusercontent.com/bjw-s/helm-charts/main/charts/other/app-template/schemas/helmrelease-helm-v2.schema.json
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: komga
spec:
  interval: 5m
  chart:
    spec:
      chart: app-template
      version: 3.5.1
      sourceRef:
        kind: HelmRepository
        name: bjws-charts
        namespace: flux-system
  values:
    controllers:
      komga:
        containers:
          app:
            image:
              repository: gotson/komga
              tag: 1.14.1
            env:
              TZ: America/New_York
            probes:
              liveness: &probes
                enabled: true
                custom: true
                spec:
                  httpGet:
                    path: /
                    port: &port 25600
                  initialDelaySeconds: 0
                  periodSeconds: 10
                  timeoutSeconds: 1
                  failureThreshold: 3
              readiness: *probes
              startup:
                enabled: true
                spec:
                  failureThreshold: 30
                  periodSeconds: 10
            resources:
              requests:
                cpu: 2m
                memory: 1500Mi
              limits:
                memory: 3200Mi

#            securityContext:
#              allowPrivilegeEscalation: false
#              readOnlyRootFilesystem: true
#              capabilities: { drop: ["ALL"] }

#    defaultPodOptions:
#      securityContext:
#        runAsUser: 10000
#        runAsGroup: 10000
#        fsGroup: 10000
#        fsGroupChangePolicy: OnRootMismatch
    
    service:
      app:
        controller: komga
        ports:
          http:
            port: *port
    
    ingress:
      app:
        annotations:
          cert-manager.io/cluster-issuer: letsencrypt-production
          traefik.ingress.kubernetes.io/router.entrypoints: websecure
        hosts:
          - host: "comics.${SECRET_NEW_DOMAIN}"
            paths:
              - path: /
                service:
                  identifier: app
                  port: http
                  
    persistence:
      data:
        existingClaim: komga
        globalMounts:
          - path: /config
      storage:
        type: hostPath
        hostPath: /mnt/MainPool/Media/Media
        globalMounts:
          - path: /storage
            #readOnly: true