Skip to content

Deleting FIP sets EIP to ready #5141

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andrewlee1089
Copy link
Contributor

@andrewlee1089 andrewlee1089 commented Apr 10, 2025

Pull Request

What type of this PR

  • Previously when deleting a FIP, the function handleResetOvnEip was called.
  • handleResetOvnEip called patchOvnEipStatus to set the "Ready"
    field to true, regardless of the current EIP.
  • This fixes it so when handleResetOvnEip is called, the "Ready" is
    field of the EIP is unchanged

I have rejected a more ambitious fix where all calls of the handleResetOvnEip function set the EIP status to not be ready.

Which issue(s) this PR fixes

Fixes #5114

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 10, 2025
Copy link

@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.

Hello @andrewlee1089, 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!

Summary of Changes

This pull request appears to address an issue where deleting a Floating IP (FIP) should set the corresponding Elastic IP (EIP) to a 'ready' state. The change involves modifying the patchOvnEipStatus function call within the handleResetOvnEip function in pkg/controller/ovn_eip.go. The original code was setting the status to true, but this PR changes it to false.

Highlights

  • Bug Fix: The PR fixes a bug where deleting a FIP was not correctly setting the corresponding EIP to a ready state.
  • Status Update: The patchOvnEipStatus function is now called with false instead of true when handling the reset of an OVN EIP.

Changelog

  • pkg/controller/ovn_eip.go
    • Modified the handleResetOvnEip function to call patchOvnEipStatus with false to properly reflect the EIP's status after FIP deletion.
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.


A FIP departs, an EIP sighs,
Its status changed before our eyes.
From true to false it must descend,
A ready state, a peaceful end.

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

@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 modifies the patchOvnEipStatus function to set the OvnEip status to 'not ready' when handling a reset operation. This change seems related to ensuring that EIPs are properly reset when their configuration changes or when they are being deleted. The change itself is small, but it's important to ensure it aligns with the overall logic and intended behavior of the system.

Merge Readiness

The code change appears straightforward and addresses a specific scenario related to resetting OvnEip statuses. However, it's crucial to verify that setting the status to 'false' in this context doesn't inadvertently affect other parts of the system that rely on the EIP status. Given the potential impact, thorough testing and understanding of the broader implications are necessary before merging. I am unable to approve this pull request, and recommend that others review and approve this code before merging. Since there are no critical or high severity issues, the pull request could be merged after the medium severity issue is addressed.

@@ -193,7 +193,7 @@ func (c *Controller) handleResetOvnEip(key string) error {
return nil
}
klog.Infof("handle reset ovn eip %s", cachedEip.Name)
if err := c.patchOvnEipStatus(key, true); err != nil {
if err := c.patchOvnEipStatus(key, false); err != nil {

Choose a reason for hiding this comment

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

medium

Should there be a comment here explaining why we are setting the status to false? It's not immediately obvious why this is the correct behavior during a reset. Consider adding a comment to clarify the intent, especially since the previous value was true.

Style Guide References

Suggested change
if err := c.patchOvnEipStatus(key, false); err != nil {
// Set the EIP status to 'not ready' during reset to ensure proper cleanup and reconfiguration.
if err := c.patchOvnEipStatus(key, false); err != nil {

@coveralls
Copy link

coveralls commented Apr 10, 2025

Pull Request Test Coverage Report for Build 14466432184

Details

  • 0 of 11 (0.0%) changed or added relevant lines in 4 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage remained the same at 21.782%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller/ovn_dnat.go 0 1 0.0%
pkg/controller/ovn_fip.go 0 1 0.0%
pkg/controller/ovn_snat.go 0 1 0.0%
pkg/controller/ovn_eip.go 0 8 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/ovs/ovn-nb-logical_router_route.go 2 74.93%
Totals Coverage Status
Change from base Build 14458505599: 0.0%
Covered Lines: 10263
Relevant Lines: 47117

💛 - Coveralls

@andrewlee1089 andrewlee1089 force-pushed the andrewlee1089/5114/deleting-fip-sets-eip-to-ready branch from 44b1162 to 9c691a3 Compare April 10, 2025 15:31
@andrewlee1089
Copy link
Contributor Author

andrewlee1089 commented Apr 10, 2025

I'm not entirely sure of the implications of this PR - hence why this is in draft state.

Maybe instead handleResetOvnEip should not try and change the status of the EIP.

Please ignore this PR for now

@andrewlee1089 andrewlee1089 force-pushed the andrewlee1089/5114/deleting-fip-sets-eip-to-ready branch from 9c691a3 to 7bc126c Compare April 14, 2025 08:41
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Apr 14, 2025
@andrewlee1089 andrewlee1089 force-pushed the andrewlee1089/5114/deleting-fip-sets-eip-to-ready branch 2 times, most recently from 0da053e to 5a54169 Compare April 14, 2025 09:23
@zbb88888
Copy link
Collaborator

zbb88888 commented Apr 15, 2025

@andrewlee1089

maybe you are right

  1. iptables-eip has the ready status, so I use the ready in ovn-eip status. but ovn-eip is just a ip, it has no process of setting ip on the nic
  2. the ready status can help to make sure the ovn-eip v4 and v6 ip is already exist
  3. the ip crd has no ready status, so you can just remove the ready status.

Fixes kubeovn#5114

- Previously when deleting a FIP, the function `handleResetOvnEip` was called.
- `handleResetOvnEip` called `patchOvnEipStatus` to set the "Ready"
  field to true, regardless of the current EIP.
- This fixes it so when `handleResetOvnEip` is called, the "Ready" is
  field of the EIP is unchanged

Signed-off-by: Andrew Lee <[email protected]>
@andrewlee1089 andrewlee1089 force-pushed the andrewlee1089/5114/deleting-fip-sets-eip-to-ready branch from 5a54169 to f2699d7 Compare April 15, 2025 09:47
@andrewlee1089
Copy link
Contributor Author

@zbb88888 I can't get the pipeline to pass (I think it is failing for an unrelated reason) but I think this PR makes sense now. Please can you review?

@andrewlee1089 andrewlee1089 changed the title DRAFT: Deleting FIP sets EIP to ready Deleting FIP sets EIP to ready Apr 15, 2025
@@ -364,17 +364,19 @@ func (c *Controller) createOrUpdateOvnEipCR(key, subnet, v4ip, v6ip, mac, usageT
return nil
}

func (c *Controller) patchOvnEipStatus(key string, ready bool) error {
func (c *Controller) patchOvnEipStatus(key string, ready, changeReady bool) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

how about removing ready, changeReady and eip status ready, keep the ovn-eip just as IP crd? keep it simple

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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] Deleting FIP overwrites EIP ready state
3 participants