0003 Cluster topology single source of truth
Context
Cluster IPs, CIDRs, BGP ASNs, and API endpoints were duplicated across Flux manifests, Nix modules, and Terraform roots. Renumbering anything meant a scavenger hunt, and the copies drifted.
Decision
Per-cluster
cluster-topologyConfigMaps atclusters/<site>/config/cluster-topology.jsonare the single source of truth for network facts. Each JSON file is the Flux ConfigMap (JSON is valid YAML, applied as-is) — no generator.Consumers read it, never copy it:
Flux substitutes
${VAR}viapostBuild.substituteFromNix reads it with
builtins.fromJSON(nix/services/k8s/networks.nix)Terraform roots read it with
jsondecode(file(...)).datavia atopology.tfeach
Consequences
Renumbering is one file per cluster; every layer picks it up on its normal apply path.
datamust stay flatstring→string(a FluxsubstituteFromrequirement), so lists and numbers are encoded as strings (CLUSTER_DNScomma-separated,API_SERVER_PORTparsed to int in Nix).Hardcoding a network fact anywhere else is now a review-blocking bug.
Not yet migrated: the FRR
*.confBGP files andterraform/network/tailscale/policy.hujsonstill hold literals.
Links
Linked references 8
Architecture/Networking, ADR/0003 Cluster topology single source of truth, terraform/network/unifi/folly/README.md
ADR/0003 Cluster topology single source of truth — network facts live in per-cluster JSON ConfigMaps
config/ — cluster secrets and the cluster-topology ConfigMap (ADR/0003 Cluster topology single source of truth)
Roots that need network facts read the SSOT: jsondecode(file(".../cluster-topology.json")).data via a topology.tf per root (ADR/0003 Cluster topology single source of truth).
Network facts come from the cluster-topology single source of truth — see ADR/0003 Cluster topology single source of truth.
Network facts should come from the cluster topology single source of truth where a root already has a topology.tf; see ADR/0003 Cluster topology single source of truth.
All cluster network facts — node/API IPs, pod CIDRs, BGP ASNs and peer addresses, DNS — live in per-cluster cluster-topology ConfigMaps at clusters/<site>/config/cluster-topology.json. Flux substitutes them, Nix parses them, Terraform jsondecodes them. Do not hardcode network facts anywhere else. Details in ADR/0003 Cluster topology single source of truth.
Single source of truth for network facts. Cluster IPs, CIDRs, ASNs, and API endpoints live in per-cluster cluster-topology ConfigMaps consumed by Flux, Nix, and Terraform alike — ADR/0003 Cluster topology single source of truth.