iac.htora.dev · security templates

Home/Templates/Point Argo CD at a repository

Point Argo CD at a repository

The first Application, which then manages every other application from Git.

Argo CD

Why bother

Once Argo CD is installed it does nothing until you tell it which repository to follow. The usual mistake is adding applications one at a time through the web interface, which puts the list of what should be running in the one place that is not version controlled. One Application that points at a folder of Applications fixes that on day one.

How you know it worked

Add a folder to the repository. It appears in Argo CD without anyone running a command.

How it works

1You merge to the repositorya new file under apps/2Argo CD noticeswithin a few minutes3The bootstrap Applicationcreates one Application per file4Each Application syncsand puts back any hand edits
Step by step, from the thing that happens to the result you want.

Set it up

Pick your platform, then open the level you want. Each level is complete on its own. Read the comments in the files as you go. Anything with a real consequence is explained on the line where it happens.

Argo CD. An Application pointing at a folder of Applications

What you need first

  • Argo CD already installed in the cluster.
  • A repository Argo CD can read, with a protected branch you are happy to have deploy itself.

What it creates

  • One Application in the argocd namespace
  • An AppProject fencing which repositories, namespaces, and cluster-wide kinds are allowed (Standard)
  • An ApplicationSet that turns each folder under apps/ into an application (Standard)

The code

Quick startReadyone file, 54 lines
One Application watching a folder, with prune and self-heal on.
Change these first
  • repoURL: https://github.com/your-org/your-cluster-config.git bootstrap.yaml, line 33
Run it
  1. kubectl config current-context
    Shows which cluster kubectl is pointed at. Check it first.
  2. kubectl apply -f bootstrap.yaml
    Hands the Application to Argo CD.
  3. kubectl -n argocd get applications
    Lists applications with their sync and health status.
Download bootstrap.yaml
Checks

Kubernetes schema passed

Last run 2026-10-02.

outcomes/gitops-bootstrap/kubernetes/t0
bootstrap.yaml
Open bootstrap.yaml as plain text
StandardReadythree files, 161 lines
Adds the AppProject fence, an ApplicationSet generated from the folder layout, sync retries, server-side apply, and a sync role separate from an override role.
Run it
  1. kubectl config current-context
    Shows which cluster kubectl is pointed at. Check it first.
  2. kubectl apply -k .
    Applies everything the kustomization lists, in order.
  3. kubectl -n argocd get applications
    Lists applications with their sync and health status.
Download all three files as a zip
Checks

Kubernetes schema passedBuilds passed

Last run 2026-10-02.

outcomes/gitops-bootstrap/kubernetes/t1
applicationset.yaml
Open applicationset.yaml as plain text
kustomization.yaml
Open kustomization.yaml as plain text
project.yaml
Open project.yaml as plain text
HardenedReadyone file, 15 lines
Standard's manifests, unchanged. Rules refuse a missing project or application set, wildcard sources, destinations, or kinds, deployer rights beyond get and sync, and generated apps losing prune, self-heal, or their project. A daily diff against the cluster reports drift.
Run it
  1. kubectl config current-context
    Shows which cluster kubectl is pointed at. Check it first.
  2. kubectl apply -k .
    Applies everything the kustomization lists, in order.
  3. kubectl -n argocd get applications
    Lists applications with their sync and health status.
Download kustomization.yaml
Checks

Builds passed

Last run 2026-10-02.

outcomes/gitops-bootstrap/kubernetes/t2
kustomization.yaml
Open kustomization.yaml as plain text
What catches people

Without the resources-finalizer, deleting the bootstrap Application leaves every application it created still running and managed by nobody. Both templates set it.

An AppProject narrows what an application can create. It does not make ClusterRoleBinding safe. Anything allowed to create one can bind itself to cluster-admin, and Falco needs one. The Standard project allows it, says so in a comment, and relies on the list of permitted repositories to keep strangers out.

How to undo it

kubectl delete on the Application removes it and, because of that finalizer, everything underneath it. Check that is what you meant before you press return.

What it costs

None beyond what the applications themselves use.

Registry 0.23.0. Built 2026-11-17.

Made by Habibullah Tora. Source on GitHub. Code under the MIT licence, writing under CC BY 4.0.