Skip to content

fix(loadbalancers): ip_port_mapping is overwritten by new vips#6302

Merged
oilbeater merged 1 commit intokubeovn:masterfrom
SkalaNetworks:portmapping
Feb 24, 2026
Merged

fix(loadbalancers): ip_port_mapping is overwritten by new vips#6302
oilbeater merged 1 commit intokubeovn:masterfrom
SkalaNetworks:portmapping

Conversation

@SkalaNetworks
Copy link
Copy Markdown
Member

Pull Request

What type of this PR

  • Bug fixes

There's a problem with SwitchLBRules right now:

  • The ip_port_mapping is overwritten for any new SLR
  • That means new SLRs will break previous ones

I seem to be the one that introduced this regression a few month back. This fixes it by adding ip_port_mappings one after another.

The GC will take care of cleaning up ip_port_mappings if some become stale.

Signed-off-by: SkalaNetworks <contact@skala.network>
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @SkalaNetworks, 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 resolves a critical bug in the OVN load balancer management where the IP port mappings were inadvertently being reset or overwritten when new load balancer rules were applied. The fix ensures that mappings are added cumulatively, preserving existing configurations and preventing service disruptions. This change improves the stability and reliability of load balancer operations within the system.

Highlights

  • Bug Fix: IP Port Mapping Overwrite: Addressed a regression where ip_port_mapping in OVN load balancers was being overwritten by new SwitchLBRules (SLRs), causing previous SLRs to break.
  • Load Balancer Update Logic: Modified the LoadBalancerUpdateIPPortMapping function to incrementally add ip_port_mappings rather than attempting to delete and then add, which was causing the overwrite issue. Existing mappings will now persist.
  • Garbage Collection Reliance: Confirmed that the garbage collector will handle the cleanup of any stale ip_port_mappings that are no longer needed, removing the necessity for manual deletion logic within this function.
Changelog
  • pkg/ovs/ovn-nb-load_balancer.go
    • Removed logic that incorrectly deleted ip_port_mapping entries, which led to overwriting existing mappings.
    • Ensured that new ip_port_mappings are added without affecting previously configured ones.
Activity
  • No specific activity (comments, reviews) 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.

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 correctly fixes a bug where ip_port_mapping entries for existing services were being overwritten when a new service was added or an existing one was updated. The previous implementation incorrectly tried to clean up stale mappings, but ended up removing valid mappings for other services. By removing the faulty deletion logic and relying only on the insert operation, the change ensures that mappings are added cumulatively. As noted in the description, a separate garbage collection process will handle the cleanup of stale entries, making this change safe and effective. The fix is clear and addresses the regression.

@SkalaNetworks SkalaNetworks marked this pull request as ready for review February 12, 2026 14:20
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels Feb 12, 2026
@SkalaNetworks
Copy link
Copy Markdown
Member Author

@oilbeater this bug is breaking SLRs in custom VPCs, the fix seems to work on my clusters.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 24, 2026
@oilbeater oilbeater merged commit 830362a into kubeovn:master Feb 24, 2026
145 of 148 checks passed
oilbeater pushed a commit that referenced this pull request Feb 24, 2026
Signed-off-by: SkalaNetworks <contact@skala.network>
(cherry picked from commit 830362a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer 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.

2 participants