Repository navigation
feat(network): deterministic CIDR allocator (ADR 0001 step 1, ground#10) - #24
Merged
Merged
Conversation
Build step 1 of ground's network foundation (docs/adr/0001-network-foundation.md): a pure function from the supernet + ordered tier list to a hub /16 (index 0) plus one /16 per spoke tier, each split into per-AZ /20 subnets. - Allocation is a stable function of (supernet, tier index) — no time, no randomness, no AWS. Re-running ground deploy never renumbers an existing spoke (renumbering is destructive); guarded by TestAllocate_AppendTierDoesNotRenumber. - net/netip-based subnet carving (nthSubnet); /16 VPCs, /20 per-AZ subnets (16 AZs max per /16). - validates supernet size (holds 1 hub + N spokes), AZ count (1..16), rejects empty/duplicate tier names, malformed/oversized supernet. - unit-tested like the SCPs (pure, no live calls): exact carve, determinism, no-renumber, small /14 supernet, hub-only, all error paths. Refs: #11, #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Build step 1 of ground's network foundation (ground
docs/adr/0001-network-foundation.md). The pure, AWS-free core the rest of the stack builds on.What
Allocate(supernetCIDR, spokeTiers, azCount)→ aPlan: a hub /16 (index 0) plus one /16 per spoke tier in the given order, each split into per-AZ /20 subnets.The property that matters
Allocation is a stable function of
(supernet, tier index)— no time, no randomness, no AWS. Re-runningground deploymust never renumber an existing spoke (CIDR renumbering is destructive).TestAllocate_AppendTierDoesNotRenumberappends a tier and asserts every existing spoke keeps its block.Details
net/netip-based subnet carving (nthSubnet: e.g.10.0.0.0/8index 3 →10.3.0.0/16)./16or larger and hold1 hub + len(tiers)/16s;azCount1–16 (/20s per /16); no empty/duplicate tier names.10.0.0.0/16, spokes10.1–10.4/16, hub subnets10.0.0.0/20,10.0.16.0/20,10.0.32.0/20), determinism, no-renumber, a tight/14supernet, hub-only, and all seven error paths.Next steps per ADR 0001: single-VPC template → hub-and-spoke+TGW → compute-to-data egress (ground#10 routing). Refs: #11, #10.