Skip to content
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: bootstrapper fixes: remove extra readBootstrap & avoid parseConfig #7436

Merged
merged 2 commits into from
Sep 18, 2020

Conversation

sanjaypujare
Copy link
Contributor

No description provided.

@@ -34,8 +34,8 @@
private final CertProviderClientSslContextProvider.Factory
certProviderClientSslContextProviderFactory;

ClientSslContextProviderFactory() {
this(Bootstrapper.getInstance(), CertProviderClientSslContextProvider.Factory.getInstance());
ClientSslContextProviderFactory(Bootstrapper bootstrapper) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change necessary? For tests you are using the other constructor, but for real instantiation it just calls Bootstrapper.getInstance() inside the constructor to get the default implementation. That doesn't sound wrong. It doesn't need to leave this burden to the caller of this class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is highly desirable. The Bootstrapper.getInstance() is now called in only one place: io.grpc.xds.internal.sds.TlsContextManagerImpl.getInstance() and that instance is then propagated to all the members. Similar to how the abstract Factories are used wherever possible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't matter as Bootstrap.getInstance returns the singleton.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it returns an implementation that is fixed and that reads from disk.

ServerSslContextProviderFactory() {
this(Bootstrapper.getInstance(), CertProviderServerSslContextProvider.Factory.getInstance());
ServerSslContextProviderFactory(Bootstrapper bootstrapper) {
this(bootstrapper, CertProviderServerSslContextProvider.Factory.getInstance());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as for ClientSslContextProviderFactory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same answer as above.

CertificateProvider.DistributorWatcher distWatcher =
new CertificateProvider.DistributorWatcher();
Map<String, ?> map = buildMinimalConfig();
@SuppressWarnings("unchecked")
Map<String, ?> map = (Map<String, ?>) JsonParser.parse(MINIMAL_MESHCA_CONFIG);
Copy link
Contributor

@voidzcy voidzcy Sep 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: map is a bad variable name. Same for other places.

@sanjaypujare sanjaypujare merged commit 04871dc into grpc:master Sep 18, 2020
@sanjaypujare sanjaypujare deleted the bootstrapper-fixes branch September 18, 2020 04:25
dfawley pushed a commit to dfawley/grpc-java that referenced this pull request Jan 15, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants