apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: clinic-monitor
spec:
  generators:
    - list:
        elements:
          - env: dev
            cluster: staging-clinic
            namespace: monitoring-dev
  template:
    metadata:
      name: "{{env}}-clinic-monitor"
    spec:
      project: default # Use default project as a start
      source:
        repoURL: https://github.com/tidbcloud/app-delivery.git
        targetRevision: HEAD
        path: "dev/clinic/clinic-monitor/envs/{{env}}"
      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
