Add multi-NIC support to EgressGateway#4852
Draft
fasaxc wants to merge 1 commit into
Draft
Conversation
Extend EgressGateway to attach the primary interface to a named Calico Network (via the cni.projectcalico.org/networks annotation) and to attach additional secondary NICs through Multus NetworkAttachmentDefinitions. API: - spec.network references a v3.Network and emits cni.projectcalico.org/networks on the pod. Mutually exclusive with the (deprecated) spec.externalNetworks, enforced by a CEL rule on the spec. - spec.additionalInterfaces[] adds secondary NICs (max 9). Each entry names the pod-side interface and selects an attachment mechanism via a union-shaped attachment block. Only the multus arm is wired up now; the comment in InterfaceAttachment reserves space for a native Calico Network arm in a later release. Controller: - Discovers the NetworkAttachmentDefinition CRD at startup; conditionally watches NADs so create/delete events re-trigger reconciliation. - Rejects additionalInterfaces unless both Installation.spec.calicoNetwork.multiInterfaceMode=Multus and the Multus CRD are present. - Treats a missing referenced NAD as a soft warning so NAD-after-EGW creation order doesn't fail reconcile; Multus will surface the per-pod error. Render: - Emits cni.projectcalico.org/networks for spec.network and a k8s.v1.cni.cncf.io/networks JSON array for additionalInterfaces, with deterministic interface names taken from each entry's Name field. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
spec.networktoEgressGatewayso the primary pod interface can attach to a named Calicov3.Network(VRF today, L2 incoming) via thecni.projectcalico.org/networksannotation. Mutually exclusive with the (deprecating)spec.externalNetworks, enforced with a CEL rule.spec.additionalInterfaces[](max 9) to attach secondary NICs through MultusNetworkAttachmentDefinitionreferences. Each entry has a deterministic pod-side interface name plus anattachmentunion (onlymultusfor now; comment block reserves space for a native Calico-Network arm later).additionalInterfacesunlessInstallation.spec.calicoNetwork.multiInterfaceMode=Multusand the NAD CRD is installed. Missing referenced NADs are a soft warning so NAD/EGW creation order doesn't fail reconcile.k8s.v1.cni.cncf.io/networksJSON for the secondary NICs andcni.projectcalico.org/networksfor the primary's Network.Design discussion / decisions captured in: `~/.claude/plans/write-up-the-plan-recursive-octopus.md`
Status
Draft. Open items I'd appreciate review on before un-drafting:
ipPoolswire path. The API surface accepts `ipPools` per `additionalInterfaces[]` entry, but the Multus → Calico IPAM plumbing (passing pool selection through `cni-args` in the Multus JSON) is not yet implemented and not yet verified end-to-end. The field is reserved; first render pass leaves it as a no-op. We should either wire it through `cni-args` or temporarily reject the field in validation, both additive follow-ups.Test plan
🤖 Generated with Claude Code