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: allow injecting bootstrapOverride in xdsNameResolverProvider #8358
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,8 +43,11 @@ public final class XdsNameResolverProvider extends NameResolverProvider { | |
|
||
private static final String SCHEME = "xds"; | ||
|
||
@Override | ||
public XdsNameResolver newNameResolver(URI targetUri, Args args) { | ||
/** | ||
* Allows injecting bootstrapOverride to the name resolver. | ||
* */ | ||
public XdsNameResolver newNameResolver(URI targetUri, Args args, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Who would call this method? I think we want There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, i didn't test it. |
||
@Nullable Map<String, ?> bootstrapOverride) { | ||
if (SCHEME.equals(targetUri.getScheme())) { | ||
String targetPath = checkNotNull(targetUri.getPath(), "targetPath"); | ||
Preconditions.checkArgument( | ||
|
@@ -54,11 +57,17 @@ public XdsNameResolver newNameResolver(URI targetUri, Args args) { | |
targetUri); | ||
String name = targetPath.substring(1); | ||
return new XdsNameResolver(name, args.getServiceConfigParser(), | ||
args.getSynchronizationContext(), args.getScheduledExecutorService()); | ||
args.getSynchronizationContext(), args.getScheduledExecutorService(), | ||
bootstrapOverride); | ||
} | ||
return null; | ||
} | ||
|
||
@Override | ||
public XdsNameResolver newNameResolver(URI targetUri, Args args) { | ||
return newNameResolver(targetUri, args, null); | ||
} | ||
|
||
@Override | ||
public String getDefaultScheme() { | ||
return SCHEME; | ||
|
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.
This mutates the default factory, which would impact other xds clients. Create a new instance if bootstrapOverride is set.