Lesson 06 of 11 · The golden path
From template to every cluster
Close the loop from 'Create' to running in production: a repository convention plus one ApplicationSet that discovers every golden-path repository and deploys it to every labelled cluster, then a ring-by-ring rollout so a bad change stops before it reaches everyone. Tested on the lab, with the gotchas found.
The contract: a repository convention
The template (previous lesson) created a repository in the golden organisation with a deploy/ folder. Make that the contract:
Any repository in
golden/that containsdeploy/is a service; itsdeploy/folder is deployed to every workload cluster, into a namespace named after the repository.
No registration, no ticket. The platform discovers it.
The school says: "any club that puts its sign-up sheet in the blue tray will be announced in every classroom." Nobody has to ask the head teacher; putting the sheet in the tray is enough.
One ApplicationSet for the whole fleet
A matrix of two generators: every matching repository × every labelled cluster.
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: golden-fleet
namespace: argocd
spec:
goTemplate: true
goTemplateOptions: [ "missingkey=error" ]
generators:
- matrix:
generators:
- scmProvider: # 1) every service repo in the golden org
requeueAfterSeconds: 30
gitea:
owner: golden
api: http://gitea-http.gitea.svc:3000
insecure: true
filters:
- pathsExist: [ deploy ]
- clusters: # 2) every workload cluster (the hub has no ring label)
selector:
matchExpressions:
- { key: fleet.example.io/ring, operator: Exists }
template:
metadata:
name: '{{ .repository }}-{{ .name }}'
labels:
fleet.example.io/service: '{{ .repository }}'
fleet.example.io/cluster: '{{ .name }}'
fleet.example.io/ring: '{{ index .metadata.labels "fleet.example.io/ring" }}'
spec:
project: default
source:
repoURL: 'http://gitea-http.gitea.svc:3000/golden/{{ .repository }}.git'
targetRevision: '{{ .branch }}'
path: deploy
destination:
server: '{{ .server }}'
namespace: '{{ .repository }}'
syncPolicy:
automated: { prune: true, selfHeal: true }
syncOptions: [ CreateNamespace=true ]
From scmProvider you get .repository and .branch; from clusters you get .name, .server and the Secret's labels. Other Git hosts have their own scmProvider blocks (github, gitlab, bitbucketServer, azureDevOps).
Gotchas found while testing
- In-cluster URLs: Argo CD runs in the hub, so it must reach Gitea at
gitea-http.gitea.svc:3000. Gitea reports alocalhostclone URL that only works from your laptop, so buildrepoURLyourself. - One empty repository breaks everyone: an empty repo made Gitea return HTTP 500 for its branch, which failed the whole generator for every service. Create repositories with content (the template does), and monitor the ApplicationSet's conditions.
Ring by ring: progressive syncs
Deploying to every cluster at once means a bad change reaches everyone at once. Enable progressive syncs on the ApplicationSet controller, then add a RollingSync strategy using the ring label:
$ kubectl -n argocd patch cm argocd-cmd-params-cm --type merge \
-p '{"data":{"applicationsetcontroller.enable.progressive.syncs":"true"}}'
$ kubectl -n argocd rollout restart deploy argocd-applicationset-controller
spec:
strategy:
type: RollingSync
rollingSync:
steps:
- matchExpressions:
- { key: fleet.example.io/ring, operator: In, values: [ "0" ] }
- matchExpressions:
- { key: fleet.example.io/ring, operator: In, values: [ "1" ] }
maxUpdate: 100%
Ring 1 only syncs once ring 0's applications are Healthy. If ring 0 gets stuck (for example a bad manifest retrying), ring 1 never starts. Fix Git, then clear the stuck operation with argocd app terminate-op. To undo a bad change, git revert it: it rolls out ring by ring like any other change and leaves an audit trail.
Within a cluster, combine this with progressive delivery (canary analysis with Argo Rollouts) for application changes; rings protect the fleet, canaries protect each cluster.
Measure the path
Record time to first deploy: from pressing Create to the service being healthy in every cluster. In the lab it is a couple of minutes. In a real organisation, the comparison with the old ticket-based process is the platform's best argument.
Try it
Apply the ApplicationSet. Run the template from lesson 5 for tenant-api, start a stopwatch, and watch two Applications appear (one per cluster) and become Healthy. Then enable progressive syncs, push a change that breaks the readiness probe, and watch ring 1 wait. Revert with git revert and watch it recover ring by ring.
What you should see
tenant-api-wl-1 and tenant-api-wl-2 appear within about a minute of the repository being created (the generator re-checks every 30 seconds). With the broken probe, tenant-api-wl-1 stays Progressing/Degraded and tenant-api-wl-2 stays Waiting. After the revert, ring 0 becomes Healthy first, then ring 1 syncs.
Recap
- A repository convention (
golden/+deploy/) is the contract between the golden path and the platform. - One matrix ApplicationSet (SCM provider × labelled clusters) deploys every service everywhere, with no tickets.
- RollingSync with ring labels stops bad changes early; roll back with
git revert. - Time to first deploy is the headline metric of the golden path.
This site is a public version of my personal engineering knowledge hub. It intentionally excludes confidential company information and internal operational details.