I’m trying to set up an Argo CD ApplicationSet where I want to enable auto-sync for the develop environment and disable it for the prod environment. Here’s what I have so far:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: my-application-deployment
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- list:
elements:
- env: develop
namespace: dev-my-service
sync: true
- env: prod
namespace: my-service
sync: false
template:
metadata:
name: 'my-service-{{.env}}'
spec:
project: default
source:
repoURL: 'https://example.com/my-repo.git'
targetRevision: develop
path: 'my-service'
helm:
valueFiles:
- 'values-{{.env}}.yaml'
destination:
name: in-cluster
namespace: '{{.namespace}}'
syncPolicy:
syncOptions:
- CreateNamespace=true
{{- if .sync }}
automated:
prune: true
selfHeal: true
{{- end }}
However, it seems that Argo CD doesn’t support conditions in go-template for the syncPolicy field. When I try to apply this manifest, I get an error:
error splitting YAML to string: failed to unmarshal manifest: error converting YAML to JSON: yaml: line 36: could not find expected ':'
Thanks in advance!