apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: message-hub
  namespace: message-hub

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/message-hub:production_d11aa910
          pullPolicy:
            _default: IfNotPresent

        deployment:
          enabled: true

          name:
            _default: message-hub

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

          port:
            _default: 8000

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

        service:
          enabled: true

          name:
            _default: message-hub

          type:
            _default: ClusterIP

          port:
            _default: 8000

          targetPort:
            _default: 8000

          portName:
            _default: http

        imagePullSecrets:
          enabled:
            _default: true
          name:
            _default: regcred
        labels:
          monitoring: prometheus

        envs:
          - name: WORKER_TIMEOUT
            value:
              _default: "60"

          - name: PYTHONPATH
            value:
              _default: "src"

          - name: SETTINGS_MAX_RETRIES
            value:
              _default: "1"

          - name: SETTINGS_TOPICS
            value:
              _default: >
                {"planning": "message-hub-prod",
                "assets":"assets_broadcast",
                "issues": "issues_broadcast_prod"}

          - name: PDF_CONVERTER_HOST
            value:
              _default: "http://export-project-service.django.svc.cluster.local:8000"

          - name: SAREX_BASE_HOST
            value:
              _default: "http://backend-service.pm.svc.cluster.local:8000"

          - name: PM_HOST
            value:
              _default: "http://backend-service.pm.svc.cluster.local:8000"

          - name: DB_HOST
            value:
              _default: "postgres-service.pm.svc.cluster.local"

          - name: DB_PORT
            value:
              _default: "5432"

          - name: DB_DATABASE
            value:
              _default: "pm"

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

          - name: CACHE_PORT
            value:
              _default: "6379"

          - name: CACHE_SSL
            value:
              _default: "0"

          - name: KAFKA_HOST
            value:
              _default: "donstroi-kafka-bootstrap.kafka.svc.cluster.local"

          - name: KAFKA_PORT
            value:
              _default: "9093"

          - name: KAFKA_SECURITY_PROTOCOL
            value:
              _default: "SSL"

          - name: KAFKA_SASL_MECHANISM
            value:
              _default: "PLAIN"

          - name: KAFKA_SSL_CAFILE
            value:
              _default: "/usr/local/share/ca-certificates/kafka.crt"
        secretEnvs:
          - name: KAFKA_USERNAME
            secretName:
              _default: "kafka-secret"
            secretKey: "username"

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

          - name: DB_USERNAME
            secretName:
              _default: "postgres-pm-secret"
            secretKey: "username"

          - name: DB_PASSWORD
            secretName:
              _default: "postgres-pm-secret"
            secretKey: "password"

          - name: S3_LOGIN
            secretName:
              _default: "s3-secret"
            secretKey: "username"

          - name: S3_PASSWORD
            secretName:
              _default: "s3-secret"
            secretKey: "password"

          - name: S3_BUCKET
            secretName:
              _default: "s3-secret"
            secretKey: "bucket"

          - name: S3_HOST
            secretName:
              _default: "s3-secret"
            secretKey: "host"

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