---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: s3-proxy-bim
  namespace: django
spec:
  interval: 5m
  timeout: 10m

  chart:
    spec:
      chart: universal-chart
      version: "0.1.9"
      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:
      s3-proxy-bim:
        enabled: true

        # образ публичный, из Docker Hub — pull-секрет не нужен
        image:
          name:
            _default: pottava/s3-proxy
          pullPolicy:
            _default: Always

        deployment:
          enabled: true

          name:
            _default: s3-proxy-bim

          replicaCount:
            _default: 2

          port:
            _default: 80

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

        service:
          enabled: true

          name:
            _default: s3-bim-service

          type:
            _default: ClusterIP

          port:
            _default: 80

          targetPort:
            _default: 80

          portName:
            _default: http

        imagePullSecrets:
          enabled:
            _default: false

        envs:
          - name: AWS_API_ENDPOINT
            value:
              _default: "https://storage.yandexcloud.net"

        # ключи S3 лежат в Secret/s3-proxy-bim-secret, созданном вне этого релиза
        secretEnvs:
          - name: AWS_ACCESS_KEY_ID
            secretName:
              _default: "s3-proxy-bim-secret"
            secretKey: "login"

          - name: AWS_SECRET_ACCESS_KEY
            secretName:
              _default: "s3-proxy-bim-secret"
            secretKey: "password"

          - name: AWS_S3_BUCKET
            secretName:
              _default: "s3-proxy-bim-secret"
            secretKey: "bucket"
