-
Notifications
You must be signed in to change notification settings - Fork 4.6k
xds/cdsbalancer: correctly remove the unwanted cds watchers #8428
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #8428 +/- ##
==========================================
+ Coverage 82.38% 82.45% +0.06%
==========================================
Files 414 414
Lines 40403 40402 -1
==========================================
+ Hits 33287 33313 +26
+ Misses 5756 5733 -23
+ Partials 1360 1356 -4
🚀 New features to boost your workflow:
|
var onwatcherUpdated = func() { | ||
// This function is a no-op, but can be overridden in tests to signal that | ||
// the watchers map has been updated. | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can avoid adding a function specifically for tests and instead verify that the unsubscription happens by intercepting the requests in the xDS management server. When creating the xDS management server, you can provide an OnStreamRequest
in e2e.ManagementServerOptions
. Once the management server removes the cluster, you can wait for an update CDS discovery request from the xds client which should not have the removed cluster.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Changed the test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for finding and fixing this! Assigning a second reviewer.
Please add release notes. |
RELEASE NOTES:
In the code for
onClusterUpdate
after the cluster tree has been updated, we want to remove the watchers for clusters that are not currently in the tree. The existing code will always panic because of the error in condition. This change fixes the removal of unwanted watchers.