GitOps & ArgoCD (50 Qs)•Part 2: ArgoCD at Scale & Progressive Delivery (Mid-Level)
What is the ArgoCD `ApplicationSet` CRD?
senior LevelCode ExamplegitopsArgoCD at Scale
In Simple Words:
Managing 500 individual Application YAMLs manually is unmaintainable.
ApplicationSet is a controller that automates the generation of ArgoCD Application resources using Generators:
- List Generator: Generates applications based on a fixed list of environments.
- Git Directory Generator: Scans a Git repository and creates an application for every subfolder.
- Cluster Generator: Automatically deploys applications to all clusters labeled with
env: productionregistered in ArgoCD. - Matrix Generator: Combines multiple generators (e.g., all clusters × all microservices).
yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: microservices
namespace: argocd
spec:
generators:
- git:
repoURL: https://github.com/enterprise/gitops.git
revision: main
directories:
- path: services/*
template:
metadata:
name: '{{path.basename}}'
spec:
project: default
source:
repoURL: https://github.com/enterprise/gitops.git
targetRevision: main
path: '{{path}}'
destination:
server: https://kubernetes.default.svc
namespace: '{{path.basename}}'