Skip to content

Add IPvlan L2 driver for Alibaba Cloud HPN nodes - #206

Draft
Bowser1704 wants to merge 11 commits into
kubernetes-sigs:mainfrom
Bowser1704:feat/alibaba-ipvlan
Draft

Add IPvlan L2 driver for Alibaba Cloud HPN nodes#206
Bowser1704 wants to merge 11 commits into
kubernetes-sigs:mainfrom
Bowser1704:feat/alibaba-ipvlan

Conversation

@Bowser1704

@Bowser1704 Bowser1704 commented May 19, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind feature

Introduce a configurable IPvlan driver that creates IPvlan slave
interfaces in the pod namespace while keeping the parent netdev on
the host. The implementation supports L2/L3/L3S modes, bridge/private/
vepa flags, and three addressing strategies (none, static,
parentIPv6PrefixPodIPv4).

What this PR does / why we need it:

Key changes:

  • Expand IPVlanConfig API with mode, flag, addressing, and route/
    neighbor copy options
  • Add IPvlan validation in the config validation pipeline
  • Implement idempotent attach: detect existing target interface in
    pod netns on retry, tolerate EEXIST on address assignment
  • Use deterministic temp names (parentName_iv) serialized by mutex
  • Support user-configured routes with full Scope/Table/Source fields,
    sorted link-scope-first for gateway reachability
  • Fail-fast on neighbor resolution errors instead of silently
    degrading connectivity
  • Make route/neighbor copy from parent opt-in via config
  • Decouple RDMA discovery from IPvlan config
  • Add Alibaba Cloud provider that auto-detects HPN instances and
    generates the IPvlan preset for bond devices with global IPv6

Which issue(s) this PR is related to:

N/A

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Add IPvlan L2 networking mode for Alibaba Cloud HPN nodes, allowing non-hostNetwork pods to use RoCE RDMA with derived IPv6 addresses. Activated automatically on HPN instances when using `--cloud-provider-hint=ALIBABA`.

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label May 19, 2026
@netlify

netlify Bot commented May 19, 2026

Copy link
Copy Markdown

Deploy Preview for dranet canceled.

Name Link
🔨 Latest commit 6af213c
🔍 Latest deploy log https://app.netlify.com/projects/dranet/deploys/6a71a2d8abf0400008822689

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Welcome @Bowser1704!

It looks like this is your first PR to kubernetes-sigs/dranet 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/dranet has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 19, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @Bowser1704. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label May 19, 2026
@gauravkghildiyal

Copy link
Copy Markdown
Member

Happy to have you contributing @Bowser1704

This is very interesting as we're also working on a somewhat generic approach towards having IPVLAN as part of #63. @ngcxy is working on a POC at the moment and we can align to make sure it covers your use case too (from the looks of it, I think it would).

@gauravkghildiyal

Copy link
Copy Markdown
Member

/assign
/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 19, 2026
@Bowser1704
Bowser1704 force-pushed the feat/alibaba-ipvlan branch from f529806 to fbb1e43 Compare May 19, 2026 08:22
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Bowser1704
Once this PR has been reviewed and has the lgtm label, please ask for approval from gauravkghildiyal. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@Bowser1704
Bowser1704 force-pushed the feat/alibaba-ipvlan branch 6 times, most recently from bb0eeb9 to e351900 Compare May 20, 2026 07:22
@Bowser1704

Copy link
Copy Markdown
Contributor Author

Thanks @gauravkghildiyal!

I've actually implemented a more generic IPvlan driver in this PR — it's not tightly coupled to Alibaba Cloud. The cloud provider hint just signals when to enable it.

Would love to align with @ngcxy's POC from #63 — if we can converge on the IPvlan approach, that would let Alibaba Cloud users onboard to dranet right away. Happy to iterate on the design together.

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 20, 2026
@Bowser1704
Bowser1704 force-pushed the feat/alibaba-ipvlan branch 2 times, most recently from bb28b7f to 48383e4 Compare May 20, 2026 13:09
@gauravkghildiyal

Copy link
Copy Markdown
Member

Thanks for the context.

We'd very much like to get things work with Alibaba Cloud. But the approach that I think we should take with IPVLAN ( or MACVLAN and others) is also having the flexibility to share the parent interface across multiple pods and doing this in a more DRA native way (using things like DRA Consumable Capacity and others)

This is something we are actively working towards and I'd highly encourage and request we wait for the work being done for #63. This is slightly opinionated, but it'd be awesome to get the IPVLAN support right from the get-go -- a modeling that allows for future extension like sharing between multiple pods. We'd appreciate your patience with this and would be happy to collaborate together so that all requirements are met. This PR is already a great demonstration of what exactly are the things we should have a solution for (in addition to things like device sharing).

@gauravkghildiyal gauravkghildiyal added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 3, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

PR needs rebase.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jun 11, 2026
@Bowser1704
Bowser1704 marked this pull request as draft July 2, 2026 02:21
@kubernetes-prow kubernetes-prow Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 2, 2026
ngcxy and others added 11 commits July 28, 2026 09:03
* Add SubInterfaceConfig, IPVlanConfig, and IPRangeConfig definitions to the NetworkConfig schema.
* Support a list of IP ranges per subinterface, each expressed either as a CIDR block or as an explicit start/end address pair.
* Define default configuration parameters and merging rules for subinterfaces, with user-provided values taking precedence and duplicates removed.
* Implement validation logic for subinterface properties (IP ranges, CIDR formatting, start/end ordering, and IPVLAN modes/flags) along with unit tests.
* Implement LocalIPAM to allocate addresses from the configured IP ranges (CIDR or explicit start/end), returning one address per IP family chosen at random within the range bounds, while tracking the set of in-use addresses to prevent conflicts.
* Roll back partial allocations on error, and add Release to return an address to the pool.
* Add PodConfigStore.GetAllocatedIPs to collect the addresses recorded in the stored device configs, and seed LocalIPAM with them at NetworkDriver startup so previously assigned IPs are not reissued.
* Add unit tests verifying IP allocation boundaries, randomized selection, conflict prevention, and lifecycle cleanups.
…laim hooks

* Extend the prepareResourceClaim hook to process subinterface specs:
  * Assign interface name with the network type prefix.
  * Use LocalIPAM to automatically allocate IPs from the configured ranges when no static address is specified.
  * Implement source-based routing to generate custom-table routes and rules for the subinterface, when no custom routes and rules are configured.
* Release allocated subinterface IPs in unprepareResourceClaim so addresses are returned to the pool on claim teardown.
* Add unit tests validating IP allocation and source-based routing configuration for routes and rules.
* Plumb subinterface setup (createSubinterfaceInNS) and cleanup (nsDeleteSubinterface) into NRI runPodSandbox and stopPodSandbox lifecycle hooks.
  * Refactor common network configuration tasks (VRF, routes, neighbors, and rules) into a shared configureNetdevInNS helper.
* Implement netlink utilities nsCreateSubinterface and nsDeleteSubinterface with support for IPVLAN creation (L2 mode, bridge flag), setting up link state, and configuring IPs.
* Add integration tests (TestSubinterface_IPVlan) to verify end-to-end IPVLAN creation, MAC/MTU inheritance, IP assignment, and cleanup inside test network namespaces.
* Implement GetDeviceConfig to lookup GCE VM network interface details matching the device MAC address.
* Add a shared cloudutil.IPRangeFromCIDR helper that derives explicit [start, end] allocation bounds from a CIDR, always excluding the network and broadcast addresses and supporting additional reserved counts at each end.
* For IPv4, derive the range from the primary GCE Alias IP Range.
* For IPv6, compute the range by appending a 16-bit marker (0xC0DE) to the parent interface's base prefix.
* Add unit tests for the range helper, GCE device configuration lookups, and IPv6 prefix derivation.
Our address-inheritance fallback ran after PR241's own subinterface
block, which already does `continue` (skipping the rest of the device
loop) when Addresses is empty and IPRanges isn't set -- exactly our
bond case. Move the inherit-from-parent fallback before the
IPRanges/IPAM branch so it actually runs.

Also clean up a duplicated block in subinterfaces_test.go left over
from a bad edit during the merge.
…st addr

Switch the lingjun bond support to use PR241's native IPRanges/LocalIPAM
path instead of a custom address-inherit + strip/restore mechanism.

eflo reserves a fixed 16-address block (host bits
0000:000f:0000:0c00-0c0f, a /124) inside every RDMA NIC's own /64 for
that NIC's pod-facing subinterface -- disjoint from whatever address
the NIC already carries on the host. Deriving this range and handing
it to SubInterface.IPRanges means the pod's subinterface address is
never also live on the host, so there is nothing to strip or restore.
This mirrors exactly how the GCE provider derives its own IPv6
subinterface range (appending a fixed marker to the node's /64), just
with eflo's offset instead of GCE's 0xC0DE.

pkg/driver/{subinterfaces,nri_hooks,dra_hooks}.go are reverted to
pure PR241 -- no downstream changes needed there anymore.
@Bowser1704
Bowser1704 force-pushed the feat/alibaba-ipvlan branch from 48383e4 to 6af213c Compare August 4, 2026 08:29
@kubernetes-prow kubernetes-prow Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 4, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Bowser1704
Once this PR has been reviewed and has the lgtm label, please ask for approval from gauravkghildiyal. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/feature Categorizes issue or PR as related to a new feature. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants