GitOps
The cluster pulls its desired state from Git: nobody runs kubectl, and drift corrects itself.
The CityScript
This is all there is to it. Change it in the editor and the city redraws.
%% G · GitOps
%% Git is the source of truth. A controller in the cluster pulls it, diffs it and applies the difference.
city 48x32
district source "Source of truth" 3,3..13,12
district cluster "Cluster" 18,3..45,20
building repo tower in source "Config repo"
floor repo.f "Git"
room repo.main storage "main branch"
room repo.pr config "Pull requests"
building argo tower in cluster "Argo CD"
floor argo.f "Controller"
room argo.sync worker "Sync loop"
room argo.diff worker "Drift detector"
building shop factory in cluster "shop namespace"
floor shop.f "Workloads"
room shop.web service "web" port=3000
room shop.api service "api" port=8080
room shop.db database "postgres" port=5432
building platform factory in cluster "platform namespace"
floor platform.f "Workloads"
room platform.ingress proxy "ingress" port=443
room platform.mon service "monitoring" port=9090
pipeline sync-shop "Sync shop" repo -> [poll] -> [diff] -> [apply] -> shop
step repo "A change is saved in the configuration repository"
step shop "The shop's cluster is updated to match it"
run poll "git fetch origin main"
run diff "kubectl diff -f apps/shop/"
run apply "kubectl apply -f apps/shop/ --prune -l app=shop"
pipeline sync-platform "Sync platform" repo -> [poll] -> [diff] -> [apply] -> platform
step repo "A change is saved in the configuration repository"
step platform "The platform's cluster is updated to match it"
run poll "git fetch origin main"
run diff "kubectl diff -f platform/"
run apply "kubectl apply -f platform/ --prune -l tier=platform"
link repo.main -> argo.sync "git pull" variant=emphasis
link argo.diff -> shop.web "apply diff"
link argo.diff -> platform.ingress "apply diff"