Skip to content

feat(cni): add dual-stack config fields and validation#258

Open
privateip wants to merge 1 commit into
mainfrom
feat/cni-dual-stack-config-fields
Open

feat(cni): add dual-stack config fields and validation#258
privateip wants to merge 1 commit into
mainfrom
feat/cni-dual-stack-config-fields

Conversation

@privateip

Copy link
Copy Markdown
Contributor

Summary

  • Adds three new PluginConf fields (IPv6Subnet, IPv4Subnet, AddressFamilies) to accept the region /64/site /20 pool CIDRs carried by the NAD under PR feat: Datum Cloud IPv6 addressing plan enhancements#740's dual-stack tenant addressing model.
  • Adds parseConf validation 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), and address_families defaulting to ["ipv6"] with unknown-value rejection.
  • ipv6_subnet/ipv4_subnet are intentionally left optional for now — nothing downstream reads them yet (allocateIPAM isn'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 ./...
  • 11 new TestParseConf subtests covering valid/invalid CIDRs, family mismatches, prefix-length boundaries, and address_families defaulting/validation

🤖 Generated with Claude Code

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
privateip requested a review from a team as a code owner July 26, 2026 16:41
@privateip
privateip requested review from 0xmc, bmertens-datum, scotwells and slindseysr and removed request for bmertens-datum July 26, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant