---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: inspections-backend
  namespace: inspections

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:
      api:
        enabled: true

        image:
          name:
            _default: cr.yandex/crp3ccidau046kdj8g9q/sarex-inspections:production_1a33f6f4
          pullPolicy:
            _default: IfNotPresent

        deployment:
          enabled: true

          name:
            _default: inspections-backend

          replicaCount:
            _default: 1

          port:
            _default: 8000

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

        service:
          enabled: true

          name:
            _default: sarex-inspections-service

          type:
            _default: ClusterIP

          port:
            _default: 80

          targetPort:
            _default: 8000

          portName:
            _default: http

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

        envs:
          - name: DEBUG
            value:
              _default: "false"

          - name: SERVICE_URL
            value:
              _default: "https://srx.wb.ru"

          - name: HTTP_APP_HOST
            value:
              _default: "0.0.0.0"

          - name: HTTP_APP_PORT
            value:
              _default: "8000"

          - name: HTTP_APP_ROOT_PATH
            value:
              _default: "/inspections"

          - name: HTTP_APP_WORKERS
            value:
              _default: "3"

          - name: HTTP_APP_ADMIN_ENABLE
            value:
              _default: "true"

          - name: KAFKA_SSL_CAFILE
            value:
              _default: "/usr/local/share/ca-certificates/Yandex/YandexInternalRootCA.crt"

          - name: KAFKA_EAV_ASSETS_TOPIC
            value:
              _default: "assets_broadcast"

          - name: JWT_AUTH_ENABLE
            value:
              _default: "true"

          - name: NOTIFICATIONS_ENABLE
            value:
              _default: "true"

          - name: NOTIFICATIONS_EMAIL_FROM
            value:
              _default: "hello@sarex.io"

          - name: SAREX_BACKEND_URL
            value:
              _default: "https://srx.wb.ru"

          - name: SAREX_BACKEND_TIMEOUT
            value:
              _default: "30"

          - name: EAV_URL
            value:
              _default: "http://eav-service.eav"

          - name: EAV_TIMEOUT
            value:
              _default: "30"

          # В дампе кластера значение было http://workflows-service.processing-prod —
          # тот же неймспейс, что в вопросе про processing/workflow: реальный
          # ns у processing в wb — workflow.
          - name: WORKFLOWS_URL
            value:
              _default: "http://workflows-service.workflow"

          - name: WORKFLOWS_TIMEOUT
            value:
              _default: "30"

          - name: WORKFLOWS_EMAIL_DOCKER_IMAGE
            value:
              _default: "cr.yandex/crp3ccidau046kdj8g9q/notification:email"

          - name: MOBILE_APP_CURRENT_VERSION
            value:
              _default: "1.0.0"

          - name: MOBILE_APP_RECOMMENDED_VERSION
            value:
              _default: "1.0.0"

          - name: MOBILE_APP_REQUIRED_VERSION
            value:
              _default: "1.0.0"

          - name: MAILER_URL
            value:
              _default: "http://mailer-service.mailer:8000"

          - name: MAILER_TIMEOUT
            value:
              _default: "30"

        secretEnvs:
          - name: DATABASE_USER
            secretName:
              _default: "pg-secret"
            secretKey: "username"

          - name: DATABASE_PORT
            secretName:
              _default: "pg-secret"
            secretKey: "port"

          - name: DATABASE_NAME
            secretName:
              _default: "pg-secret"
            secretKey: "database"

          - name: DATABASE_HOST
            secretName:
              _default: "pg-secret"
            secretKey: "host"

          - name: DATABASE_PASSWORD
            secretName:
              _default: "pg-secret"
            secretKey: "password"

          - name: KAFKA_HOST
            secretName:
              _default: "kafka-secret"
            secretKey: "host"

          - name: KAFKA_USERNAME
            secretName:
              _default: "kafka-secret"
            secretKey: "username"

          - name: KAFKA_PASSWORD
            secretName:
              _default: "kafka-secret"
            secretKey: "password"

          - name: SAREX_BACKEND_AUTH
            secretName:
              _default: "sarex-backend-auth-secret"
            secretKey: "key"

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