apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: backend
  namespace: eav

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/eav:prod_2460295f
          pullPolicy:
            _default: IfNotPresent

        deployment:
          enabled: true

          name:
            _default: backend

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

          port:
            _default: 8000

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

        service:
          enabled: true

          name:
            _default: eav-service

          type:
            _default: ClusterIP

          port:
            _default: 8000

          targetPort:
            _default: 8000

          portName:
            _default: http

        imagePullSecrets:
          enabled:
            _default: true
          name:
            _default: regcred
        volumes:
          _default:
          - name: asset
            mountPath:
              _default: /server/assets/api/v0/views/asset.py
            subPath:
              _default: asset.py
            readOnly:
              _default: true
            configMap:
              name:
                _default: asset
              items:
              - key: asset.py
                path:
                  _default: asset.py
          - name: permissions
            mountPath:
              _default: /server/core/permissions.py
            subPath:
              _default: permissions.py
            readOnly:
              _default: true
            configMap:
              name:
                _default: permissions
              items:
              - key: permissions.py
                path:
                  _default: permissions.py
          - name: django-configmap
            mountPath:
              _default: /server/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: KAFKA_USERNAME
            value:
              _default: "sarex"

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

          - name: KAFKA_HOST
            value:
              _default: "brusnika-stage-kafka-bootstrap.kafka.svc.cluster.local:9093"

          - name: ASSETS_TOPIC
            value:
              _default: "sarex"

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

          - name: DJANGO_POSTGRES_HOST
            value:
              _default: "postgres-service"

          - name: DJANGO_POSTGRES_DATABASE
            value:
              _default: "eav"

          - name: YC_S3_ENDPOINT_URL
            value:
              _default: "http://minio-svc.minio.svc.cluster.local:9000"

          - name: YC_S3_BUCKET_NAME
            value:
              _default: "eav"
        secretEnvs:
          - name: KAFKA_PASSWORD
            secretName:
              _default: "kafka-cred"
            secretKey: "password"

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

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

          - 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: YC_S3_ACCESS_KEY_ID
            secretName:
              _default: "s3-secret"
            secretKey: "login"

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

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