---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: pdf-markings
  namespace: documentations

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:
      pdf-markings:
        enabled: true

        image:
          name:
            _default: cr.yandex/crp3ccidau046kdj8g9q/pdf-markings:prod_7d892636
          pullPolicy:
            _default: IfNotPresent

        deployment:
          enabled: true

          name:
            _default: pdf-markings

          replicaCount:
            _default: 1

          port:
            _default: 8000

          resources:
            requests:
              cpu:
                _default: "2"
              memory:
                _default: 8Gi

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

        service:
          enabled: true

          name:
            _default: marks-service

          type:
            _default: ClusterIP

          port:
            _default: 8000

          targetPort:
            _default: 8000

          portName:
            _default: http

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

        volumes:
          _default:
            - name: yc-s3
              mountPath:
                _default: /etc/sarex/yc-s3-storage
              readOnly:
                _default: true
              secret:
                secretName:
                  _default: documentations-yc-s3

        envs:
          - name: APP_NAME
            value:
              _default: "pdm_v2"

          - name: VERIFY
            value:
              _default: "False"

          - name: APP_VERSION
            value:
              _default: "0.0.1"

          - name: LOG_LEVEL
            value:
              _default: "INFO"

          - name: HTTP_PORT
            value:
              _default: "8000"

          - name: DOC_POSTGRES_HOST
            value:
              _default: "sarex-vpsql-01.xc.wb.ru"

          - name: DOC_POSTGRES_PORT
            value:
              _default: "5432"

          - name: DOC_POSTGRES_DB
            value:
              _default: "documentations_db"

          - name: DOC_POSTGRES_POOL_SIZE
            value:
              _default: "10"

          - name: DOC_POSTGRES_SSL_MODE
            value:
              _default: "disable"

          - name: API_ADDRESS
            value:
              _default: "0.0.0.0:8000"

          - name: DATABASE_SSL_MODE
            value:
              _default: "disable"

          - name: YANDEX_S3_USE_SSL
            value:
              _default: "0"

          - name: ENVIRONMENT
            value:
              _default: "production"

          - name: YANDEX_S3_ACCOUNT_PATH
            value:
              _default: "/etc/sarex/yc-s3-storage/yc-s3-service-account.json"

          - name: REDIRECT_URL_QR
            value:
              _default: "https://stamp-verification-srx.wb.ru/"

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

        secretEnvs:
          - name: DOC_POSTGRES_USER
            secretName:
              _default: "postgres-secret"
            secretKey: "username"

          - name: DOC_POSTGRES_PASSWORD
            secretName:
              _default: "postgres-secret"
            secretKey: "password"

          - name: YANDEX_S3_ENDPOINT_URL
            secretName:
              _default: "yc-s3"
            secretKey: "endpoint_url"

          - name: YANDEX_S3_SECRET_ACCESS_KEY
            secretName:
              _default: "yc-s3"
            secretKey: "access_key"

          - name: YANDEX_S3_ACCESS_KEY_ID
            secretName:
              _default: "yc-s3"
            secretKey: "key_id"

          - name: RABBITMQ_HOST
            secretName:
              _default: "rabbitmq"
            secretKey: "host"

          - name: RABBITMQ_PORT
            secretName:
              _default: "rabbitmq"
            secretKey: "port"

          - name: RABBITMQ_USERNAME
            secretName:
              _default: "rabbitmq"
            secretKey: "username"

          - name: RABBITMQ_PASSWORD
            secretName:
              _default: "rabbitmq"
            secretKey: "password"

          - name: RABBITMQ_VHOST
            secretName:
              _default: "rabbitmq"
            secretKey: "vhost"

          - name: RABBITMQ_HEARTBEAT
            secretName:
              _default: "rabbitmq"
            secretKey: "heartbeat"

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