---
# Сырой Deployment (копия из дампа кластера), а не HelmRelease/universal-chart —
# см. apps/processing/wb/engine.yaml.
apiVersion: apps/v1
kind: Deployment
metadata:
  name: engine-low
  namespace: workflow
  labels:
    app: engine-low
spec:
  replicas: 1
  selector:
    matchLabels:
      app: engine-low
  template:
    metadata:
      labels:
        app: engine-low
    spec:
      serviceAccountName: workflows-backend-sa
      automountServiceAccountToken: true
      imagePullSecrets:
        - name: dockerhub
      containers:
        - name: engine-low
          image: cr.yandex/crp3ccidau046kdj8g9q/workflows-engine:production_f5fe4688
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          env:
            - name: RABBITMQ_HOST
              value: "rabbitmq-service.workflow.svc.cluster.local"
            - name: RABBITMQ_PORT
              value: "5672/api"
            - name: POSTGRES_ADDRESS
              value: "sarex-vpsql-01.xc.wb.ru"
            - name: POSTGRES_PORT
              value: "5432"
            - name: POSTGRES_POOL_SIZE
              value: "20"
            - name: ENVIRONMENT
              value: "prod"
            - name: WORKFLOWS_SENTRY_DSN
              value: "https://866b532efdbb4764a7551b76231232fc@o279218.ingest.sentry.io/543123"
            - name: WORKFLOWS_SENTRY_DEBUG
              value: "0"
            - name: API_ADDRESS
              value: "0.0.0.0:8000"
            - name: DJANGO_HOST
              value: "http://backend.django.svc.cluster.local:8000"
            - name: S3_SERVICE_ACCOUNT
              value: "/etc/sarex/yc-s3/yc-s3-service-account.json"
            - name: BIM_API_V2_DB
              value: "/etc/sarex/bim-api-v2-db-prod.json"
            - name: PDM_API_DB
              value: "/etc/pdm/pdm-api-db-prod.json"
            - name: WORKSPACE_API_DB
              value: "/etc/ws/ws-api-db-prod.json"
            - name: ISSUE_API_DB
              value: "/etc/issues/issue-api-db-prod.json"
            - name: MAILGUN
              value: "/etc/mailgun-secret/env.json"
            - name: SMTP
              value: "/etc/smtp-secret/smtp.json"
            - name: INTERNAL_PDM_URL
              value: "http://documentations-api.documentations.svc.cluster.local:8080"
            - name: INTERNAL_FILESTREAM_URL
              value: "http://documentations-filestream.documentations.svc.cluster.local:8080"
            - name: EXTERNAL_PDM_URL
              value: "http://documentations-api.documentations.svc.cluster.local:8080"
            - name: EXTERNAL_FILESTREAM_URL
              value: "http://documentations-filestream-service.documentations.svc.cluster.local:8080"
            - name: RESOURCES_API_INTERNAL_HOST
              value: "http://resources-service.resources.svc.cluster.local:8000"
            - name: ENABLE_SQL_QUERY
              value: "0"
            - name: ENABLE_S3_STORAGE
              value: "1"
            - name: ENABLE_S3V2_STORAGE
              value: "1"
            - name: ENABLE_PDM_STORAGE
              value: "1"
            - name: ENABLE_SMTP
              value: "1"
            - name: ENABLE_URL_STORAGE
              value: "1"
            - name: ENABLE_SRX_TMP
              value: "1"
            - name: ENABLE_BIM_API_V2_DB
              value: "1"
            - name: ENABLE_WORKSPACE_API_DB
              value: "1"
            - name: ENABLE_ISSUE_API_DB
              value: "1"
            - name: ENABLE_RESOURCES_API
              value: "1"
            - name: ENABLE_PDM_API_DB
              value: "1"
            - name: ENABLE_COMPARISONS_API_DB
              value: "1"
            - name: ENABLE_MAIL_GUN
              value: "1"
            - name: ENABLE_AMQP_EXECUTOR
              value: "0"
            - name: ENABLE_KUBERNETES_EXECUTOR
              value: "1"
            - name: MAX_WORKFLOWS_LIMIT
              value: "5"
            - name: CPU_COUNT
              value: "1"
            - name: MEMORY_GI
              value: "1"
            - name: CPU_COUNT_LOW_RESOURCES
              value: "1"
            - name: MEMORY_GI_LOW_RESOURCES
              value: "1"
            - name: CPU_COUNT_HIGH_MEM
              value: "1"
            - name: MEMORY_GI_HIGH_MEM
              value: "1"
            - name: ENABLE_TOLERATION
              value: "1"
            - name: COUNT_RUNNING_WORKERS
              value: "1"
            - name: COUNT_CANCELING_WORKERS
              value: "1"
            - name: COUNT_HANDLE_JOB_WORKERS
              value: "1"
            - name: BIM_API_DEBUG
              value: "0"
            - name: BIM_API_V2_DEBUG
              value: "0"
            - name: PDM_API_DEBUG
              value: "0"
            - name: COMPARISONS_API_DEBUG
              value: "0"
            - name: WORKSPACE_API_DEBUG
              value: "0"
            - name: JOBS_NAMESPACE
              value: "workflow"
            - name: ISSUE_API_DEBUG
              value: "0"
            - name: TOLERATION_KEY
              value: "dedicated"
            - name: TOLERATION_VALUE
              value: "processing-light"
            - name: TOLERATION_KEY_HIGH_MEM
              value: "dedicated"
            - name: TOLERATION_VALUE_HIGH_MEM
              value: "processing-light"
            - name: TOLERATION_KEY_PERSISTENT
              value: "dedicated"
            - name: TOLERATION_VALUE_PERSISTENT
              value: "processing-light"
            - name: RABBITMQ_CREATE_EXCHANGE
              value: "autodesk.inputMessage"
            - name: RABBITMQ_CANCEL_EXCHANGE
              value: "autodesk.cancelMessage"
            - name: RABBITMQ_CREATE_ROUTING_KEY
              value: "converting"
            - name: RABBITMQ_CANCEL_TOPIC
              value: "cancel"
            - name: RABBITMQ_COMPLETENESS_EXCHANGE
              value: "autodesk.outputMessage"
            - name: RABBITMQ_COMPLETENESS_TOPIC
              value: "output_navis"
            - name: CONTROL_PLANE_PERIOD
              value: "10s"
            - name: WORKFLOW_PRIORITY
              value: "low"
            - name: DEFAULT_TOLERATION_KEY
              value: "dedicated"
            - name: DEFAULT_TOLERATION_VALUE
              value: "processing-light"
            - name: DEFAULT_NODE_SELECTOR_KEY
              value: "dedicated"
            - name: DEFAULT_NODE_SELECTOR_VALUE
              value: "processing-light"
            - name: RABBITMQ_USER
              valueFrom:
                secretKeyRef:
                  name: rabbitmq-secret
                  key: username
            - name: RABBITMQ_PASS
              valueFrom:
                secretKeyRef:
                  name: rabbitmq-secret
                  key: password
            - name: POSTGRES_USER
              valueFrom:
                secretKeyRef:
                  name: postgres-secret
                  key: username
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: postgres-secret
                  key: password
            - name: POSTGRES_DB
              valueFrom:
                secretKeyRef:
                  name: postgres-secret
                  key: database
          volumeMounts:
            - name: yc-s3
              mountPath: /etc/sarex/yc-s3
              readOnly: true
            - name: django-auth
              mountPath: /etc/django-auth
              readOnly: true
            - name: smtp-secret
              mountPath: /etc/smtp-secret
              readOnly: true
      volumes:
        - name: yc-s3
          secret:
            secretName: yc-s3
        - name: django-auth
          secret:
            secretName: django-auth
        - name: smtp-secret
          secret:
            secretName: smtp-secret
