argoproj/argo-cd
ApplicationSets
ApplicationSets fan out a single template into many Application CRs. They are the primary mechanism for multi-cluster, multi-environment, and PR-preview deployments.
In one sentence
An
ApplicationSetis a template + a set of generators; the controller produces oneApplicationper element of the generators' product.
Generator types
Argo CD ships eight generators, all under applicationset/generators/. Each implements the small interface in applicationset/generators/interface.go.
| Generator | File | Use case |
|---|---|---|
| List | list.go |
A static, hand-written list of param maps. The simplest one. |
| Cluster | cluster.go |
One Application per registered destination cluster. Filterable by labels. |
| Git | git.go |
One Application per directory or per file in a Git repo (e.g., one app per environment folder). |
| Matrix | matrix.go |
Cartesian product of two child generators. Frequently Cluster × Git. |
| Merge | merge.go |
Field-merges the outputs of two child generators on a key. |
| SCM Provider | scm_provider.go + services/scm_provider/ |
One Application per repo in a GitHub/GitLab/Bitbucket/Gitea/Azure/AWS org. |
| Pull Request | pull_request.go + services/pull_request/ |
One Application per open PR — used for preview environments. |
| Plugin | plugin.go + services/plugin/ |
One Application per item from a user-supplied HTTP service. |
| DuckType | duck_type.go |
One Application per item from any cluster-scoped CRD that lists items. |
The generator dispatcher is applicationset/generators/generator_spec_processor.go, which validates the AppSet, resolves overrides, and emits the rendered parameter sets.
Templating
Each generator emits a list of parameter maps. The controller substitutes them into spec.template (a partial Application spec). The template engine is Go text/template + sprig with custom helpers in applicationset/utils/.
Recursive interpolation is implemented in applicationset/generators/value_interpolation.go so values in nested maps can reference earlier-resolved keys.
Reconciliation policies
Set via the controller flag --policy:
| Policy | Effect |
|---|---|
sync (default) |
Create + update + delete child Applications. |
create-only |
Only create new Applications; never modify or delete. |
create-update |
Create and update; never delete. |
create-delete |
Create and delete; never update. |
Per-AppSet ignore rules can be added via the applicationset.spec.ignoreApplicationDifferences block.
Progressive rollouts
When ARGOCD_APPLICATIONSET_CONTROLLER_ENABLE_PROGRESSIVE_SYNCS=true, the controller respects applicationset.spec.strategy.rollingSync.steps. Each step has a matchExpressions selector that targets a cohort of child Applications. The controller waits for that cohort to become healthy before proceeding to the next.
Code: applicationset/controllers/applicationset_controller.go and applicationset/status/.
Webhook fast path
applicationset/webhook/webhook.go listens for Git/PR webhooks and triggers immediate re-reconciliation of any ApplicationSet whose Git/SCM/PR generator targets the touched source.
Cluster fan-out
Cluster-aware generators (Cluster + Matrix-with-Cluster + Merge-with-Cluster) react to changes in the cluster Secrets through applicationset/controllers/clustereventhandler.go.
Common patterns
- All clusters get app X:
Clustergenerator with no filters → one App per cluster. - Per-environment fanout:
Gitdirectory generator overenvs/*/values.yaml→ one App per env. - Per-cluster, per-environment:
MatrixofCluster × Git. - PR previews:
Pull Requestgenerator targeting open PRs → one App per PR, deleted on close. - Bring your own:
Plugingenerator pointed at an internal HTTP service.
See applicationset/examples/ for runnable examples per generator.
See also
- ApplicationSet controller — the runtime.
- primitives/applicationset — the CRD schema.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.