loadbalancer: Fix deletion of backends during resynchronization#44711
Merged
joamaki merged 3 commits intocilium:mainfrom Mar 18, 2026
Merged
loadbalancer: Fix deletion of backends during resynchronization#44711joamaki merged 3 commits intocilium:mainfrom
joamaki merged 3 commits intocilium:mainfrom
Conversation
This allows simulating a resynchronization, e.g. disconnect to api-server and being behind enough that Watch() cannot be retried from a specific resource version and a full resync with listing is required. The k8s/resync command takes the resource name, optional namespace and new list of objects. Old objects are deleted and all matching Watch() calls are aborted. Signed-off-by: Jussi Maki <jussi@isovalent.com>
Regression test for a bug in resynchronization of endpoint slices which causes an orphan backend. Test is currently failing which the next commit will fix. Signed-off-by: Jussi Maki <jussi@isovalent.com>
The initial synchronization of endpoint slices is not setting the `svcName` in the `endpointsEvent` stored in `currentEndpoints`. If we get a resynchronization without an endpoint slice having updated this event entry we will fail in removing the backend as we'll call `ReleaseBackends` with empty service name. Fix the issue by setting `svcName`. The regression test added in previous commit now passes. Fixes: daf41d1 ("loadbalancer/reflectors: Reflect services directly") Signed-off-by: Jussi Maki <jussi@isovalent.com>
c96c82f to
92dcb85
Compare
Contributor
Author
|
/test |
dylandreimerink
approved these changes
Mar 13, 2026
tommyp1ckles
approved these changes
Mar 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The loadbalancer reflection of EndpointSlices kept track of what endpoints it had reflected and used this when doing a resync to remove orphan backends. This state held the service name, but this was incorrectly not set on the initial synchronization which could have caused backends to be left in the backend table if a resynchronization happened without processing an upsert event containing that backend between the initial and resynchronization. When this happened the following log message would have appeared:
This adds the
k8s/resynccommand so we can simulate resynchronization (e.g. loss of api-server connectivity and failure to resumeWatchleading to re-listing from scratch). On top of this a regression test is added to show the issue with a backend being left around after resynchronization, and finally a fix for the issue to set the missingsvcName.