{{- range $key, $value := .Values.applications -}} {{- $disabled := default false .disabled }} {{- $destinationNamespace := default $key .destinationNamespace }} {{- $server := "https://kubernetes.default.svc" }} {{- $project := default $.Release.Name .project }} {{- $path := default (printf "%s/%s" $.Values.subFolder $key) .path }} {{- $source := default false .source }} {{- $disableAutoSync := default false .disableAutoSync }} {{- $enableHelmKustomize := default false .enableHelmKustomize }} {{- $automatedPrune := default true .automatedPrune }} {{- $selfHeal := default true .selfHeal }} {{- $helmServerSideApply := default false .helmServerSideApply }} {{- $ignoreDifferences := default false .ignoreDifferences }} {{- if not $disabled }} --- apiVersion: argoproj.io/v1alpha1 kind: Application metadata: annotations: argocd.argoproj.io/sync-wave: "10" name: {{ $key }} namespace: {{ default "argocd" $.Values.argocdNamespace }} spec: destination: namespace: {{ default $key $destinationNamespace }} name: in-cluster # server: {{ default $server }} project: {{ $project }} source: path: {{ $path }} repoURL: {{ $.Values.repository }} {{ if $source -}} {{- toYaml $source | indent 4 }} {{- end }} {{- if $enableHelmKustomize }} plugin: name: kustomized-helm {{- end }} {{- if $ignoreDifferences }} ignoreDifferences: {{ toYaml $ignoreDifferences | indent 4 }} {{- end }} {{- if not $disableAutoSync }} syncPolicy: syncOptions: - ApplyOutOfSyncOnly=true {{- if $helmServerSideApply }} - ServerSideApply=true {{- end }} automated: prune: {{ default true $automatedPrune }} selfHeal: {{ default true $selfHeal }} {{- end }} {{- end }} {{ end }}