-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
xds: add support for multiple xDS clients, for fallback #7347
Conversation
I probably need to add one more test where the xDS clients are talking to different management servers, and receiving different resources. But the review can start prior to that, and I should have that test written soonish. |
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7347 +/- ##
==========================================
+ Coverage 80.58% 81.32% +0.73%
==========================================
Files 349 348 -1
Lines 34056 26744 -7312
==========================================
- Hits 27445 21749 -5696
+ Misses 5431 3795 -1636
- Partials 1180 1200 +20
|
Tests are passing now. This is good to be looked at. |
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.
Implementation looks good overall, mostly just style/naming nits. Some questions about scaling up tests.
|
||
} | ||
func newRefCountedWithConfig(name string, fallbackConfig *bootstrap.Config, watchExpiryTimeout, idleAuthorityTimeout time.Duration) (XDSClient, func(), error) { |
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.
Top level comment of get or create if not present? Or change name?
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.
Added a comment.
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.
Same question as for the Close, is the reason to keep these names this happens implicitly with objects that are ref counted?
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.
Explained the reasoning in the comment for close.
Looks like there is a flake in the csds e2e test. I will continue to look at that, but this is still good for a second pass. Thanks. |
// newRefCountedWithConfig creates a new reference counted xDS client | ||
// implementation for name, if one does not exist already. The passed in | ||
// fallback config is used when bootstrap environment variables are not defined. |
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.
Nit: "gets a reference to the existing xDS Client, or creates one if one does not exist already" or something alongside those lines for first context. To explicitly call out what happens if the xDS Client already exists for this name.
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.
|
||
// Tests the scenario where there are multiple calls to New() with different | ||
// names. Verifies that reference counts are tracked correctly and that only | ||
// when all references are released, the client is closed. |
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.
Nit: switch "are released, the client is closed" to something that emphasizes the plurality of the clients maybe "are released for a client, only that specific client is closed" or something along those lines.
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.
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.
Looks great!
// Close the first client completely. | ||
closeFunc1() | ||
for i := 0; i < count; i++ { | ||
closeFuncs1[i]() |
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.
Optional: here and the close for 2: the test above tests the idempotency implemented through the once func. Maybe call some of these twice?
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.
Sure. Done.
The CSDS test is failing on Github Actions because of the way go-control-plane continuously resends NACKed resources. This results in a busy loop on the xdsClient where it receives a resource and NACKs it repeatedly. This results in starvation of the I'm planning to put this PR on hold for now, fix grpc/grpc#34099 and get back here. |
@zasweq : Based on our offline discussion, I made a commit that skips the test on arm64. Waiting for GA to pass before I merge this. That way, I can work on the other PR implementing ADS stream flow control, and once I have that, I will be able to tweak this test and get it to work. |
Sgtm, thinking about it I agree with Doug. To minimize the chance of merge conflicts probably best to get this in sooner rather than later. |
This PR adds support for multiple xDS clients, as required by xDS fallback(A71).
Summary of changes:
#server
is usedt.Name
as the xDS client nameGetForTesting
method since it is no longer possible to simply callNew
and expect to get a reference to the singleton xDS client (as used by some tests to trigger resource not found errors)google_c2p
xds
DumpResources
method from theXDSClient
interfaceDumpResources
function to thexdsclient
package that traverses all existing xDS clients, retrieves a dump from each of them, and adds theclient_scope
field to each one, and returns a response that contains resources from all the clientsDumpResources
API provided by thexdsclient
package (that retrieves configs from all xDS clients in the system).client_scope
field is set appropriately.bootstrap
package to improve test log readability.Fixes #6899
#a71-xds-fallback
RELEASE NOTES: none