apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: crossplane-azure-providerconfig
spec:
  syncPolicy:
    preserveResourcesOnDeletion: true
  generators:
    - list:
        elements:
          - env: dev-southeastasia-chengfei
            cluster: dev-southeastasia-chengfei-controlplane
          - env: staging-japaneast
            cluster: staging-japaneast-controlplane
  template:
    metadata:
      name: "{{env}}-crossplane-azure-providerconfig"
    spec:
      project: default
      source:
        repoURL: https://github.com/tidbcloud/app-delivery.git
        targetRevision: HEAD
        # Use base for all envs at the moment
        path: "dedicated-regional-server/crossplane-azure-providerconfig/envs/{{env}}"
      destination:
        namespace: crossplane-system
        name: "{{cluster}}"
      syncPolicy:
        automated:
          selfHeal: true
          prune: false
        syncOptions:
          - CreateNamespace=true
        retry:
          limit: 5
          backoff:
            duration: 5s
            factor: 2
            maxDuration: 3m
