All technological notes.
ApplicationSet
CRD that automates the generation and management of multiple Argo CD Applications using a single, templated manifest.clusters with Argo CD.applications from one or multiple Git repositories with Argo CDApplicationSet controller:
application in ArgoCD namespace.ApplicationSet
Application controller responsibility to deploy resources into destination clusters.| Command | Description |
|---|---|
kubectl get appset -n argocd |
List ApplicationSets in the Argo CD namespace. |
kubectl get appset <name> -n argocd |
View one ApplicationSet. |
kubectl describe appset <name> -n argocd |
Show detailed status, events, and troubleshooting information. |
kubectl delete appset <name> -n argocd |
Delete an ApplicationSet. Usually also removes generated Applications. |
kubectl get applications -n argocd |
List Applications generated by the ApplicationSet. |
kubectl logs -n argocd deploy/argocd-applicationset-controller |
Check ApplicationSet controller logs. |
Template:
Generator:
List generator:
name/URL values.apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: guestbook
spec:
generators:
- list:
elements:
- cluster: engineering-prod-1
url: https://1.2.3.4
- cluster: engineering-prod-2
url: https://2.4.6.8
template:
metadata:
name: "-guestbook"
spec:
destination:
server: ""
namespace: guestbook
source:
repoURL: https://github.com/argoproj/argocd-example-apps.git
targetRevision: HEAD
path: guestbook/
Additional key/value pairs can be set manually via values field.
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: guestbook
spec:
generators:
- cluster:
selector: # the cluater with target labels
matchLabels:
env: staging
values: # additional values
revision: HEAD
- cluster:
selector: # the cluater with target labels
matchLabels:
env: production
values: # additional values
revision: stable
template:
metadata:
name: "-guestbook"
spec:
destination:
server: ""
namespace: guestbook
source:
repoURL: https://github.com/argoproj/argocd-example-apps.git
targetRevision: ""
path: guestbook
Git generator:
parameters are:
exclude feature
. (such as .git).Matrix generator: The Matrix generator may be used to combine the generated parameters of two separate generators. • Merge generator: The Merge generator may be used to merge the generated parameters of two or more generators. Additional generators can override the values of the base generator. • SCM Provider generator: The SCM Provider generator uses the API of an SCM provider (eg GitHub) to automatically discover repositories within an organization. • Pull Request generator: The Pull Request generator uses the API of an SCMaaS provider (eg GitHub) to automatically discover open pull requests within an repository. • Cluster Decision Resource generator: The Cluster Decision Resource generator is used to interface with Kubernetes custom resources that use custom resourcespecific logic to decide which set of Argo CD clusters to deploy to.
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: guestbook-appset
namespace: argocd
spec:
goTemplate: true
goTemplateOptions:
- missingkey=error
generators:
- list:
elements:
- env: dev
namespace: guestbook-dev
- env: prod
namespace: guestbook-prod
template:
metadata:
name: "-guestbook"
spec:
project: default
source:
repoURL: https://github.com/argoproj/argocd-example-apps.git
targetRevision: HEAD
path: guestbook
destination:
server: https://kubernetes.default.svc
namespace: ""
syncPolicy:
syncOptions:
- CreateNamespace=true
kubectl apply -f demo_appset.yaml
# applicationset.argoproj.io/guestbook-appset created
argocd app sync dev-guestbook
argocd app sync prod-guestbook
argocd app list
# NAME CLUSTER NAMESPACE PROJECT STATUS HEALTH SYNCPOLICY CONDITIONS REPO PATH TARGET
# argocd/dev-guestbook https://kubernetes.default.svc guestbook-dev default Synced Healthy Manual <none> https://github.com/argoproj/argocd-example-apps.git guestbook HEAD
# argocd/prod-guestbook https://kubernetes.default.svc guestbook-prod default Synced Healthy Manual <none> https://github.com/argoproj/argocd-example-apps.git guestbook HEAD