3.6 KiB
Per AI Blitz Plan §6. Layer: 1-T.
Coding Guidelines — ArgoCD Application Manifests
Conventions for ArgoCD Application YAML files in incubator/<env>/.
Required fields
Every incubator Application must have all of these:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: incubator-infra-<cluster> # Must match filename without .yaml
namespace: <argocd-namespace> # argocd-prd | argocd-dev | argocd-shared-int
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: 'https://github.com/Meesho/devops-infra-argo-config'
targetRevision: <branch> # main | develop | pre-prod
path: generic-argo-apps-chart
helm:
valueFiles:
- ../values/<env>/incubator-infra-<cluster>-values.yaml
destination:
name: in-cluster
namespace: <argocd-namespace>
metadata.name rules
- Must equal the filename without
.yaml— this is ArgoCD's tracking key (R9). - Convention:
incubator-infra-<gke-cluster-name>(e.g.incubator-infra-k8s-central-prd-ase1). - Changing this after the Application is registered breaks ArgoCD tracking; treat as immutable.
metadata.namespace (ArgoCD namespace)
| Environment | Namespace |
|---|---|
| prd | argocd-prd |
| stg / dev | argocd-dev |
| int | argocd-shared-int |
The metadata.namespace and spec.destination.namespace must be the same value.
spec.source.repoURL allow-list
Only one value is permitted:
https://github.com/Meesho/devops-infra-argo-config
Changing this is a Layer 3 operation. See AGENT_BOUNDARIES.md.
spec.source.targetRevision
Must match the environment branch:
| Environment | targetRevision |
|---|---|
| prd | main |
| stg / dev | develop |
| int | pre-prod |
Never pin to a feature branch. Feature branches are not monitored by auto-sync.
spec.source.path
Always generic-argo-apps-chart. This is the Helm chart that renders child Applications from the values file.
spec.destination.name
Always in-cluster. Incubator Applications run on the ArgoCD admin cluster itself, not on the target GKE cluster.
spec.destination.namespace
Must match metadata.namespace — same ArgoCD namespace.
Finalizer
The finalizer resources-finalizer.argocd.argoproj.io must be present. It causes ArgoCD to cascade-delete child Applications when the parent incubator is deleted. Removing it creates orphaned child Applications.
helm.valueFiles path convention
Paths are relative to the chart root (generic-argo-apps-chart/), so .. is required to reach the repo root:
generic-argo-apps-chart/ (chart root = ArgoCD's working dir for this source)
../values/<env>/incubator-infra-<cluster>-values.yaml
└── resolves to: values/<env>/incubator-infra-<cluster>-values.yaml at repo root
Naming invariant
Directory and values path vary by env — but the invariant itself is universal:
prd (main):
Filename: incubator/prd/incubator-infra-k8s-central-prd-ase1.yaml
metadata.name: incubator-infra-k8s-central-prd-ase1
helm.valueFiles: ../values/prd/incubator-infra-k8s-central-prd-ase1-values.yaml
stg (develop):
Filename: incubator/infra/incubator-infra-k8s-central-stg-ase1.yaml
metadata.name: incubator-infra-k8s-central-stg-ase1
helm.valueFiles: ../values/dev/ incubator-infra-k8s-central-stg-ase1-values.yaml
All three must be consistent. Any mismatch causes a routing failure.