# ApplicationSet을 사용한 방법
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: kubeflow-applicationset
  namespace: platform
spec:
  generators:
  - list:
      elements:
      - name: istio-system
        path: kubeflow/dip/istio-system
        namespace: istio-system
        wave: "0"
        dependencies: ""
      - name: kubeflow-dependencies
        path: kubeflow/dip/kubeflow-dependencies
        namespace: kubeflow
        wave: "1"
        dependencies: "istio-system"
      - name: kubeflow-core
        path: kubeflow/dip/kubeflow-core
        namespace: kubeflow
        wave: "2"
        dependencies: "kubeflow-dependencies"
  template:
    metadata:
      name: '{{name}}'
      annotations:
        argocd.argoproj.io/sync-wave: '{{wave}}'
      finalizers:
        - resources-finalizer.argocd.argoproj.io
    spec:
      project: default
      source:
        repoURL: $GIT_REPO_URL
        targetRevision: $TAG 
        path: '{{path}}'
      destination:
        server: https://kubernetes.default.svc
        namespace: '{{namespace}}'
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        syncOptions:
          - CreateNamespace=true
          - ServerSideApply=true
        retry:
          limit: 5
          backoff:
            duration: 5s
            factor: 2
            maxDuration: 3m
      info:
        - name: 'Wave'
          value: '{{wave}}'
        - name: 'Dependencies'
          value: '{{dependencies}}'