Skip to content

Conversation

@mlguerrero12
Copy link

This prevents the unnecessary reprocess of all services when a service with no LB IP assigned is deleted.

// we delete a balancer we should reprocess all of them to
// check for newly feasible balancers.
return controllers.SyncStateReprocessAll
if c.ips.Unassign(name) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we have a "IsAllocated" function on the allocator and have it guarding this if? In this way it is going to be clearer why we do the reprocessall (as opposed to having to rely on the fact that unassign returns false if the service is not there).

The effect would be the same but this function would be easier to understand.

Copy link
Author

Choose a reason for hiding this comment

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

Done. More expensive to run tough.

Copy link
Member

Choose a reason for hiding this comment

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

Agree, but I prefer to prioritize the codebase to be maintainable / readable rather than optimized. And this is not a bottleneck anyway.

@fedepaol
Copy link
Member

Nice catch!

@mlguerrero12 mlguerrero12 force-pushed the preventreprocessall branch from f5d0391 to fc1960e Compare May 19, 2023 09:22
This prevents the unnecessary reprocess of all services when
a service with no LB IP assigned is deleted.

Signed-off-by: Marcelo Guerrero Viveros <marguerr@redhat.com>
@mlguerrero12 mlguerrero12 force-pushed the preventreprocessall branch from fc1960e to f9dda2d Compare May 19, 2023 09:37
@fedepaol
Copy link
Member

LGTM

@fedepaol fedepaol enabled auto-merge May 19, 2023 09:41
@fedepaol fedepaol added this pull request to the merge queue May 19, 2023
Merged via the queue into metallb:main with commit 6bfa7f7 May 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants