Skip to content

Add verified Unix-socket unbounded-ipam CNI plugin - #942

Merged
Patrick W. Healy (phealy) merged 5 commits into
mainfrom
phealy/ipam-plugin
Oct 21, 2026
Merged

Patrick W. Healy (phealy) merged 5 commits into
mainfrom
phealy/ipam-plugin

Conversation

@phealy

@phealy Patrick W. Healy (phealy) commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add a Go CNI IPAM binary embedding upstream host-local allocation and disk storage.
  • Require a bounded, versioned protobuf exchange over a local Unix socket for ADD; retain offline DEL, CHECK, and VERSION.
  • Reject caller-supplied allocation pools, including case-folded runtime overrides and duplicate top-level IPAM aliases, and preserve network-scoped reservation compatibility.
  • Include build wiring, dependency notices, protocol/lifecycle tests, and reboot/reassignment subprocess coverage.

Scope

First layer of the IPAM stack. Agent integration and deployment are in #943. This layer does not switch the active CNI configuration.

Review fixes

  • 0b56dcb57: reject noncanonical case-folded top-level IPAM keys before agent communication or reservation writes. Regression cases include both ipam and an alias carrying caller-supplied subnet and storage settings.
  • a81637dae: hold a persistent per-socket ownership lock across stale-socket recovery and shutdown, with concurrent recovery and restart coverage.
  • 6c2b16f92: reject null requested-IP entries using the upstream decoder schema, with valid/null CNI subprocess cases for runtime and args inputs.

Validation

Focused package tests passed during pre-publication review. Combined implementation was exercised on managed Unbounded CNI and delegated Cilium AKS clusters, including concurrent allocation, offline cleanup, delayed assignment, and API/controller outages.

For the review fixes, reproduced the alias bypass, null-IP panic, and missing socket ownership exclusion before the changes. Full IPAM package race tests, repeated concurrent socket recovery, and repository formatting/lint checks passed afterward.

Limitations

GC and STATUS are unsupported. ADD intentionally fails without an eligible local agent; agent implementation follows in #943.

@phealy
Patrick W. Healy (phealy) requested a review from a team October 16, 2026 23:07
@phealy
Patrick W. Healy (phealy) added this pull request to stack #944 October 16, 2026 23:07
@phealy Patrick W. Healy (phealy) changed the title phealy/ipam plugin Add verified Unix-socket unbounded-ipam CNI plugin Oct 16, 2026
Embed upstream host-local allocation and storage behind a bounded protobuf exchange. Require verified agent ranges for ADD while keeping DEL, CHECK, and VERSION independent of the agent. Cover reboot reassignment, protocol boundaries, socket lifecycle, and standard CNI result versions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8bb0fa01-6bf2-4bcd-9143-5c3f634e282f
Include the reviewed range-override fix in the standalone plugin layer before agent integration.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 8bb0fa01-6bf2-4bcd-9143-5c3f634e282f

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Case-folded IPAM aliases bypass verified-range validation and can redirect reservation storage.

1 open issue
1 file not reviewed
  • internal/net/ipam/proto/ipam.pb.go: Generated file
What changed in this PR

Adds a host-local-backed CNI IPAM plugin requiring agent-provided allocation ranges over a Unix socket. Agent integration follows in #943; active CNI configuration remains unchanged.

Changes:

  • Adds verified ADD allocation and offline DEL/CHECK support.
  • Introduces bounded, versioned protobuf communication and lifecycle tests.
  • Adds build targets, dependencies, and notices.
File Description
NOTICE Adds CNI dependency notices.
Makefile Adds plugin build targets.
internal/​net/​ipam/​transport.go Implements Unix-socket protocol and lifecycle.
internal/​net/​ipam/​subprocess_test.go Tests CNI commands and reassignment scenarios.
internal/​net/​ipam/​proto/​ipam.proto Defines configuration protocol.
internal/​net/​ipam/​proto/​ipam.pb.go Adds generated protobuf bindings.
internal/​net/​ipam/​proto/​generate.go Adds protobuf generation command.
internal/​net/​ipam/​plugin.go Implements allocation, validation, and cleanup.
internal/​net/​ipam/​ipam_test.go Tests allocation, transport, and cleanup behavior.
go.sum Updates dependency checksums.
go.mod Adds CNI dependencies.
cmd/​unbounded-ipam/​main.go Adds plugin entry point.

Review effort: Balanced

Comment thread internal/net/ipam/plugin.go
Reject ambiguous top-level IPAM keys before contacting the agent or creating reservations. Cover duplicate aliases with verified-range and reservation-directory overrides.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6b70e00f-eec0-4611-97c6-1b6200092b62

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unresolved correctness issues and the safety-critical allocation lifecycle require fixes and final human verification.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Validate requested IP lists to prevent nil-pointer panic

internal/​net/​ipam/​plugin.go:125

With a ready agent, "runtimeConfig":{"ips":[null]} or "args":{"cni":{"ips":[null]}} reaches this loader. Host-local v1.9.1 decodes these entries as *ip.IP and calls ToIP() without a nil check, causing ADD to panic instead of returning a structured CNI error. Validate both requested-IP lists before invoking the loader, using the same decoder so case-folded field names are covered, and add subprocess regressions for both forms.

1 resolved since last review
1 file not reviewed
  • internal/net/ipam/proto/ipam.pb.go: Generated file

Review effort: Balanced

Comment thread internal/net/ipam/transport.go
Hold a persistent per-socket flock across stale-socket inspection, listener creation, and identity-safe cleanup. Make shutdown idempotent and cover contention, concurrent recovery, restart, and unsafe lock paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6b70e00f-eec0-4611-97c6-1b6200092b62
Decode requested-IP fields with the upstream allocator schema and reject null entries before its unchecked dereference. Cover valid and null runtimeConfig and args.cni requests, including case-folded names, through the CNI subprocess.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6b70e00f-eec0-4611-97c6-1b6200092b62

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Privileged address allocation and cross-process socket recovery warrant final human validation despite no confirmed blocking findings.

No open issues 🎉

1 resolved since last review
1 file not reviewed
  • internal/net/ipam/proto/ipam.pb.go: Generated file

Review effort: Balanced

@phealy
Patrick W. Healy (phealy) added this pull request to the merge queue Oct 21, 2026
Merged via the queue into main with commit ed97906 Oct 21, 2026
58 of 59 checks passed
@phealy
Patrick W. Healy (phealy) deleted the phealy/ipam-plugin branch October 21, 2026 18:48
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.

3 participants