---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: gatekeeper
  namespace: django

spec:
  interval: 10m

  chart:
    spec:
      chart: universal-chart
      version: "0.1.7"
      sourceRef:
        kind: HelmRepository
        name: yc-oci-charts
        namespace: flux-system
      interval: 10m

  install:
    remediation:
      retries: 3

  upgrade:
    remediation:
      retries: 3

  values:
    global:
      env: _default

    services:
      gatekeeper:
        enabled: true

        image:
          name:
            _default: cr.yandex/crp3ccidau046kdj8g9q/gatekeeper:2.12.1
          pullPolicy:
            _default: IfNotPresent

        deployment:
          enabled: true

          name:
            _default: gatekeeper

          replicaCount:
            _default: 1

          port:
            _default: 8080

          args:
            _default:
              - "--discovery-url=https://keycloak.wildberries.ru/realms/infrastructure/.well-known/openid-configuration"
              - "--listen=0.0.0.0:8080"
              - "--enable-logging=true"
              - "--upstream-url=http://frontend-service.django.svc.cluster.local:80/"
              - "--enable-refresh-tokens=true"
              - "--enable-session-cookies=true"
              - "--verbose"
              - "--resources=uri=/*"
              - "--encryption-key=zfDjuszywHSbAhY8KJQbESbpUYN74XTs"
              - "--secure-cookie=false"
              - "--cors-origins=*"
              - "--skip-openid-provider-tls-verify=true"
              - "--enable-default-deny=false"

          probes:
            liveness:
              enabled: false
            readiness:
              enabled: false

        service:
          enabled: true

          name:
            _default: gatekeeper-service

          type:
            _default: ClusterIP

          port:
            _default: 80

          targetPort:
            _default: 8080

          portName:
            _default: http

        imagePullSecrets:
          enabled:
            _default: true
          name:
            _default: dockerhub

        envs:
          - name: PROXY_REDIRECTION_URL
            value:
              _default: "https://lk.srx.wb.ru"

        secretEnvs:
          - name: PROXY_CLIENT_ID
            secretName:
              _default: "gatekeeper-secret"
            secretKey: "client_id"

          - name: PROXY_CLIENT_SECRET
            secretName:
              _default: "gatekeeper-secret"
            secretKey: "client_secret"

        commitSha: ""
        gitlabUri: ""
        gitlabJobUrl: ""
        owner: ""
