# 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/v2
kind: HelmRelease
metadata:
  name: nginx-cdn
  namespace: default
spec:
  interval: 5m
  chart:
    spec:
      chart: app-template
      version: 3.4.0
      sourceRef:
        kind: HelmRepository
        name: bjws-charts
        namespace: flux-system

  values:
    controllers:
      main:
        pod:
          securityContext:
            runAsNonRoot: true
            runAsUser: 65534
            runAsGroup: 65533
            fsGroup: 10000
            fsGroupChangePolicy: OnRootMismatch

        containers:
          main:
            image:
              repository: git.${SECRET_NEW_DOMAIN}/seanomik/nginx
              tag: 1.27.1
              pullPolicy: Always

            resources:
              requests:
                memory: 500Mi

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

    service:
      app:
        controller: main
        ports:
          http:
            port: 6544

    ingress:
      main:
        annotations:
          cert-manager.io/cluster-issuer: letsencrypt-production
          traefik.ingress.kubernetes.io/router.entrypoints: websecure
        hosts:
        - host: "cdn.${SECRET_NEW_DOMAIN}"
          paths:
          - path: /
            service:
              identifier: app
              port: http

    persistence:
      config:
        type: configMap
        name: nginx-cdn-configmap
        globalMounts:
        - path: /etc/nginx/nginx.conf
          subPath: nginx.conf

      storage:
        type: hostPath
        hostPath: /mnt/MainPool/Kubernetes/cdn/data
        globalMounts:
        - path: /data