apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: workloads namespace: argocd annotations: argocd.argoproj.io/sync-wave: "-5" argocd.argoproj.io/sync-options: Prune=confirm,Delete=confirm spec: goTemplate: true goTemplateOptions: - missingkey=error generators: - list: elements: - component: auth-server cluster: dev-k3s server: https://kubernetes.default.svc namespace: auth-dev path: clusters/dev-k3s/overlays/workloads/auth-server autoSync: "false" - component: api-server cluster: dev-k3s server: https://kubernetes.default.svc namespace: api-dev path: clusters/dev-k3s/overlays/workloads/api-server autoSync: "false" template: metadata: name: "{{ .component }}-{{ .cluster }}" annotations: argocd.argoproj.io/sync-options: Prune=confirm,Delete=confirm project-gitops.io/auto-sync-gate: "{{ .autoSync }}" labels: project-gitops.io/cluster: "{{ .cluster }}" project-gitops.io/owner: workloads spec: project: workloads source: repoURL: https://git.learn.hyeonworks.com/donghyeon.kang/project-gitops targetRevision: main path: "{{ .path }}" destination: server: "{{ .server }}" namespace: "{{ .namespace }}" syncPolicy: syncOptions: - CreateNamespace=true - PruneLast=true - FailOnSharedResource=true retry: limit: 5 refresh: true backoff: duration: 5s factor: 2 maxDuration: 3m revisionHistoryLimit: 5 templatePatch: | {{- if eq .autoSync "true" }} spec: syncPolicy: automated: enabled: true prune: true selfHeal: true {{- end }} syncPolicy: applicationsSync: create-update preserveResourcesOnDeletion: true