---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: celery
  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:
      celery:
        enabled: true

        image:
          name:
            _default: cr.yandex/crp3ccidau046kdj8g9q/backend:production_7d0ec48b
          pullPolicy:
            _default: IfNotPresent

        deployment:
          enabled: true

          name:
            _default: celery

          replicaCount:
            _default: 1

          port:
            _default: 8000

          command:
            _default: ["celery", "-A", "config", "worker", "-B", "-l", "info", "-E", "-Q", "default", "-n", "default_worker.%h", "--concurrency=2"]

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

        service:
          enabled: false

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

        volumes:
          _default:
            - name: tmp-volume
              mountPath:
                _default: /tmp
              emptyDir: {}

            - name: uwsgi-configmap
              mountPath:
                _default: /opt/sarex/uwsgi.ini
              subPath:
                _default: uwsgi.ini
              readOnly:
                _default: true
              configMap:
                name:
                  _default: uwsgi-configmap
                items:
                  - key: uwsgi.ini
                    path:
                      _default: uwsgi.ini

            - name: django-configmap
              mountPath:
                _default: /opt/sarex/config/settings/production.py
              subPath:
                _default: production.py
              readOnly:
                _default: true
              configMap:
                name:
                  _default: django-configmap
                items:
                  - key: production.py
                    path:
                      _default: production.py

            - name: kafka-cert-volume
              mountPath:
                _default: /usr/local/share/ca-certificates
              readOnly:
                _default: true
              configMap:
                name:
                  _default: kafka-cert

        envs:
          - name: GK_ENCRYPTION_KEY
            value:
              _default: "zfDjuszywHSbAhY8KJQbESbpUYN74XTs"

          - name: ALLOWED_HOSTS
            value:
              _default: "*"

          - name: SERVER_USE_CHANGELOG
            value:
              _default: "0"

          - name: SERVER_ZITADEL_ENABLED
            value:
              _default: "False"

          - name: DJANGO_SETTINGS_MODULE
            value:
              _default: "config.settings.production"

          - name: CELERY_REDIS_HOST
            value:
              _default: "redis-service"

          - name: CELERY_REDIS_PORT
            value:
              _default: "6379"

          - name: DJANGO_REDIS_HOST
            value:
              _default: "redis-service"

          - name: CACHE_HOST
            value:
              _default: "redis.pm.svc.cluster.local"

          - name: DJANGO_REDIS_PORT
            value:
              _default: "6379"

          - name: BIMV2_INTERNAL_HOST
            value:
              _default: "http://bim-backend-v2-service.bim-api"

          - name: BIMV2_TIMEOUT
            value:
              _default: "60"

          - name: JWT_KID
            value:
              _default: "1"

          - name: PDM_SYNC
            value:
              _default: "1"

          - name: KC_SYNC_ENABLE
            value:
              _default: "0"

          - name: MEASUREMENTS_HOST
            value:
              _default: "http://measurements-service.measurements.svc.cluster.local:8000/api"

          - name: MEASUREMENTS_USE_MEASUREMENTS
            value:
              _default: "1"

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

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

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

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

          - name: WORKFLOWS_USE
            value:
              _default: "1"

          - name: SERVER_S3_STREAM_IMPORT
            value:
              _default: "1"

          - name: SERVER_SAVE_DIFF_DEM
            value:
              _default: "1"

          - name: SERVER_USE_CLICKHOUSE
            value:
              _default: "0"

          - name: SERVER_USE_CREATE_COMPARED_GEOTIFF_TASK
            value:
              _default: "0"

          - name: SERVER_USE_DJANGO_STORAGE
            value:
              _default: "1"

          - name: SERVER_USE_METASHAPE
            value:
              _default: "0"

          - name: SERVER_CHANGELOG_MODE_SYSTEM_LOG
            value:
              _default: "1"

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

          - name: SERVER_KAFKA_ENABLED
            value:
              _default: "True"

          - name: KAFKA_TOPICS
            value:
              _default: '{"planning": "message-hub-stage", "ams-sync": "ams-sync"}'

          - name: KAFKA_BOOTSTRAP_SERVERS
            value:
              _default: '["wb-prod-kafka-bootstrap.kafka.svc.cluster.local:9093"]'

          - name: KAFKA_SECURITY_PROTOCOL
            value:
              _default: "SSL"

          - name: KAFKA_SASL_MECHANISM
            value:
              _default: "SCRAM-SHA-512"

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

          - name: SERVER_CHANGELOG_MODE
            value:
              _default: "0"

          - name: SERVER_DJANGO_URLS
            value:
              _default: "1"

          - name: CHECK_IMPORT_HASH
            value:
              _default: "1"

          - name: EAV_ENABLE
            value:
              _default: "1"

          - name: SERVER_CHECK_IMPORT_HASH
            value:
              _default: "1"

          - name: SERVER_CHUNKED_PATH
            value:
              _default: "/tmp/chunked_uploads/%Y/%m/%d"

          - name: SERVER_HIDE_USER_SCROLL_PERMISSIONS
            value:
              _default: "0"

          - name: SERVER_USE_WRORKFLOW_STATUS
            value:
              _default: "1"

          - name: S3_HOST
            value:
              _default: "http://10.49.10.90:9000"

          - name: KC_USE_REDIRECT_LOGOUT
            value:
              _default: "False"

        secretEnvs:
          - name: ZITADEL_ACCESS_TOKEN
            secretName:
              _default: "zitadel-secret"
            secretKey: "access_token"

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

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

          - name: KC_CLIENT_ID
            secretName:
              _default: "gatekeeper-secret"
            secretKey: "client_id"

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

          - name: AWS_S3_ENDPOINT_URL
            secretName:
              _default: "s3-secret"
            secretKey: "endpoint"

          - name: CELERY_RABBITMQ_HOST
            secretName:
              _default: "rabbitmq-secret"
            secretKey: "host"

          - name: CELERY_RABBITMQ_USER
            secretName:
              _default: "rabbitmq-secret"
            secretKey: "username"

          - name: CELERY_RABBITMQ_PASSWORD
            secretName:
              _default: "rabbitmq-secret"
            secretKey: "password"

          - name: CELERY_RABBITMQ_VHOST
            secretName:
              _default: "rabbitmq-secret"
            secretKey: "vhost"

          - name: DJANGO_POSTGRES_HOST
            secretName:
              _default: "postgres-secret"
            secretKey: "host"

          - name: DJANGO_POSTGRES_PORTS
            secretName:
              _default: "postgres-secret"
            secretKey: "port"

          - name: DJANGO_POSTGRES_USER
            secretName:
              _default: "postgres-secret"
            secretKey: "username"

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

          - name: DJANGO_POSTGRES_DATABASE
            secretName:
              _default: "postgres-secret"
            secretKey: "database"

          - name: DJANGO_RABBIT_HOSTNAME
            secretName:
              _default: "rabbitmq-secret"
            secretKey: "host"

          - name: DJANGO_RABBIT_USER
            secretName:
              _default: "rabbitmq-secret"
            secretKey: "username"

          - name: DJANGO_RABBIT_PASS
            secretName:
              _default: "rabbitmq-secret"
            secretKey: "password"

          - name: DJANGO_RABBIT_VHOST
            secretName:
              _default: "rabbitmq-secret"
            secretKey: "vhost"

          - name: JWT_PRIVATE_KEY
            secretName:
              _default: "backend-secret"
            secretKey: "ssh_private.key"

          - name: JWT_PUBLIC_KEY
            secretName:
              _default: "backend-secret"
            secretKey: "ssh_public.key"

          - name: S3_BUCKET
            secretName:
              _default: "sarex-media-storage-secret"
            secretKey: "bucket"

          - name: S3_LOGIN
            secretName:
              _default: "sarex-media-storage-secret"
            secretKey: "login"

          - name: S3_PASSWORD
            secretName:
              _default: "sarex-media-storage-secret"
            secretKey: "password"

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