---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: cde-worker-update-bundles
  namespace: cde

spec:
  interval: 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:
      cde-worker-update-bundles:
        enabled: true

        serviceAccount:
          enabled:
            _default: true
          name:
            _default: cde-vault

        image:
          name:
            _default: cr.yandex/crp3ccidau046kdj8g9q/updatebundles-worker:preprod_4302d8f3
          pullPolicy:
            _default: IfNotPresent

        deployment:
          enabled: true

          name:
            _default: cde-worker-update-bundles

          replicaCount:
            _default: 1

          port:
            _default: 8080

          command:
            _default: ["/bin/bash", "-lc"]
          args:
            _default:
              - |
                set -e
                source /vault/secrets/cde-env
                exec /worker

          resources:
            requests:
              cpu:
                _default: 500m
              memory:
                _default: 512Mi

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

        service:
          enabled: false

        imagePullSecrets:
          enabled:
            _default: true
          name:
            _default: regcred

        envs:
          - name: S3_IS_CONTOUR
            value:
              _default: "true"

          - name: IS_CONTOUR
            value:
              _default: "true"

        podAnnotations:
          _default:
            traffic.sidecar.istio.io/excludeOutboundPorts: "8200"
            vault.hashicorp.com/agent-init-first: "true"
            vault.hashicorp.com/agent-inject: "true"
            vault.hashicorp.com/agent-pre-populate-only: "true"
            vault.hashicorp.com/auth-path: auth/kubernetes
            vault.hashicorp.com/role: cde
            vault.hashicorp.com/agent-inject-secret-cde-env: secrets/data/vault/apps/cde
            vault.hashicorp.com/agent-inject-template-cde-env: |-
              {{- with secret "secrets/data/vault/apps/cde" -}}
              {{- range $k, $v := .Data.data }}
              export {{ $k }}=$(printf '%b' {{ printf "%q" (printf "%v" $v) }})
              {{- end }}
              {{- end -}}

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