apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: clinic-victoria-metrics-operator
spec:
  generators:
    - list:
        elements:
          - env: dev
            cluster: staging-clinic
            namespace: monitoring-dev
  template:
    metadata:
      name: "{{env}}-clinic-victoria-metrics-operator"
    spec:
      project: default # Use default project as a start
      sources:
        - repoURL: https://victoriametrics.github.io/helm-charts
          chart: victoria-metrics-operator
          targetRevision: 0.33.3
          helm:
            releaseName: victoria-metrics-operator-{{env}}
            valueFiles:
              - $values/dev/clinic/clinic-monitor/values/victoria-metrics-operator/envs/{{env}}/values.yaml
        - repoURL: https://github.com/tidbcloud/app-delivery.git
          targetRevision: HEAD
          ref: values
      destination:
        name: "{{cluster}}"
        namespace: "{{namespace}}"
      syncPolicy:
        automated:
          selfHeal: true
          prune: true
        syncOptions:
          - CreateNamespace=true
          - PruneLast=true
        retry:
          limit: 5
          backoff:
            duration: 5s
            factor: 2
            maxDuration: 3m
