xds/cdsbalancer: correctly remove the unwanted cds watchers#8428
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.
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.
Done. Changed the test.
arjan-bal
left a comment
There was a problem hiding this comment.
LGTM, thanks for finding and fixing this! Assigning a second reviewer.
|
Please add release notes. |
RELEASE NOTES:
In the code for
onClusterUpdateafter 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.