Automate Your Argo CD Deployments with ApplicationSet Controller
Managing multiple Argo CD applications can quickly become a headache, especially when you're dealing with a large number of clusters or monorepos. The ApplicationSet controller exists to alleviate this pain by automating the creation and management of Argo CD Applications. This means you can focus on your code instead of wrestling with deployment configurations.
The ApplicationSet is a CustomResourceDefinition (CRD) that utilizes generators to produce parameters for application templates. When you define an ApplicationSet, you specify a generator type—like List, Cluster, Git, or Matrix—that determines how parameters are created. For instance, a List generator allows you to define a fixed list of cluster names and URLs, while a Cluster generator automatically pulls in parameters from the clusters defined within Argo CD. Once the parameters are generated, they are substituted into the template, creating an Argo CD Application resource for each set of parameters. This resource is then managed by the Argo CD controller, which handles the lifecycle of your applications.
In production, understanding the security implications of ApplicationSets is crucial. Be cautious about how you configure your generators and templates. Starting with Argo CD v2.3, the ApplicationSet controller is bundled with Argo CD, making it readily available for your deployment needs. This integration simplifies the process, but you still need to be aware of the potential complexities that come with managing multiple applications across various environments.
Key takeaways
- →Utilize the ApplicationSet controller to automate Argo CD application management.
- →Choose the appropriate generator type—List, Cluster, Git, or Matrix—based on your deployment needs.
- →Be aware of security implications when configuring ApplicationSets.
Why it matters
In a production environment, automating application management can save significant time and reduce human error, leading to more reliable deployments across multiple clusters.
Code examples
1apiVersion:argoproj.io/v1alpha1
2kind:ApplicationSet
3metadata:
4 name: guestbook
5spec:
6 goTemplate: true
7 goTemplateOptions: ["missingkey=error"]
8 generators:
9 - list:
10 elements:
11 - cluster: engineering-dev
12 url: https://1.2.3.4
13 - cluster: engineering-prod
14 url: https://2.4.6.8
15 - cluster: finance-preprod
16 url: https://9.8.7.6
17 template:
18 metadata:
19 name: '{{.cluster}}-guestbook'
20 spec:
21 project: my-project
22 source:
23 repoURL: https://github.com/infra-team/cluster-deployments.git
24 targetRevision: HEAD
25 path: guestbook/{{.cluster}}
26 destination:
27 server: '{{.url}}'
28 namespace: guestbook1apiVersion:argoproj.io/v1alpha1
2kind:Application
3metadata:
4 name: engineering-dev-guestbook
5spec:
6 source:
7 repoURL: https://github.com/infra-team/cluster-deployments.git
8 targetRevision: HEAD
9 path: guestbook/engineering-dev
10 destination:
11 server: https://1.2.3.4
12 namespace: guestbookWhen NOT to use this
The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.
Want the complete reference?
Read official docsDeploy any app in seconds — no infrastructure config, no DevOps overhead. Instant deployments from GitHub, built-in databases, and automatic scaling.
Start deploying free →Securing Open Source in the AI Era: Lessons from 50 Projects
In the rapidly evolving landscape of AI, security in open source projects is more critical than ever. The GitHub Secure Open Source Fund directly ties funding to measurable security outcomes, ensuring that maintainers can effectively tackle security challenges. Discover how this program can enhance your project's security posture.
Mastering GitHub Actions: Triggering Workflows Like a Pro
GitHub Actions workflows are powerful, but knowing how to trigger them effectively is crucial. You can specify which activity types will kick off a workflow run, giving you control over your CI/CD processes. Dive in to learn the ins and outs of workflow triggers.
Extending Malware Advisories Beyond npm: A Game Changer
Malware advisories are crucial for maintaining secure ecosystems. With the new OpenSSF importer, we can now validate and normalize malicious package data across multiple platforms. This article dives into how this process works and what you need to know for production.
Get the daily digest
One email. 5 articles. Every morning.
No spam. Unsubscribe anytime.