{{- range $index, $stack := .Values.applicationSet }} --- apiVersion: argoproj.io/v1alpha1 kind: ApplicationSet metadata: name: {{ $stack.name }} namespace: {{ $.Release.Namespace }} labels: app.kubernetes.io/name: {{ $stack.name }} app.kubernetes.io/instance: {{ $stack.name }} app.kubernetes.io/part-of: {{ $.Release.Name }} spec: syncPolicy: applicationsSync: create-update preserveResourcesOnDeletion: false generators: - git: repoURL: {{ $.Values.git.repo }} revision: {{ $.Values.git.revision }} directories: - path: "clusters/{{ $.Values.cluster.name }}/{{ $stack.name }}/*" template: metadata: name: '{{ `{{path.basename}}` }}' spec: destination: name: in-cluster namespace: '{{ $stack.namespace | default `{{path.basename}}` }}' project: default revisionHistoryLimit: 3 source: repoURL: {{ $.Values.git.repo }} targetRevision: {{ $.Values.git.revision }} path: '{{ `{{path}}` }}' helm: releaseName: "{{ `{{path.basename}}` }}" {{- if $stack.ignoreDifferences }} ignoreDifferences: {{- toYaml $stack.ignoreDifferences | nindent 8 }} {{ end }} syncPolicy: automated: prune: {{ $stack.syncPolicy.automated.prune | default false }} selfHeal: {{ $stack.syncPolicy.automated.selfHeal | default false }} retry: limit: 3 backoff: duration: 1m factor: 2 maxDuration: 15m syncOptions: - CreateNamespace={{ $stack.syncPolicy.syncOptions.createNamespace | default true }} - ApplyOutOfSyncOnly={{ $stack.syncPolicy.syncOptions.applyOutOfSyncOnly | default true }} - ServerSideApply={{ $stack.syncPolicy.syncOptions.serverSideApply | default true }} - PruneLast={{ $stack.syncPolicy.syncOptions.pruneLast | default true }} - RespectIgnoreDifferences={{ $stack.syncPolicy.syncOptions.respectIgnoreDifferences | default true }} {{- end }}