concept
ApplicationSet and environment promotion
This complete illustrative ApplicationSet assumes two registered destinations and an existing restricted AppProject. It uses Go templates in string fields and fails when a required key is missing. Go templates are evaluated per string field, not arbitrary YAML objects. The revision names and URLs are fictional; resolve each revision to a reviewed commit in a real delivery record. The ApplicationSet policy controls changes to Applications, not their sync behavior. No automated sync is configured here.
Formal Syntax & Structure
kubernetes syntaxkubernetes
apiVersion: argoproj.io/v1alpha1kind: ApplicationSetmetadata: name: catalog-environments namespace: argocdspec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - list: elements: - env: dev server: https://dev.example.invalid revision: reviewed-dev - env: staging server: https://staging.example.invalid revision: reviewed-staging template: metadata: name: 'catalog-{{.env}}' spec: project: catalog-lab source: repoURL: https://git.example.invalid/catalog/config.git targetRevision: '{{.revision}}' path: 'overlays/{{.env}}' destination: server: '{{.server}}' namespace: 'catalog-{{.env}}' syncPolicy: applicationsSync: create-update preserveResourcesOnDeletion: trueWorking Example
Example Snippetkubernetes
apiVersion: argoproj.io/v1alpha1kind: ApplicationSetmetadata: name: catalog-environments namespace: argocdspec: goTemplate: true goTemplateOptions: ["missingkey=error"] generators: - list: elements: - env: dev server: https://dev.example.invalid revision: reviewed-dev - env: staging server: https://staging.example.invalid revision: reviewed-staging template: metadata: name: 'catalog-{{.env}}' spec: project: catalog-lab source: repoURL: https://git.example.invalid/catalog/config.git targetRevision: '{{.revision}}' path: 'overlays/{{.env}}' destination: server: '{{.server}}' namespace: 'catalog-{{.env}}' syncPolicy: applicationsSync: create-update preserveResourcesOnDeletion: true