mirror of https://github.com/grpc/grpc-java.git
xds: log error and fail start() if server-listener-resource-name-template not set or not using xds_v3 (#8375)
This commit is contained in:
parent
57bd087cdf
commit
0d80c33bce
|
|
@ -125,14 +125,22 @@ public final class XdsClientWrapperForServerSds {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
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()
|
grpcServerResourceId = xdsClient.getBootstrapInfo()
|
||||||
.getServerListenerResourceNameTemplate();
|
.getServerListenerResourceNameTemplate();
|
||||||
newServerApi = xdsClient.getBootstrapInfo().getServers().get(0).isUseProtocolV3();
|
if (grpcServerResourceId == null) {
|
||||||
if (newServerApi && grpcServerResourceId == null) {
|
|
||||||
reportError(
|
reportError(
|
||||||
new XdsInitializationException(
|
new XdsInitializationException(
|
||||||
"missing server_listener_resource_name_template value in xds bootstrap"),
|
"missing server_listener_resource_name_template value in xds bootstrap"),
|
||||||
true);
|
true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
grpcServerResourceId = grpcServerResourceId.replaceAll("%s", "0.0.0.0:" + port);
|
grpcServerResourceId = grpcServerResourceId.replaceAll("%s", "0.0.0.0:" + port);
|
||||||
xdsClient.watchLdsResource(grpcServerResourceId, listenerWatcher);
|
xdsClient.watchLdsResource(grpcServerResourceId, listenerWatcher);
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class XdsServerTestHelper {
|
||||||
static final Bootstrapper.BootstrapInfo BOOTSTRAP_INFO =
|
static final Bootstrapper.BootstrapInfo BOOTSTRAP_INFO =
|
||||||
new Bootstrapper.BootstrapInfo(
|
new Bootstrapper.BootstrapInfo(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
new Bootstrapper.ServerInfo(SERVER_URI, InsecureChannelCredentials.create(), false)),
|
new Bootstrapper.ServerInfo(SERVER_URI, InsecureChannelCredentials.create(), true)),
|
||||||
BOOTSTRAP_NODE,
|
BOOTSTRAP_NODE,
|
||||||
null,
|
null,
|
||||||
"grpc/server?udpa.resource.listening_address=%s");
|
"grpc/server?udpa.resource.listening_address=%s");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue