apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: investibook
spec:
  generators:
    - list:
        elements:
          - env: preview
            cluster: prod-devops
            namespace: investibook
          - env: external-customer-prod
            cluster: prod-devops
            namespace: investibook-external-customer-prod
  template:
    metadata:
      name: "{{env}}-investibook"
    spec:
      project: default
      source:
        repoURL: https://github.com/tidbcloud/app-delivery.git
        targetRevision: HEAD
        path: "devops-service/investibook/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
