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

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

        deployment:
          enabled: true

          name:
            _default: celery

          replicaCount:
            _default: 1
            stage: 1
            preprod: 3
            production: 3

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

          name:
            _default: celery

          type:
            _default: ClusterIP

          port:
            _default: 8000

          targetPort:
            _default: 8000

          portName:
            _default: http

        imagePullSecrets:
          enabled:
            _default: true
          name:
            _default: regcred
        volumes:
          _default:
          - 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

        labels:
          monitoring: prometheus

        envs:
          - name: SERVER_SUPERSET_HOST
            value:
              _default: "https://superset.cde.brusnika.ru"

          - 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: 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://cde.brusnika.ru"

          - name: SERVER_HOST
            value:
              _default: "https://cde.brusnika.ru"

          - name: WORKFLOWS_HOST
            value:
              _default: "https://cde.brusnika.ru"

          - name: WORKFLOWS_BASE_HOST
            value:
              _default: "https://cde.brusnika.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: 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://minio-svc.minio.svc.cluster.local:9000"

          - name: KC_USE_REDIRECT_LOGOUT
            value:
              _default: "True"
        secretEnvs:
          - name: SERVER_SUPERSET_JWT_SECRET
            secretName:
              _default: "jwt-secret-superset"
            secretKey: "jwt_secret"

          - 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: ""