xds: remove GRPC_XDS_EXPERIMENTAL_V3_SUPPORT env flag

This commit is contained in:
ZHANG Dapeng 2021-02-08 13:42:43 -08:00 committed by GitHub
parent 14332d294c
commit b1daad6f30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 25 deletions

View File

@ -59,9 +59,6 @@ public class BootstrapperImpl implements Bootstrapper {
static String bootstrapConfigFromSysProp = System.getProperty(BOOTSTRAP_CONFIG_SYS_PROPERTY_VAR);
private static final String XDS_V3_SERVER_FEATURE = "xds_v3";
@VisibleForTesting
static boolean enableV3Protocol = Boolean.parseBoolean(
System.getenv("GRPC_XDS_EXPERIMENTAL_V3_SUPPORT"));
@VisibleForTesting
static final String CLIENT_FEATURE_DISABLE_OVERPROVISIONING =
"envoy.lb.does_not_support_overprovisioning";
@ -176,8 +173,7 @@ public class BootstrapperImpl implements Bootstrapper {
List<String> serverFeatures = JsonUtil.getListOfStrings(serverConfig, "server_features");
if (serverFeatures != null) {
logger.log(XdsLogLevel.INFO, "Server features: {0}", serverFeatures);
useProtocolV3 = enableV3Protocol
&& serverFeatures.contains(XDS_V3_SERVER_FEATURE);
useProtocolV3 = serverFeatures.contains(XDS_V3_SERVER_FEATURE);
}
servers.add(new ServerInfo(serverUri, channelCredentials, useProtocolV3));
}

View File

@ -56,7 +56,6 @@ public class BootstrapperImplTest {
private String originalBootstrapPathFromSysProp;
private String originalBootstrapConfigFromEnvVar;
private String originalBootstrapConfigFromSysProp;
private boolean originalEnableV3Protocol;
@Before
public void setUp() {
@ -69,7 +68,6 @@ public class BootstrapperImplTest {
originalBootstrapPathFromSysProp = BootstrapperImpl.bootstrapPathFromSysProp;
originalBootstrapConfigFromEnvVar = BootstrapperImpl.bootstrapConfigFromEnvVar;
originalBootstrapConfigFromSysProp = BootstrapperImpl.bootstrapConfigFromSysProp;
originalEnableV3Protocol = BootstrapperImpl.enableV3Protocol;
}
@After
@ -78,7 +76,6 @@ public class BootstrapperImplTest {
BootstrapperImpl.bootstrapPathFromSysProp = originalBootstrapPathFromSysProp;
BootstrapperImpl.bootstrapConfigFromEnvVar = originalBootstrapConfigFromEnvVar;
BootstrapperImpl.bootstrapConfigFromSysProp = originalBootstrapConfigFromSysProp;
BootstrapperImpl.enableV3Protocol = originalEnableV3Protocol;
}
@Test
@ -567,7 +564,7 @@ public class BootstrapperImplTest {
+ " \"channel_creds\": [\n"
+ " {\"type\": \"insecure\"}\n"
+ " ],\n"
+ " \"server_features\": [\"xds_v3\"]\n"
+ " \"server_features\": []\n"
+ " }\n"
+ " ]\n"
+ "}";
@ -581,17 +578,7 @@ public class BootstrapperImplTest {
}
@Test
public void supportV3Protocol_disabledByDefault() throws XdsInitializationException {
subtestSupportV3Protocol(false);
}
@Test
public void supportV3Protocol_enabled() throws XdsInitializationException {
BootstrapperImpl.enableV3Protocol = true;
subtestSupportV3Protocol(true);
}
private void subtestSupportV3Protocol(boolean enabled) throws XdsInitializationException {
public void useV3ProtocolIfV3FeaturePresent() throws XdsInitializationException {
String rawData = "{\n"
+ " \"xds_servers\": [\n"
+ " {\n"
@ -609,11 +596,7 @@ public class BootstrapperImplTest {
ServerInfo serverInfo = Iterables.getOnlyElement(info.getServers());
assertThat(serverInfo.getTarget()).isEqualTo(SERVER_URI);
assertThat(serverInfo.getChannelCredentials()).isInstanceOf(InsecureChannelCredentials.class);
if (enabled) {
assertThat(serverInfo.isUseProtocolV3()).isTrue();
} else {
assertThat(serverInfo.isUseProtocolV3()).isFalse();
}
assertThat(serverInfo.isUseProtocolV3()).isTrue();
}
@Test