CICD-292 · Argo CD ApplicationSet
Encyclopedia · Advanced GitOps and progressive delivery · All snippets
Previous · CICD-291 · Next · CICD-293
1. Where it fits
- Placement Under the ApplicationSet
spec. Supply the matchingtemplatefields. - Prerequisites trusted configuration repository, test cluster and named GitOps controller or rollout controller.
- Platforms kubernetes, local-lab.
2. Copy the snippet
yaml
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- list:
elements:
- {env: staging, namespace: staging}
- {env: sandbox, namespace: sandbox}3. How it works
The list generator emits one parameter set per environment. goTemplate and missingkey=error cause incomplete template inputs to fail visibly.
A single generator creates one Application per environment row.
flowchart TD N1["ApplicationSet list"] N2["Go template"] N1 --> N2 N3["Staging Application"] N2 --> N3 N4["Sandbox Application"] N2 --> N4
4. Verify the result
Put under ApplicationSet spec and reference {{ .env }} and {{ .namespace }} in its template. Expect one Application per element.
Validation syntax-validated (YAML parse). Status definitions.