feat(webhook,cni,gc): automate VPC attachment provisioning - #268
Open
privateip wants to merge 2 commits into
Open
feat(webhook,cni,gc): automate VPC attachment provisioning#268privateip wants to merge 2 commits into
privateip wants to merge 2 commits into
Conversation
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
force-pushed
the
feat/vpc-attachment-webhook
branch
from
August 1, 2026 21:06
0ab0dd1 to
9fb78c7
Compare
privateip
marked this pull request as ready for review
August 1, 2026 21:07
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
Pods requesting a VPC via the
galactic.datumapis.com/vpcannotation previously required aNetworkAttachmentDefinition(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-webhookmutating 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-cnihandles the data-plane side: it now creates theVPCAttachmentCR (Spec and Status) at the same point it already createsBGPVRFInstance/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.