Skip to content

P5 privileged networking and full data plane#72

Merged
chimerakang merged 3 commits into
mainfrom
feat/p5-privileged-networking
Jun 19, 2026
Merged

P5 privileged networking and full data plane#72
chimerakang merged 3 commits into
mainfrom
feat/p5-privileged-networking

Conversation

@chimerakang

Copy link
Copy Markdown
Owner

Summary

  • add the privileged macvz-netd helper flow and ClusterIP service routing for the P5 data plane
  • harden helper policy for pf/routing/process operations, require config-backed policy by default, and support policy reload for mesh peer changes
  • fix follow-up edge cases from the two-node run: vmnet default-route hijack, post-data-plane API reachability, wireguard-go teardown, and kubelet port bind retry

Verification

  • go test ./...
  • go vet ./...
  • make build
  • make netd

chimerakang and others added 3 commits June 19, 2026 21:19
…#37)

Deliver the cross-host data plane so macvz-kubelet runs as the operator's user
(required because apple/container refuses to run as root) while privileged
network ops execute via a root helper.

Privileged network helper (#38):
- pkg/network/privhelper: root daemon over a unix socket running a fixed command
  allowlist (pfctl/sysctl/route/ifconfig/wg/wireguard-go) for the user-run
  kubelet; protocol versioning, per-request arg Policy (#41), launchd install.
- cmd/macvz-netd: the helper daemon (serve/install/status).
- podnet.WithHelperSocket / wireguard.WithHelperSocket route privileged commands
  through the helper; config.privilegedHelperSocket wires it in.

ClusterIP service routing (#37):
- pkg/network/podnet: pf rdr rules mapping ClusterIP:port -> local micro-VM (VMIP)
  or remote Pod IP (via mesh), round-robin pool, in the macvz/pods anchor.
- pkg/network/svcroute: Service+EndpointSlice controller computing those rules.
- Cluster DNS injection (node.clusterDNS/clusterDomain -> container --dns) so
  micro-VMs resolve Service names.

Startup ordering: bring up mesh + podNetwork BEFORE node registration so the API
connection forms over final routing.

Validated on two physical Macs through the helper: WireGuard mesh + handshake,
podNetwork, ClusterIP routing, and e2e node-reg/pod-lifecycle/logs/exec/
port-forward all pass. See docs/MULTI_NODE_TEST_REPORT_2026-06-19.md for the run
and the remaining env-specific remote-node API flap (not a MacVz bug).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Root cause of the macvz-b NotReady flap AND a real production-safety bug:
starting an apple/container micro-VM installs a `default -> <vmnet bridge>` route
that steals the host's IPv4 default route, breaking ALL host outbound traffic
(observed taking down an unrelated frpc tunnel + GitHub runner on the test host,
and severing the remote kubelet's API connection so the node flapped NotReady).

- podnet.Router removes the vmnet default route (`route -q -n delete -inet
  default -interface <vmnet>`) at Start and on every Attach, tolerating "not in
  table"/"not found"; Pod reachability uses explicit Pod/mesh routes + pf, never
  a host default route.
- privhelper.Policy.validateRoute narrowly permits exactly this: delete (never
  add) the IPv4 default route, and only on the managed vmnet interface.
- Report + docs upgrade this to a CRITICAL finding: do not run MacVz on a host
  with other networked services until this lands.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chimerakang chimerakang force-pushed the feat/p5-privileged-networking branch from 1a659b7 to c064e30 Compare June 19, 2026 14:00
@chimerakang chimerakang merged commit 85a8f73 into main Jun 19, 2026
2 checks passed
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