apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: nextgen-traffic-replay-crds
spec:
  generators:
    - list:
        elements:
          - env: prod
            cluster: prod-ap-southeast-1-controlplane-ng
          - env: prod
            cluster: prod-seed-cn-hongkong-ng
  template:
    metadata:
      name: "{{cluster}}-nextgen-traffic-replay-crds"
    spec:
      project: default # Use default project as a start
      source:
        repoURL: https://github.com/tidbcloud/app-delivery.git
        targetRevision: HEAD
        path: "nextgen-regional-control-plane/traffic-replay-crds/envs/{{env}}"
      destination:
        name: "{{cluster}}"
      syncPolicy:
        automated:
          selfHeal: true
          # prune: true  # auto prune CRD is dangerous, let's prune manually
        retry:
          limit: 5
          backoff:
            duration: 5s
            factor: 2
            maxDuration: 3m
