Skip to content

feat(webhook,cni,gc): automate VPC attachment provisioning - #268

Open
privateip wants to merge 2 commits into
mainfrom
feat/vpc-attachment-webhook
Open

feat(webhook,cni,gc): automate VPC attachment provisioning#268
privateip wants to merge 2 commits into
mainfrom
feat/vpc-attachment-webhook

Conversation

@privateip

@privateip privateip commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Pods requesting a VPC via the galactic.datumapis.com/vpc annotation previously required a NetworkAttachmentDefinition (NAD) to be created manually ahead of time, and there was no automated path from "pod wants a VPC" to a working attachment.

A new galactic-webhook mutating admission webhook now handles the pod-facing side: on Pod CREATE it allocates a free VPCAttachment ID for the named VPC and creates the NAD itself, then patches the pod to attach via it. galactic-cni handles the data-plane side: it now creates the VPCAttachment CR (Spec and Status) at the same point it already creates BGPVRFInstance/BGPAdvertisement, once real IPAM addresses are known — so the CRD's required fields are always populated from actual allocation data, not guessed at admission time.

The GC controller gained matching cleanup passes: orphaned NADs are reclaimed by reference-counting against live pods' networks annotations, and orphaned VPCAttachments are reclaimed via their own Status.PodName.

@privateip
privateip requested a review from a team as a code owner July 30, 2026 18:43
@privateip
privateip requested a review from jacobsmith928 July 30, 2026 18:43
@privateip
privateip marked this pull request as draft July 30, 2026 18:55
privateip and others added 2 commits August 1, 2026 17:06
Pods requesting a VPC via the galactic.datumapis.com/vpc annotation
previously required a NetworkAttachmentDefinition to be created
manually ahead of time. A new galactic-webhook mutating admission
webhook now allocates a VPCAttachment ID and creates the NAD itself
at admission time; galactic-cni creates the VPCAttachment CR (Spec
and Status) at the same point it already creates
BGPVRFInstance/BGPAdvertisement, after real IPAM addresses are
known. The GC controller gained matching orphan-reclaim passes for
NADs (reference-counted via the pod networks annotation) and
VPCAttachments (via Status.PodName).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
TestCNIVPCAttachmentCreation sets K8S_POD_NAMESPACE in CNI_ARGS (needed
by applyVPCAttachment), which unlike the older e2e tests causes
annotateNAD to actually attempt patching a NetworkAttachmentDefinition
instead of short-circuiting on an empty namespace. The e2e Kind cluster
never installed the Multus NAD CRD at all, so the patch failed with
"no matches for k8s.cni.cncf.io/v1".

Install the NAD CRD in scripts/ci.sh (pinned commit, same pattern as
the BGP/VPC CRD installs), and have the test itself create a stub NAD
before running CNI ADD -- standing in for the NAD galactic-webhook
would have already created in production, which galactic-cni's
annotateNAD expects to find.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@privateip
privateip force-pushed the feat/vpc-attachment-webhook branch from 0ab0dd1 to 9fb78c7 Compare August 1, 2026 21:06
@privateip
privateip marked this pull request as ready for review August 1, 2026 21:07
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