Skip to content

Commit

Permalink
xds: log error and fail start() if server-listener-resource-name-temp…
Browse files Browse the repository at this point in the history
…late not set or not using xds_v3 (#8375) (#8376)
  • Loading branch information
sanjaypujare committed Aug 3, 2021
1 parent 3321856 commit aeb3720
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions xds/src/main/java/io/grpc/xds/XdsClientWrapperForServerSds.java
Expand Up @@ -125,14 +125,22 @@ public void onError(Status error) {
}
}
};
newServerApi = xdsClient.getBootstrapInfo().getServers().get(0).isUseProtocolV3();
if (!newServerApi) {
reportError(
new XdsInitializationException(
"requires use of xds_v3 in xds bootstrap"),
true);
return;
}
grpcServerResourceId = xdsClient.getBootstrapInfo()
.getServerListenerResourceNameTemplate();
newServerApi = xdsClient.getBootstrapInfo().getServers().get(0).isUseProtocolV3();
if (newServerApi && grpcServerResourceId == null) {
if (grpcServerResourceId == null) {
reportError(
new XdsInitializationException(
"missing server_listener_resource_name_template value in xds bootstrap"),
true);
return;
}
grpcServerResourceId = grpcServerResourceId.replaceAll("%s", "0.0.0.0:" + port);
xdsClient.watchLdsResource(grpcServerResourceId, listenerWatcher);
Expand Down
2 changes: 1 addition & 1 deletion xds/src/test/java/io/grpc/xds/XdsServerTestHelper.java
Expand Up @@ -47,7 +47,7 @@ public class XdsServerTestHelper {
static final Bootstrapper.BootstrapInfo BOOTSTRAP_INFO =
new Bootstrapper.BootstrapInfo(
Arrays.asList(
new Bootstrapper.ServerInfo(SERVER_URI, InsecureChannelCredentials.create(), false)),
new Bootstrapper.ServerInfo(SERVER_URI, InsecureChannelCredentials.create(), true)),
BOOTSTRAP_NODE,
null,
"grpc/server?udpa.resource.listening_address=%s");
Expand Down

0 comments on commit aeb3720

Please sign in to comment.