Skip to content

controller: set always_learn_from_arp_request to false only when LR is not connected to external network#5419

Merged
zhangzujian merged 1 commit intokubeovn:masterfrom
zhangzujian:fix-mac-aging
Jul 3, 2025
Merged

controller: set always_learn_from_arp_request to false only when LR is not connected to external network#5419
zhangzujian merged 1 commit intokubeovn:masterfrom
zhangzujian:fix-mac-aging

Conversation

@zhangzujian
Copy link
Copy Markdown
Member

@zhangzujian zhangzujian commented Jul 2, 2025

Pull Request

What type of this PR

Examples of user facing changes:

  • Features
  • Bug fixes
  • Docs
  • Tests

Which issue(s) this PR fixes

Fixes #(issue-number)

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jul 2, 2025
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @zhangzujian, 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 by refining how OVN logical router options are configured for VPCs. Specifically, it prevents the mac_binding_age_threshold from being set on VPCs that are connected to an external network, ensuring more appropriate network behavior based on the VPC's connectivity type.

Highlights

  • Conditional MAC Binding Age: The mac_binding_age_threshold option for OVN logical routers is now conditionally applied. It will only be set when a VPC is not configured to be connected to an external network.
  • Function Signature Update: The createVpcRouter function in pkg/controller/vpc.go has been updated to accept an enableExternal boolean parameter, which dictates whether the MAC binding age threshold should be applied.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the VPC controller to conditionally set OVN logical router options. Specifically, it avoids setting mac_binding_age_threshold and other related options when a VPC is connected to an external network. The changes are logical and correct. I've provided one suggestion to improve maintainability by extracting the hardcoded router options.

@coveralls
Copy link
Copy Markdown

coveralls commented Jul 2, 2025

Pull Request Test Coverage Report for Build 16044609411

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 14 (0.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.001%) to 21.558%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller/vpc.go 0 14 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/controller/vpc.go 1 0.0%
Totals Coverage Status
Change from base Build 16044085466: 0.001%
Covered Lines: 10512
Relevant Lines: 48761

💛 - Coveralls

@zhangzujian zhangzujian changed the title controller: do not set mac binding age when the vpc is connected to e… controller: set always_learn_from_arp_request to false only when LR is not connected to external network Jul 2, 2025
@zhangzujian
Copy link
Copy Markdown
Member Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request effectively addresses the objective of conditionally setting always_learn_from_arp_request based on whether the logical router is connected to an external network. The refactoring of createVpcRouter to accept the enableExternal parameter and the addition of the maps.Equal check before updating the logical router options are positive changes that improve both correctness and efficiency.

Comment on lines +1257 to +1263
if !maps.Equal(vpcRouter.Options, lrOptions) {
vpcRouter.Options = lrOptions
if err = c.OVNNbClient.UpdateLogicalRouter(vpcRouter, &vpcRouter.Options); err != nil {
klog.Errorf("failed to update options of logical router %s: %v", lr, err)
return err
}
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The introduction of the if !maps.Equal(vpcRouter.Options, lrOptions) check is a valuable improvement. It ensures that the OVN logical router is only updated when its options have genuinely changed, preventing redundant OVSDB transactions. This can lead to better performance and reduced load on the OVN control plane.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 3, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jul 3, 2025
…s not connected to external network

Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
@zhangzujian zhangzujian force-pushed the fix-mac-aging branch 2 times, most recently from f3972e0 to df8c5f7 Compare July 3, 2025 07:45
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jul 3, 2025
@zhangzujian zhangzujian merged commit 266d303 into kubeovn:master Jul 3, 2025
14 checks passed
@zhangzujian zhangzujian deleted the fix-mac-aging branch July 3, 2025 07:47
zhangzujian added a commit that referenced this pull request Jul 3, 2025
…s not connected to external network (#5419)

Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
zhangzujian added a commit to zhangzujian/kube-ovn that referenced this pull request Jul 3, 2025
…s not connected to external network (kubeovn#5419)

Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
zhangzujian added a commit that referenced this pull request Jul 3, 2025
…s not connected to external network (#5419)

Signed-off-by: zhangzujian <zhangzujian.7@gmail.com>
@zbb88888
Copy link
Copy Markdown
Collaborator

zbb88888 commented Jul 3, 2025

@zhangzujian 大佬,U2O 场景下会有同样的问题么?

@patriziobassi
Copy link
Copy Markdown

@zhangzujian this will not fix the case where we have a underlay network attached to the default vpc (for u2o) as that network will no be marked as external (no need for nat gw), so bug #5318 will not be fixed

@zhangzujian
Copy link
Copy Markdown
Member Author

@patriziobassi This patch is NOT a fix for the problem you metioned above.

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

Labels

lgtm This PR has been approved by a maintainer need backport size:S This PR changes 10-29 lines, ignoring generated files. vpc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] OVN EIP, FIP, SNAT mode. Packet loss and asymmetric return traffic on Hetzner vSwitch

5 participants