feat(cni): add dual-stack config fields and validation#258
Open
privateip wants to merge 1 commit into
Open
Conversation
PR #740 introduces a hierarchical, dual-stack tenant addressing model (IPv6 region /64 and optional IPv4 site /20 pools carried via the NAD). This adds the PluginConf fields (IPv6Subnet, IPv4Subnet, AddressFamilies) and parseConf validation needed to accept that config, ahead of wiring the fields into allocateIPAM in a later change. Validation intentionally checks CIDR shape (IPv6 <= /96, IPv4 <= /32 — matching the existing pool allocators' actual constraints, not a hardcoded /64 or /20) without yet making ipv6_subnet required: nothing downstream reads these fields until allocateIPAM is rewritten, so enforcing "required" now would reject every existing config. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
privateip
requested review from
0xmc,
bmertens-datum,
scotwells and
slindseysr
and removed request for
bmertens-datum
July 26, 2026 16:41
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.
Summary
PluginConffields (IPv6Subnet,IPv4Subnet,AddressFamilies) to accept the region/64/site/20pool CIDRs carried by the NAD under PR feat: Datum Cloud IPv6 addressing plan enhancements#740's dual-stack tenant addressing model.parseConfvalidation for the new fields: format/CIDR checks (IPv6 prefix ≤ /96, IPv4 prefix ≤ /32 — matching what the existing pool allocators already enforce, not a hardcoded /64 or /20), andaddress_familiesdefaulting to["ipv6"]with unknown-value rejection.ipv6_subnet/ipv4_subnetare intentionally left optional for now — nothing downstream reads them yet (allocateIPAMisn't rewritten until a follow-up change), so making them required today would reject every existing config.Test plan
go build ./...go vet ./...go test ./... -race -count=1(full module)golangci-lint run ./...TestParseConfsubtests covering valid/invalid CIDRs, family mismatches, prefix-length boundaries, andaddress_familiesdefaulting/validation🤖 Generated with Claude Code