Skip to content

xds: replace deprecated fields for Upstream and Downstream TlsContext #7010

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

Merged
merged 3 commits into from
May 7, 2020

Conversation

sanjaypujare
Copy link
Contributor

No description provided.

@sanjaypujare sanjaypujare requested review from voidzcy and creamsoup May 5, 2020 23:42
@sanjaypujare sanjaypujare force-pushed the remove-deprecated-fields branch from 9563cf8 to 009ae80 Compare May 6, 2020 01:14
updateBuilder.setUpstreamTlsContext(cluster.getTlsContext());
try {
UpstreamTlsContext upstreamTlsContext = getTlsContextFromCluster(cluster);
if (upstreamTlsContext != null && upstreamTlsContext.isInitialized()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isInitialized is always true for proto3 since it checks mandatory fields are set or not. this need to be fixed.
also, can upstreamTlsContext be null?

Copy link
Contributor Author

@sanjaypujare sanjaypujare May 6, 2020

Choose a reason for hiding this comment

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

isInitialized only checks for mandatory fields? It's quite useless then. I'll then use hasCommonTlsContext() unless that too always returns true :-)

upstreamTlsContext can be null when we switch to v3 protos and cluster.getTlsContext() won't be there anymore so getTlsContextFromCluster will return null in that case.

Copy link
Contributor

Choose a reason for hiding this comment

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

it was useful for proto2 because proto2 has required fields. in proto3, all fields are optional.

Listener xdsListener = Listener.fromEnvoyProtoListener(listener);
List<EnvoyServerProtoData.FilterChain> filterChains = xdsListener.getFilterChains();
EnvoyServerProtoData.FilterChain inFilter = filterChains.get(0);
assertThat(inFilter).isNotNull();
Copy link
Contributor

Choose a reason for hiding this comment

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

this always pass or it won't execute this line. i think you should check size of filterChains

private static DownstreamTlsContext getTlsContextFromFilterChain(
io.envoyproxy.envoy.api.v2.listener.FilterChain filterChain)
throws InvalidProtocolBufferException {
if (filterChain.hasTransportSocket() && "tls"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: && should be in front

if (condition
    && another_condition) {
  ...
}

Copy link
Contributor

@creamsoup creamsoup left a comment

Choose a reason for hiding this comment

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

LGTM

@sanjaypujare
Copy link
Contributor Author

@voidzcy do you have any comments?

@sanjaypujare sanjaypujare merged commit 67cc317 into grpc:master May 7, 2020
@sanjaypujare sanjaypujare deleted the remove-deprecated-fields branch May 7, 2020 23:01
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 13, 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.

3 participants