-
Notifications
You must be signed in to change notification settings - Fork 4.6k
xds/googlec2p: support custom bootstrap config per channel. #8648
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #8648 +/- ##
==========================================
- Coverage 82.17% 81.91% -0.26%
==========================================
Files 415 417 +2
Lines 40697 40815 +118
==========================================
- Hits 33442 33433 -9
- Misses 5874 6012 +138
+ Partials 1381 1370 -11
🚀 New features to boost your workflow:
|
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.
Don't we need a test to also verify that we can actually create multiple xDS clients with different configs from the same pool? That functionality seems to be the core of this PR.
xds/googledirectpath/googlec2p.go
Outdated
|
||
type c2pResolverWrapper struct { | ||
resolver.Resolver | ||
cancel func() |
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.
Please add a trailing comment to this line saying this cancel
func is used to release the ref to the xDS client that we created in Build
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.
I intended for the comment to be here, where the field is defined and not where it is used in Close
.
Yes, we do. I have added a 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, modulo minor comments.
internal/xds/xdsclient/pool.go
Outdated
if cfg != nil { | ||
return cfg | ||
} | ||
// TODO(i/8661) |
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.
Sorry if I wasn't clear in my previous comment. We don't need a TODO on every line where this field is referenced. Just one TODO where the field is defined should be good enough.
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.
Made the changes.
xds/googledirectpath/googlec2p.go
Outdated
|
||
type c2pResolverWrapper struct { | ||
resolver.Resolver | ||
cancel func() |
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 intended for the comment to be here, where the field is defined and not where it is used in Close
.
defer func() { xdsClientPool = oldXdsClientPool }() | ||
|
||
// Define bootstrap config for c2p resolver | ||
c2pConfig := bootstrapConfig(t, bootstrap.ConfigOptionsForTesting{ |
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.
Please move this definition to be right above the place where it is first used.
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.
|
||
// verifyXDSClientBootstrapConfig checks that an xDS client with the given name | ||
// exists in the pool and that its bootstrap config matches the expected config. | ||
func verifyXDSClientBootstrapConfig(t *testing.T, pool *xdsclient.Pool, name string, wantConfig *bootstrap.Config) xdsclient.XDSClient { |
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.
Let's not return the xds client from this function. The only place the returned value is used in the last test. See comment there as well.
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.
// Verify that the two clients are distinct instances. | ||
if clientC2P == clientGeneric { | ||
t.Fatal("Expected two distinct xDS clients, but got same") | ||
} |
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 don't think this is a very useful check. As long as we have verified that the two clients have their expected configs, we should be good.
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.
Removed this check.
This PR refactors the xdsclient pool and googlec2p resolver logic to support channel-specific bootstrap configuration, enabling use cases where applications need to create xDS clients with different configs.
Prior to this change, c2p resolver used SetFallbackBootstrapConfig to inject the directpath-specific bootstrap config, which became the singleton config for all xdsclients. This prevented users from running multiple xDS clients with distinct configs.
Key Changes:
RELEASE NOTES: