---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: engine-low
  namespace: processing

spec:
  interval: 10m

  chart:
    spec:
      chart: universal-chart
      version: "0.1.9"
      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:
      backend:
        enabled: true

        serviceAccount:
          enabled:
            _default: true
          name:
            _default: processing-vault

        image:
          name:
            _default: cr.yandex/crp3ccidau046kdj8g9q/workflows-engine:contour_a03d37da-dirty2

          pullPolicy:
            _default: IfNotPresent

        deployment:
          enabled: true

          name:
            _default: engine-low

          replicaCount:
            _default: 1

          port:
            _default: 8000

          command:
            _default: ["/bin/bash", "-ec"]
          args:
            _default:
              - |
                set -a
                [ -f /vault/secrets/processing-postgresql ] && . /vault/secrets/processing-postgresql
                [ -f /vault/secrets/processing-rabbitmq ] && . /vault/secrets/processing-rabbitmq
                set +a
                exec /engine

          resources:
            requests:
              cpu:
                _default: 25m
              memory:
                _default: 128Mi

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

        service:
          enabled: false

          name:
            _default: engine-low-svc

          type:
            _default: ClusterIP

          port:
            _default: 8000

          targetPort:
            _default: 8000

          portName:
            _default: http

        imagePullSecrets:
          enabled:
            _default: true
          name:
            _default: regcred

        envs:
          - name: POSTGRES_POOL_SIZE
            value:
              _default: "20"

          - name: ENVIRONMENT
            value:
              _default: "prod"

          - name: WORKFLOWS_SENTRY_DSN
            value:
              _default: "https://866b532efdbb4764a7551b76231232fc@o279218.ingest.sentry.io/543123"

          - name: WORKFLOWS_SENTRY_DEBUG
            value:
              _default: "0"

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

          - name: DJANGO_HOST
            value:
              _default: "http://backend.django.svc.cluster.local:8000"

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

          - name: BIM_API_V2_DB
            value:
              _default: "/etc/sarex/bim-api-v2-db-prod.json"

          - name: PDM_API_DB
            value:
              _default: "/etc/pdm/pdm-api-db-prod.json"

          - name: WORKSPACE_API_DB
            value:
              _default: "/etc/ws/ws-api-db-prod.json"

          - name: ISSUE_API_DB
            value:
              _default: "/etc/issues/issue-api-db-prod.json"

          - name: MAILGUN
            value:
              _default: "/etc/mailgun-secret/env.json"

          - name: SMTP
            value:
              _default: "/vault/secrets/processing-smtp"

          - name: INTERNAL_PDM_URL
            value:
              _default: "http://backend-api-svc.documentations.svc.cluster.local:80"

          - name: INTERNAL_FILESTREAM_URL
            value:
              _default: "http://backend-filestream-svc.documentations.svc.cluster.local:80"
          - name: IGNORE_TAINTS_AND_NODE_SELECTOR
            value:
              _default: "true"
          - name: EXTERNAL_PDM_URL
            value:
              _default: "http://backend-api-svc.documentations.svc.cluster.local:80"

          - name: EXTERNAL_FILESTREAM_URL
            value:
              _default: "http://backend-filestream-svc.documentations.svc.cluster.local:80"

          - name: RESOURCES_API_INTERNAL_HOST
            value:
              _default: "http://iam-backend.iam.svc.cluster.local:8000"

          - name: ENABLE_SQL_QUERY
            value:
              _default: "0"

          - name: ENABLE_S3_STORAGE
            value:
              _default: "1"

          - name: ENABLE_S3V2_STORAGE
            value:
              _default: "1"

          - name: ENABLE_PDM_STORAGE
            value:
              _default: "1"

          - name: ENABLE_SMTP
            value:
              _default: "1"

          - name: ENABLE_URL_STORAGE
            value:
              _default: "1"

          - name: ENABLE_SRX_TMP
            value:
              _default: "1"

          - name: ENABLE_BIM_API_V2_DB
            value:
              _default: "1"

          - name: ENABLE_WORKSPACE_API_DB
            value:
              _default: "1"

          - name: ENABLE_ISSUE_API_DB
            value:
              _default: "1"

          - name: ENABLE_RESOURCES_API
            value:
              _default: "1"

          - name: VAULT_USE
            value:
              _default: "true"

          - name: ENABLE_PDM_API_DB
            value:
              _default: "1"

          - name: ENABLE_COMPARISONS_API_DB
            value:
              _default: "1"

          - name: ENABLE_MAIL_GUN
            value:
              _default: "1"

          - name: ENABLE_AMQP_EXECUTOR
            value:
              _default: "0"

          - name: ENABLE_KUBERNETES_EXECUTOR
            value:
              _default: "1"

          - name: MAX_WORKFLOWS_LIMIT
            value:
              _default: "5"

          - name: CPU_COUNT
            value:
              _default: "1"

          - name: MEMORY_GI
            value:
              _default: "1"

          - name: CPU_COUNT_LOW_RESOURCES
            value:
              _default: "1"

          - name: MEMORY_GI_LOW_RESOURCES
            value:
              _default: "1"

          - name: CPU_COUNT_HIGH_MEM
            value:
              _default: "1"

          - name: MEMORY_GI_HIGH_MEM
            value:
              _default: "1"

          - name: COUNT_RUNNING_WORKERS
            value:
              _default: "1"

          - name: COUNT_CANCELING_WORKERS
            value:
              _default: "1"

          - name: COUNT_HANDLE_JOB_WORKERS
            value:
              _default: "1"

          - name: BIM_API_DEBUG
            value:
              _default: "0"

          - name: BIM_API_V2_DEBUG
            value:
              _default: "0"

          - name: PDM_API_DEBUG
            value:
              _default: "0"

          - name: COMPARISONS_API_DEBUG
            value:
              _default: "0"

          - name: WORKSPACE_API_DEBUG
            value:
              _default: "0"

          - name: JOBS_NAMESPACE
            value:
              _default: "processing"

          - name: ISSUE_API_DEBUG
            value:
              _default: "0"

          - name: TOLERATION_KEY
            value:
              _default: "dedicated"

          - name: TOLERATION_VALUE
            value:
              _default: "processing"

          - name: TOLERATION_KEY_HIGH_MEM
            value:
              _default: "dedicated"

          - name: TOLERATION_VALUE_HIGH_MEM
            value:
              _default: "processing"

          - name: TOLERATION_KEY_PERSISTENT
            value:
              _default: "dedicated"

          - name: TOLERATION_VALUE_PERSISTENT
            value:
              _default: "processing"

          - name: RABBITMQ_CREATE_EXCHANGE
            value:
              _default: "autodesk.inputMessage"

          - name: RABBITMQ_CANCEL_EXCHANGE
            value:
              _default: "autodesk.cancelMessage"

          - name: RABBITMQ_CREATE_ROUTING_KEY
            value:
              _default: "converting"

          - name: RABBITMQ_CANCEL_TOPIC
            value:
              _default: "cancel"

          - name: RABBITMQ_COMPLETENESS_EXCHANGE
            value:
              _default: "autodesk.outputMessage"

          - name: RABBITMQ_COMPLETENESS_TOPIC
            value:
              _default: "output_navis"

          - name: CONTROL_PLANE_PERIOD
            value:
              _default: "10s"

          - name: WORKFLOW_PRIORITY
            value:
              _default: "low"

          - name: ENABLE_TOLERATION
            value:
              _default: "1"

          - name: DEFAULT_TOLERATION_KEY
            value:
              _default: "dedicated"

          - name: DEFAULT_TOLERATION_VALUE
            value:
              _default: "processing"

          - name: DEFAULT_NODE_SELECTOR_KEY
            value:
              _default: "dedicated"

          - name: DEFAULT_NODE_SELECTOR_VALUE
            value:
              _default: "processing"

        podAnnotations:
          _default:
            traffic.sidecar.istio.io/excludeOutboundPorts: "8200"
            vault.hashicorp.com/agent-init-first: "true"
            vault.hashicorp.com/agent-inject: "true"
            vault.hashicorp.com/agent-pre-populate-only: "true"
            vault.hashicorp.com/auth-path: auth/kubernetes
            vault.hashicorp.com/role: processing
            vault.hashicorp.com/agent-inject-secret-processing-postgresql: secrets/data/apps/processing/postgres
            vault.hashicorp.com/agent-inject-template-processing-postgresql: |-
              {{- with secret "secrets/data/apps/processing/postgres" -}}
              POSTGRES_ADDRESS={{ index .Data.data "host" }}
              POSTGRES_PORT={{ index .Data.data "port" }}
              POSTGRES_USER={{ index .Data.data "username" }}
              POSTGRES_PASSWORD={{ index .Data.data "password" }}
              POSTGRES_DB={{ index .Data.data "database" }}
              {{- end -}}
            vault.hashicorp.com/agent-inject-secret-processing-rabbitmq: secrets/data/rabbitmq/apps/processing
            vault.hashicorp.com/agent-inject-template-processing-rabbitmq: |-
              {{- with secret "secrets/data/rabbitmq/apps/processing" -}}
              RABBITMQ_HOST=rabbitmq.rabbitmq.svc.cluster.local
              RABBITMQ_PORT=5672
              RABBITMQ_USER={{ index .Data.data "username" }}
              RABBITMQ_PASS={{ index .Data.data "password" }}
              {{- end -}}
            vault.hashicorp.com/agent-inject-secret-processing-smtp: secrets/data/vault/common/smtp_auth
            vault.hashicorp.com/agent-inject-template-processing-smtp: |-
              {{- with secret "secrets/data/vault/common/smtp_auth" -}}
              {{ index .Data.data "env_json" }}
              {{- end -}}

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