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

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
  driftDetection:
    mode: enabled

  values:
    global:
      env: _default

    services:
      backend:
        enabled: true

        image:
          name:
            _default: cr.yandex/crp3ccidau046kdj8g9q/pm-backend:production_8b930b70
          pullPolicy:
            _default: IfNotPresent

        deployment:
          enabled: true

          name:
            _default: backend

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

          port:
            _default: 8080

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

        service:
          enabled: true

          name:
            _default: backend-svc

          type:
            _default: ClusterIP

          port:
            _default: 8000

          targetPort:
            _default: 8000

          portName:
            _default: http

        imagePullSecrets:
          enabled:
            _default: true
          name:
            _default: regcred
        volumes:
          _default:
            - name: env-file
              mountPath:
                _default: /opt/sarex/.env
              subPath:
                _default: .env
              readOnly:
                _default: true
              secret:
                secretName:
                  _default: sarex-env


        labels:
          monitoring: prometheus
        envs:
          - name: USERS_INTERNAL_HOST
            value:
              _default: "http://backend.django.svc.cluster.local:8000"

          - name: RESOURCES_INTERNAL_HOST
            value:
              _default: "http://resources-service.resources.svc.cluster.local:8000"

          - name: EAV_HOST
            value:
              _default: "http://eav-service.eav.svc.cluster.local:8000"

          - name: EAV_API_PREFIX
            value:
              _default: "/api/v0"

          - name: EAV_API_PREFIX_V1
            value:
              _default: "/api/v1"
        commitSha: ""
        gitlabUri: ""
        gitlabJobUrl: ""
        owner: ""
