
This guide will explain the various components of ArgoCD Projects in YAML. In the spirit of GitOps, you may leverage deploying ArgoCD Projects from source code. This can be a powerful way to maintain Argo, and even consistently deploy to multiple clusters maintained by multiple Argo instances.
Understanding the ArgoCD Project
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: hello-haze-project
namespace: argocd
spec:
description: AppProject for the Hello Haze UI
destinations:
- namespace: hello-haze
server: https://kubernetes.default.svc
namespaceResourceBlacklist:
- group: ""
kind: ResourceQuota
- group: ""
kind: LimitRange
namespaceResourceWhitelist:
- group: '*'
kind: '*'
sourceRepos:
- 'https://gitlab.clearthehaze.com/**'
You may see some expected properties in this resource, but let me elaborate on these elements.
Line 2: This deploys an AppProject resource
Line 4-5: The project will be named hello-haze-project and deployed in the argocd namespace. In ArgoCD 2.5.0, Argo resources need to be in the argocd namespace. Future releases will likely ease this restriction.
Line 7: A simple description on the resource, later displayed in the Argo UI.
Lines 8-10: In this case, this Project only allows resources to deploy to the hello-haze namespace. Any attempts to deploy elsewhere will result in an error.
Lines 11-15: This block prohibits modifying the ResourceQuota and LimitRange within the namespace. This prevents any application from messing with resource restrictions place on the namespace.
Lines 16-18: This block allows all other resources to deploy to the destinations.
Lines 19-20: The sourceRepos are the Git repositories which this Project may read.
To learn more about configuring the Project, check out my post on Project configuration.
