apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: quota-exporter
spec:
  generators:
  - list:
      elements:
      # Deploy to GKE for GCP quota
      - env: dev-seed-us-west1
        cluster: dev-seed-us-west1
      - env: staging-seed-us-west1
        cluster: staging-seed-us-west1
      - env: prod-seed-us-west1
        cluster: prod-seed-us-west1
      # Deploy to EKS for AWS quota
      - env: dev-base-us-west-2
        cluster: dev-base-us-west-2
      - env: staging-base-us-west-2
        cluster: staging-base-us-west-2
      - env: prod-base-us-west-2
        cluster: prod-base-us-west-2
  template:
    metadata:
      name: '{{env}}-quota-exporter'
    spec:
      project: default          # Use default project as a start
      source:
        repoURL: https://github.com/tidbcloud/app-delivery.git
        targetRevision: HEAD
        path: 'quota-exporter/envs/{{env}}'
      destination:
        name: '{{cluster}}'
        namespace: infra
      syncPolicy:
        automated:
          selfHeal: true
          prune: true
        syncOptions:
          - CreateNamespace=true
          - PruneLast=true
        retry:
          limit: 5
          backoff:
            duration: 5s
            factor: 2
            maxDuration: 3m
