Feedback

Chat Icon

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

ApplicationSets: Generate Applications from Templates
90%

The ApplicationSet: a List generator

An ApplicationSet has two parts: a generator and a template. The generator produces a set of parameters; the template is an Application with blanks in it. For each set of parameters the generator emits, the controller fills in the blanks and creates one Application.

The simplest generator is list, that's the clearest place to start. You write out the parameter sets by hand, one block per cluster.

Here is an example:

cat < $HOME/web-appset.yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: web
  namespace: argocd
spec:
  generators:
  # One element per cluster. Each becomes one Application.
  # 'cluster' and 'url' are arbitrary names; they become template params.
  - list:
      elements:
      - cluster: test
        url: https://test-api.example:6443
      - cluster: prod
        url: https://prod-api.example:6443
  template:
    metadata:
      # {{cluster}} expands to 'test' and 'prod', so you get
      # two Applications named web-test and web-prod.
      name: 'web-{{cluster}}'
    spec:
      project: default
      source:
        repoURL: $REPO_URL
        targetRevision: main
        path

GitOps the Hard Way, with Argo CD

Build Real GitOps Pipelines From Empty Clusters to Automated Deploys

Enroll now to unlock all content and receive all future updates for free.