Skip to content

fix(iptables-eip): look up subnet directly by name instead of resolving through NAD#6287

Merged
oilbeater merged 1 commit intokubeovn:masterfrom
starbops:fix-6286
Feb 10, 2026
Merged

fix(iptables-eip): look up subnet directly by name instead of resolving through NAD#6287
oilbeater merged 1 commit intokubeovn:masterfrom
starbops:fix-6286

Conversation

@starbops
Copy link
Copy Markdown
Contributor

@starbops starbops commented Feb 9, 2026

Pull Request

What type of this PR

Examples of user facing changes:

  • Bug fixes

Which issue(s) this PR fixes

Fixes #6286

…ng through NAD

Signed-off-by: Zespre Chang <zespre.chang@suse.com>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @starbops, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug in the iptables EIP controller by refining the subnet lookup mechanism. Previously, the controller would list all available subnets and then attempt to resolve the correct one through a NetworkAttachmentDefinition. This change introduces a more direct approach, allowing the controller to fetch the required subnet directly by its name, thereby improving efficiency and reducing potential points of failure in subnet identification.

Highlights

  • Subnet Lookup Optimization: The method for looking up subnets in handleAddIptablesEip and handleUpdateIptablesEip functions has been optimized. Instead of listing all subnets and then resolving through a NetworkAttachmentDefinition (NAD), the system now directly retrieves the subnet by its name.
  • Dependency Reduction: The dependency on resolving subnets via NetworkAttachmentDefinition (NAD) for iptables EIP operations has been removed, simplifying the code path and making subnet identification more direct.
Changelog
  • pkg/controller/vpc_nat_gw_eip.go
    • Refactored subnet retrieval logic in handleAddIptablesEip and handleUpdateIptablesEip to use direct subnetsLister.Get by subnet name.
    • Removed the subnetsLister.List call and the subsequent findSubnetByNetworkAttachmentDefinition function call, streamlining the subnet resolution process.
Activity
  • No human activity (comments, reviews, etc.) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@starbops starbops marked this pull request as ready for review February 9, 2026 13:09
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 9, 2026
@starbops
Copy link
Copy Markdown
Contributor Author

starbops commented Feb 9, 2026

I didn't thoroughly check whether this has already been handled elsewhere. If you find that this PR is a duplicate or irrelevant, feel free to close it. Appreciate your time.

cc @oilbeater

@dosubot dosubot bot added the bug Something isn't working label Feb 9, 2026
@oilbeater
Copy link
Copy Markdown
Collaborator

@starbops You're correct. I will backport it to release-1.15.

@oilbeater oilbeater merged commit 524b6c0 into kubeovn:master Feb 10, 2026
74 of 77 checks passed
oilbeater pushed a commit that referenced this pull request Feb 10, 2026
…ng through NAD (#6287)

Signed-off-by: Zespre Chang <zespre.chang@suse.com>
(cherry picked from commit 524b6c0)
@starbops
Copy link
Copy Markdown
Contributor Author

@oilbeater Thank you so much.

@rrajendran17
Copy link
Copy Markdown

@oilbeater I believe this commit is not backported to v1.15.0 yet. Can you please let us know once its backported ?
I was testing with kubeovn v1.15.0 version bumped on Harvester and was still seeing these errors.

I0219 00:02:32.512344       7 vpc_nat_gw_eip.go:81] handle add iptables eip my-eip
E0219 00:02:32.512396       7 subnet.go:2823] failed to get net-attach-def kube-system/subnetexternal: networkattachmentdefinition.k8s.cni.cncf.io "subnetexternal" not found

So kubeovn webhook expects a subnet and does look up in subnet cache and controller looks up for the nad.

externalNetwork := util.GetExternalNetwork(eip.Spec.ExternalSubnet)

I had to bypass the webhook check temporarily to verify the vpc nat gw functionality in v1.15.0.

When I originally verified v1.15.0 with install script from kubeovn, it did not had the kubeovn webhook running, so I missed this error so went with the workaround of using a nad name in externalSubnet field of EIP.
Thanks @starbops for the fix.

@oilbeater
Copy link
Copy Markdown
Collaborator

@rrajendran17 v1.15.4 has included this commit.

zbb88888 pushed a commit to qiniu/kube-ovn that referenced this pull request Apr 7, 2026
…ng through NAD (kubeovn#6287)

Signed-off-by: Zespre Chang <zespre.chang@suse.com>
(cherry picked from commit 524b6c0)
(cherry picked from commit 26dab97)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working need backport size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] IptablesEIP controller resolves ExternalSubnet through NAD lookup instead of direct Subnet lookup

3 participants