Repository navigation
fix(webhook): allow non-bridge NADs - #444
abonillabeeche wants to merge 1 commit into
Conversation
The NAD mutator and validator treated every non-kube-ovn NAD as a bridge NAD and looked up the cluster network from the bridge name, so ipvlan, macvlan, host-device and SR-IOV NADs were rejected with "the length of bridge name is less than 3". Apply the bridge-specific logic (MTU patch, cluster network labels and route annotations, VLAN overlap, bridge name and cluster network checks) only to Harvester-managed NADs (bridge and kube-ovn). For other CNI types, still validate the route annotation, keep the CNI type immutable, and keep the in-use VM and system network checks on update. Related: harvester/harvester#11990 Signed-off-by: Alejandro Bonilla <abonilla@suse.com>
w13915984028
left a comment
There was a problem hiding this comment.
@abonillabeeche Thanks for the updating, webhook part looks good, did you check the controller code like below:
network-controller-harvester/pkg/controller/manager/nad/controller.go
Lines 162 to 172 in 3f0c981
|
@abonillabeeche As those non-bridge/OVN NADs are not managed by Harvester mutators/controllers, we could consider to add a new label/annotation (e.g. |
|
Thanks for catching this, @w13915984028 — you're right, I'd only checked the webhook path. I traced it through:
Two ways I see to fix the controller side, and I'd like your take before I push either:
Since these NADs were rejected outright before this PR, there's no pre-existing-NAD migration concern either way. Which direction would you prefer? |
|
Need to understand a bit more about the user stories. How are such new NADs created and used? We also need to ensure the UI can correctly filter them, e.g. while create/edit VM network, create/edit VM to refer the VM network (both on Harvester mode and Rancher imported mode). The current solution for Storge-network/rwx-network is to hide those specific NADs. In short: |
|
@w13915984028 thanks, good questions. Why this is needed: Longhorn's V2 data engine is gaining an RDMA (RoCEv2) transport (harvester/harvester#11989). For that to work, the instance-manager pods need an interface directly on the RDMA NIC. A Linux bridge can't provide one: the pod's veth is a software device with no RDMA capability (no RoCE GID), so the storage traffic falls back to TCP. An ipvlan (or macvlan/host-device/SR-IOV) attachment puts the pod on the physical RDMA port, so it can use the NIC's verbs device ( (1) Lifecycle: this isn't a VM network. In the target design (HEP #11480), the storage-network controller creates, updates and deletes the NAD in (2) CNI drivers: nothing is installed day-2. ipvlan, macvlan and host-device are standard CNI reference plugins, already on every Harvester node next to |
|
@abonillabeeche Thanks. It becomes cleaner now. A few additional questions. Is RDMA an replacement of SN? Is whereabouts/IP management still involved ? How does LH know it's RDMA or not. How to check each node is meeting the requirements to have RDMA-ready nics for usage. Without the help of network controller, user needs to manually ensure such things. |
|
@w13915984028 good questions; the full design is in HEP harvester/harvester#11480. Short answers:
You're right that until the |
Problem:
The NAD mutator and validator treat every NAD that is not kube-ovn as a bridge NAD and look up the cluster network from its bridge name. ipvlan, macvlan, host-device and SR-IOV NADs have no
bridgefield, so they are rejected with "the length of bridge name is less than 3" and cannot be created on Harvester at all. This blocks attaching Longhorn instance managers to an RDMA NIC (harvester/harvester#11989), among other uses.Solution:
Add
NetConf.IsHarvesterManagedCNI()(bridge or kube-ovn) and apply the bridge-specific logic only to those NADs:For other CNI types the webhook still validates the route annotation, keeps the CNI type immutable, and keeps the in-use VM/VMI and system network checks on update. Delete is unchanged.
Related Issue:
harvester/harvester#11990
Test plan:
pkg/webhook/nad/non_bridge_test.go): ipvlan, macvlan and host-device NADs pass create; an invalid route annotation is still rejected; a non-bridge NAD can be updated but its CNI type cannot change; a bridge NAD on a missing cluster network is still rejected; the mutator returns no patch for non-bridge NADs. Existing webhook tests pass; golangci-lint v2.12.2 reports 0 issues.