From 23e5bbfbcba9684a4d9282be896c4028f1b5e9cd Mon Sep 17 00:00:00 2001 From: MV Shiva Date: Mon, 2 Jun 2025 11:01:40 +0530 Subject: [PATCH] Revert "xds: xDS-based HTTP CONNECT configuration (#12099)" This reverts commit 7776d3712085d6cd8abd2780e5602c8b00801358. --- xds/BUILD.bazel | 1 - .../java/io/grpc/xds/CdsLoadBalancer2.java | 4 +- .../grpc/xds/ClusterResolverLoadBalancer.java | 46 +-- .../ClusterResolverLoadBalancerProvider.java | 9 +- xds/src/main/java/io/grpc/xds/Endpoints.java | 20 +- .../io/grpc/xds/GcpAuthenticationFilter.java | 12 +- .../java/io/grpc/xds/MetadataRegistry.java | 60 +--- .../java/io/grpc/xds/XdsClusterResource.java | 126 ++++---- .../java/io/grpc/xds/XdsEndpointResource.java | 74 +---- .../io/grpc/xds/CdsLoadBalancer2Test.java | 45 ++- .../xds/ClusterResolverLoadBalancerTest.java | 305 ++++++------------ .../grpc/xds/GrpcXdsClientImplDataTest.java | 120 +------ .../grpc/xds/GrpcXdsClientImplTestBase.java | 16 +- .../test/java/io/grpc/xds/XdsTestUtils.java | 8 +- xds/third_party/envoy/import.sh | 1 - .../v3/upstream_http_11_connect.proto | 38 --- 16 files changed, 220 insertions(+), 665 deletions(-) delete mode 100644 xds/third_party/envoy/src/main/proto/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto diff --git a/xds/BUILD.bazel b/xds/BUILD.bazel index 53fac28b2da..b235a79c526 100644 --- a/xds/BUILD.bazel +++ b/xds/BUILD.bazel @@ -85,7 +85,6 @@ java_proto_library( "@envoy_api//envoy/extensions/load_balancing_policies/ring_hash/v3:pkg", "@envoy_api//envoy/extensions/load_balancing_policies/round_robin/v3:pkg", "@envoy_api//envoy/extensions/load_balancing_policies/wrr_locality/v3:pkg", - "@envoy_api//envoy/extensions/transport_sockets/http_11_proxy/v3:pkg", "@envoy_api//envoy/extensions/transport_sockets/tls/v3:pkg", "@envoy_api//envoy/service/discovery/v3:pkg", "@envoy_api//envoy/service/load_stats/v3:pkg", diff --git a/xds/src/main/java/io/grpc/xds/CdsLoadBalancer2.java b/xds/src/main/java/io/grpc/xds/CdsLoadBalancer2.java index bb44071a484..04b7663fd35 100644 --- a/xds/src/main/java/io/grpc/xds/CdsLoadBalancer2.java +++ b/xds/src/main/java/io/grpc/xds/CdsLoadBalancer2.java @@ -243,9 +243,7 @@ private void handleClusterDiscovered() { } ClusterResolverConfig config = new ClusterResolverConfig( - Collections.unmodifiableList(instances), - configOrError.getConfig(), - root.result.isHttp11ProxyAvailable()); + Collections.unmodifiableList(instances), configOrError.getConfig()); if (childLb == null) { childLb = lbRegistry.getProvider(CLUSTER_RESOLVER_POLICY_NAME).newLoadBalancer(helper); } diff --git a/xds/src/main/java/io/grpc/xds/ClusterResolverLoadBalancer.java b/xds/src/main/java/io/grpc/xds/ClusterResolverLoadBalancer.java index 0fb7cf15909..aff61cf7ada 100644 --- a/xds/src/main/java/io/grpc/xds/ClusterResolverLoadBalancer.java +++ b/xds/src/main/java/io/grpc/xds/ClusterResolverLoadBalancer.java @@ -25,7 +25,6 @@ import com.google.protobuf.Struct; import io.grpc.Attributes; import io.grpc.EquivalentAddressGroup; -import io.grpc.HttpConnectProxiedSocketAddress; import io.grpc.InternalLogId; import io.grpc.LoadBalancer; import io.grpc.LoadBalancerProvider; @@ -61,8 +60,6 @@ import io.grpc.xds.client.XdsClient.ResourceWatcher; import io.grpc.xds.client.XdsLogger; import io.grpc.xds.client.XdsLogger.XdsLogLevel; -import java.net.InetSocketAddress; -import java.net.SocketAddress; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; @@ -434,18 +431,8 @@ public void run() { .set(XdsAttributes.ATTR_SERVER_WEIGHT, weight) .set(XdsAttributes.ATTR_ADDRESS_NAME, endpoint.hostname()) .build(); - - EquivalentAddressGroup eag; - if (config.isHttp11ProxyAvailable()) { - List rewrittenAddresses = new ArrayList<>(); - for (SocketAddress addr : endpoint.eag().getAddresses()) { - rewrittenAddresses.add(rewriteAddress( - addr, endpoint.endpointMetadata(), localityLbInfo.localityMetadata())); - } - eag = new EquivalentAddressGroup(rewrittenAddresses, attr); - } else { - eag = new EquivalentAddressGroup(endpoint.eag().getAddresses(), attr); - } + EquivalentAddressGroup eag = new EquivalentAddressGroup( + endpoint.eag().getAddresses(), attr); eag = AddressFilter.setPathFilter(eag, Arrays.asList(priorityName, localityName)); addresses.add(eag); } @@ -483,35 +470,6 @@ public void run() { new EndpointsUpdated().run(); } - private SocketAddress rewriteAddress(SocketAddress addr, - ImmutableMap endpointMetadata, - ImmutableMap localityMetadata) { - if (!(addr instanceof InetSocketAddress)) { - return addr; - } - - SocketAddress proxyAddress; - try { - proxyAddress = (SocketAddress) endpointMetadata.get( - "envoy.http11_proxy_transport_socket.proxy_address"); - if (proxyAddress == null) { - proxyAddress = (SocketAddress) localityMetadata.get( - "envoy.http11_proxy_transport_socket.proxy_address"); - } - } catch (ClassCastException e) { - return addr; - } - - if (proxyAddress == null) { - return addr; - } - - return HttpConnectProxiedSocketAddress.newBuilder() - .setTargetAddress((InetSocketAddress) addr) - .setProxyAddress(proxyAddress) - .build(); - } - private List generatePriorityNames(String name, Map localityLbEndpoints) { TreeMap> todo = new TreeMap<>(); diff --git a/xds/src/main/java/io/grpc/xds/ClusterResolverLoadBalancerProvider.java b/xds/src/main/java/io/grpc/xds/ClusterResolverLoadBalancerProvider.java index b5dcb271368..2301cb670e0 100644 --- a/xds/src/main/java/io/grpc/xds/ClusterResolverLoadBalancerProvider.java +++ b/xds/src/main/java/io/grpc/xds/ClusterResolverLoadBalancerProvider.java @@ -74,17 +74,10 @@ static final class ClusterResolverConfig { final List discoveryMechanisms; // GracefulSwitch configuration final Object lbConfig; - private final boolean isHttp11ProxyAvailable; - ClusterResolverConfig(List discoveryMechanisms, Object lbConfig, - boolean isHttp11ProxyAvailable) { + ClusterResolverConfig(List discoveryMechanisms, Object lbConfig) { this.discoveryMechanisms = checkNotNull(discoveryMechanisms, "discoveryMechanisms"); this.lbConfig = checkNotNull(lbConfig, "lbConfig"); - this.isHttp11ProxyAvailable = isHttp11ProxyAvailable; - } - - boolean isHttp11ProxyAvailable() { - return isHttp11ProxyAvailable; } @Override diff --git a/xds/src/main/java/io/grpc/xds/Endpoints.java b/xds/src/main/java/io/grpc/xds/Endpoints.java index b0d97d42c11..7d7aa3e386d 100644 --- a/xds/src/main/java/io/grpc/xds/Endpoints.java +++ b/xds/src/main/java/io/grpc/xds/Endpoints.java @@ -21,7 +21,6 @@ import com.google.auto.value.AutoValue; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import io.grpc.EquivalentAddressGroup; import java.net.InetSocketAddress; import java.util.List; @@ -42,13 +41,11 @@ abstract static class LocalityLbEndpoints { // Locality's priority level. abstract int priority(); - abstract ImmutableMap localityMetadata(); - static LocalityLbEndpoints create(List endpoints, int localityWeight, - int priority, ImmutableMap localityMetadata) { + int priority) { checkArgument(localityWeight > 0, "localityWeight must be greater than 0"); return new AutoValue_Endpoints_LocalityLbEndpoints( - ImmutableList.copyOf(endpoints), localityWeight, priority, localityMetadata); + ImmutableList.copyOf(endpoints), localityWeight, priority); } } @@ -66,20 +63,17 @@ abstract static class LbEndpoint { abstract String hostname(); - abstract ImmutableMap endpointMetadata(); - static LbEndpoint create(EquivalentAddressGroup eag, int loadBalancingWeight, - boolean isHealthy, String hostname, ImmutableMap endpointMetadata) { - return new AutoValue_Endpoints_LbEndpoint( - eag, loadBalancingWeight, isHealthy, hostname, endpointMetadata); + boolean isHealthy, String hostname) { + return new AutoValue_Endpoints_LbEndpoint(eag, loadBalancingWeight, isHealthy, hostname); } // Only for testing. @VisibleForTesting - static LbEndpoint create(String address, int port, int loadBalancingWeight, boolean isHealthy, - String hostname, ImmutableMap endpointMetadata) { + static LbEndpoint create( + String address, int port, int loadBalancingWeight, boolean isHealthy, String hostname) { return LbEndpoint.create(new EquivalentAddressGroup(new InetSocketAddress(address, port)), - loadBalancingWeight, isHealthy, hostname, endpointMetadata); + loadBalancingWeight, isHealthy, hostname); } } diff --git a/xds/src/main/java/io/grpc/xds/GcpAuthenticationFilter.java b/xds/src/main/java/io/grpc/xds/GcpAuthenticationFilter.java index 41687817c47..7ed617c9843 100644 --- a/xds/src/main/java/io/grpc/xds/GcpAuthenticationFilter.java +++ b/xds/src/main/java/io/grpc/xds/GcpAuthenticationFilter.java @@ -36,7 +36,6 @@ import io.grpc.Status; import io.grpc.auth.MoreCallCredentials; import io.grpc.xds.MetadataRegistry.MetadataValueParser; -import io.grpc.xds.client.XdsResourceType.ResourceInvalidException; import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.ScheduledExecutorService; @@ -241,16 +240,11 @@ public String getTypeUrl() { } @Override - public String parse(Any any) throws ResourceInvalidException { - Audience audience; - try { - audience = any.unpack(Audience.class); - } catch (InvalidProtocolBufferException ex) { - throw new ResourceInvalidException("Invalid Resource in address proto", ex); - } + public String parse(Any any) throws InvalidProtocolBufferException { + Audience audience = any.unpack(Audience.class); String url = audience.getUrl(); if (url.isEmpty()) { - throw new ResourceInvalidException( + throw new InvalidProtocolBufferException( "Audience URL is empty. Metadata value must contain a valid URL."); } return url; diff --git a/xds/src/main/java/io/grpc/xds/MetadataRegistry.java b/xds/src/main/java/io/grpc/xds/MetadataRegistry.java index b79a61a261a..8243b6a6f0f 100644 --- a/xds/src/main/java/io/grpc/xds/MetadataRegistry.java +++ b/xds/src/main/java/io/grpc/xds/MetadataRegistry.java @@ -17,14 +17,9 @@ package io.grpc.xds; import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.ImmutableMap; import com.google.protobuf.Any; -import com.google.protobuf.Struct; -import io.envoyproxy.envoy.config.core.v3.Metadata; +import com.google.protobuf.InvalidProtocolBufferException; import io.grpc.xds.GcpAuthenticationFilter.AudienceMetadataParser; -import io.grpc.xds.XdsEndpointResource.AddressMetadataParser; -import io.grpc.xds.client.XdsResourceType.ResourceInvalidException; -import io.grpc.xds.internal.ProtobufJsonConverter; import java.util.HashMap; import java.util.Map; @@ -41,7 +36,6 @@ final class MetadataRegistry { private MetadataRegistry() { registerParser(new AudienceMetadataParser()); - registerParser(new AddressMetadataParser()); } static MetadataRegistry getInstance() { @@ -61,54 +55,6 @@ void removeParser(MetadataValueParser parser) { supportedParsers.remove(parser.getTypeUrl()); } - /** - * Parses cluster metadata into a structured map. - * - *

Values in {@code typed_filter_metadata} take precedence over - * {@code filter_metadata} when keys overlap, following Envoy API behavior. See - * - * Envoy metadata documentation for details. - * - * @param metadata the {@link Metadata} containing the fields to parse. - * @return an immutable map of parsed metadata. - * @throws ResourceInvalidException if parsing {@code typed_filter_metadata} fails. - */ - public ImmutableMap parseMetadata(Metadata metadata) - throws ResourceInvalidException { - ImmutableMap.Builder parsedMetadata = ImmutableMap.builder(); - - // Process typed_filter_metadata - for (Map.Entry entry : metadata.getTypedFilterMetadataMap().entrySet()) { - String key = entry.getKey(); - Any value = entry.getValue(); - MetadataValueParser parser = findParser(value.getTypeUrl()); - if (parser != null) { - try { - Object parsedValue = parser.parse(value); - parsedMetadata.put(key, parsedValue); - } catch (ResourceInvalidException e) { - throw new ResourceInvalidException( - String.format("Failed to parse metadata key: %s, type: %s. Error: %s", - key, value.getTypeUrl(), e.getMessage()), e); - } - } - } - // building once to reuse in the next loop - ImmutableMap intermediateParsedMetadata = parsedMetadata.build(); - - // Process filter_metadata for remaining keys - for (Map.Entry entry : metadata.getFilterMetadataMap().entrySet()) { - String key = entry.getKey(); - if (!intermediateParsedMetadata.containsKey(key)) { - Struct structValue = entry.getValue(); - Object jsonValue = ProtobufJsonConverter.convertToJson(structValue); - parsedMetadata.put(key, jsonValue); - } - } - - return parsedMetadata.build(); - } - interface MetadataValueParser { String getTypeUrl(); @@ -118,8 +64,8 @@ interface MetadataValueParser { * * @param any the {@link Any} object to parse. * @return the parsed metadata value. - * @throws ResourceInvalidException if the parsing fails. + * @throws InvalidProtocolBufferException if the parsing fails. */ - Object parse(Any any) throws ResourceInvalidException; + Object parse(Any any) throws InvalidProtocolBufferException; } } diff --git a/xds/src/main/java/io/grpc/xds/XdsClusterResource.java b/xds/src/main/java/io/grpc/xds/XdsClusterResource.java index cfc74f3ca70..626d61c1f55 100644 --- a/xds/src/main/java/io/grpc/xds/XdsClusterResource.java +++ b/xds/src/main/java/io/grpc/xds/XdsClusterResource.java @@ -25,6 +25,7 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.protobuf.Any; import com.google.protobuf.Duration; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Message; @@ -32,11 +33,10 @@ import com.google.protobuf.util.Durations; import io.envoyproxy.envoy.config.cluster.v3.CircuitBreakers.Thresholds; import io.envoyproxy.envoy.config.cluster.v3.Cluster; +import io.envoyproxy.envoy.config.core.v3.Metadata; import io.envoyproxy.envoy.config.core.v3.RoutingPriority; import io.envoyproxy.envoy.config.core.v3.SocketAddress; -import io.envoyproxy.envoy.config.core.v3.TransportSocket; import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment; -import io.envoyproxy.envoy.extensions.transport_sockets.http_11_proxy.v3.Http11ProxyUpstreamTransport; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateValidationContext; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext; import io.grpc.LoadBalancerRegistry; @@ -46,12 +46,15 @@ import io.grpc.internal.ServiceConfigUtil.LbConfig; import io.grpc.xds.EnvoyServerProtoData.OutlierDetection; import io.grpc.xds.EnvoyServerProtoData.UpstreamTlsContext; +import io.grpc.xds.MetadataRegistry.MetadataValueParser; import io.grpc.xds.XdsClusterResource.CdsUpdate; import io.grpc.xds.client.XdsClient.ResourceUpdate; import io.grpc.xds.client.XdsResourceType; +import io.grpc.xds.internal.ProtobufJsonConverter; import io.grpc.xds.internal.security.CommonTlsContextUtil; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Set; import javax.annotation.Nullable; @@ -64,8 +67,6 @@ class XdsClusterResource extends XdsResourceType { @VisibleForTesting public static boolean enableSystemRootCerts = GrpcUtil.getFlag("GRPC_EXPERIMENTAL_XDS_SYSTEM_ROOT_CERTS", false); - static boolean isEnabledXdsHttpConnect = - GrpcUtil.getFlag("GRPC_EXPERIMENTAL_XDS_HTTP_CONNECT", false); @VisibleForTesting static final String AGGREGATE_CLUSTER_TYPE_NAME = "envoy.clusters.aggregate"; @@ -77,9 +78,6 @@ class XdsClusterResource extends XdsResourceType { "type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext"; private static final String TYPE_URL_UPSTREAM_TLS_CONTEXT_V2 = "type.googleapis.com/envoy.api.v2.auth.UpstreamTlsContext"; - static final String TRANSPORT_SOCKET_NAME_HTTP11_PROXY = - "type.googleapis.com/envoy.extensions.transport_sockets.http_11_proxy.v3" - + ".Http11ProxyUpstreamTransport"; private final LoadBalancerRegistry loadBalancerRegistry = LoadBalancerRegistry.getDefaultRegistry(); @@ -179,11 +177,10 @@ static CdsUpdate processCluster(Cluster cluster, ImmutableMap.copyOf(cluster.getMetadata().getFilterMetadataMap())); try { - MetadataRegistry registry = MetadataRegistry.getInstance(); ImmutableMap parsedFilterMetadata = - registry.parseMetadata(cluster.getMetadata()); + parseClusterMetadata(cluster.getMetadata()); updateBuilder.parsedMetadata(parsedFilterMetadata); - } catch (ResourceInvalidException e) { + } catch (InvalidProtocolBufferException e) { throw new ResourceInvalidException( "Failed to parse xDS filter metadata for cluster '" + cluster.getName() + "': " + e.getMessage(), e); @@ -192,6 +189,49 @@ static CdsUpdate processCluster(Cluster cluster, return updateBuilder.build(); } + /** + * Parses cluster metadata into a structured map. + * + *

Values in {@code typed_filter_metadata} take precedence over + * {@code filter_metadata} when keys overlap, following Envoy API behavior. See + * + * Envoy metadata documentation for details. + * + * @param metadata the {@link Metadata} containing the fields to parse. + * @return an immutable map of parsed metadata. + * @throws InvalidProtocolBufferException if parsing {@code typed_filter_metadata} fails. + */ + private static ImmutableMap parseClusterMetadata(Metadata metadata) + throws InvalidProtocolBufferException { + ImmutableMap.Builder parsedMetadata = ImmutableMap.builder(); + + MetadataRegistry registry = MetadataRegistry.getInstance(); + // Process typed_filter_metadata + for (Map.Entry entry : metadata.getTypedFilterMetadataMap().entrySet()) { + String key = entry.getKey(); + Any value = entry.getValue(); + MetadataValueParser parser = registry.findParser(value.getTypeUrl()); + if (parser != null) { + Object parsedValue = parser.parse(value); + parsedMetadata.put(key, parsedValue); + } + } + // building once to reuse in the next loop + ImmutableMap intermediateParsedMetadata = parsedMetadata.build(); + + // Process filter_metadata for remaining keys + for (Map.Entry entry : metadata.getFilterMetadataMap().entrySet()) { + String key = entry.getKey(); + if (!intermediateParsedMetadata.containsKey(key)) { + Struct structValue = entry.getValue(); + Object jsonValue = ProtobufJsonConverter.convertToJson(structValue); + parsedMetadata.put(key, jsonValue); + } + } + + return parsedMetadata.build(); + } + private static StructOrError parseAggregateCluster(Cluster cluster) { String clusterName = cluster.getName(); Cluster.CustomClusterType customType = cluster.getClusterType(); @@ -219,7 +259,6 @@ private static StructOrError parseNonAggregateCluster( Long maxConcurrentRequests = null; UpstreamTlsContext upstreamTlsContext = null; OutlierDetection outlierDetection = null; - boolean isHttp11ProxyAvailable = false; if (cluster.hasLrsServer()) { if (!cluster.getLrsServer().hasSelf()) { return StructOrError.fromError( @@ -242,43 +281,17 @@ private static StructOrError parseNonAggregateCluster( return StructOrError.fromError("Cluster " + clusterName + ": transport-socket-matches not supported."); } - boolean hasTransportSocket = cluster.hasTransportSocket(); - TransportSocket transportSocket = cluster.getTransportSocket(); - - if (hasTransportSocket && !TRANSPORT_SOCKET_NAME_TLS.equals(transportSocket.getName()) - && !(isEnabledXdsHttpConnect - && TRANSPORT_SOCKET_NAME_HTTP11_PROXY.equals(transportSocket.getName()))) { - return StructOrError.fromError( - "transport-socket with name " + transportSocket.getName() + " not supported."); - } - - if (hasTransportSocket && isEnabledXdsHttpConnect - && TRANSPORT_SOCKET_NAME_HTTP11_PROXY.equals(transportSocket.getName())) { - isHttp11ProxyAvailable = true; - try { - Http11ProxyUpstreamTransport wrappedTransportSocket = transportSocket - .getTypedConfig().unpack(io.envoyproxy.envoy.extensions.transport_sockets - .http_11_proxy.v3.Http11ProxyUpstreamTransport.class); - hasTransportSocket = wrappedTransportSocket.hasTransportSocket(); - transportSocket = wrappedTransportSocket.getTransportSocket(); - } catch (InvalidProtocolBufferException e) { - return StructOrError.fromError( - "Cluster " + clusterName + ": malformed Http11ProxyUpstreamTransport: " + e); - } catch (ClassCastException e) { - return StructOrError.fromError( - "Cluster " + clusterName - + ": invalid transport_socket type in Http11ProxyUpstreamTransport"); + if (cluster.hasTransportSocket()) { + if (!TRANSPORT_SOCKET_NAME_TLS.equals(cluster.getTransportSocket().getName())) { + return StructOrError.fromError("transport-socket with name " + + cluster.getTransportSocket().getName() + " not supported."); } - } - - if (hasTransportSocket && TRANSPORT_SOCKET_NAME_TLS.equals(transportSocket.getName())) { try { upstreamTlsContext = UpstreamTlsContext.fromEnvoyProtoUpstreamTlsContext( validateUpstreamTlsContext( - unpackCompatibleType(transportSocket.getTypedConfig(), - io.envoyproxy.envoy.extensions - .transport_sockets.tls.v3.UpstreamTlsContext.class, - TYPE_URL_UPSTREAM_TLS_CONTEXT, TYPE_URL_UPSTREAM_TLS_CONTEXT_V2), + unpackCompatibleType(cluster.getTransportSocket().getTypedConfig(), + io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext.class, + TYPE_URL_UPSTREAM_TLS_CONTEXT, TYPE_URL_UPSTREAM_TLS_CONTEXT_V2), certProviderInstances)); } catch (InvalidProtocolBufferException | ResourceInvalidException e) { return StructOrError.fromError( @@ -316,10 +329,9 @@ private static StructOrError parseNonAggregateCluster( return StructOrError.fromError( "EDS service_name must be set when Cluster resource has an xdstp name"); } - return StructOrError.fromStruct(CdsUpdate.forEds( clusterName, edsServiceName, lrsServerInfo, maxConcurrentRequests, upstreamTlsContext, - outlierDetection, isHttp11ProxyAvailable)); + outlierDetection)); } else if (type.equals(Cluster.DiscoveryType.LOGICAL_DNS)) { if (!cluster.hasLoadAssignment()) { return StructOrError.fromError( @@ -354,8 +366,7 @@ private static StructOrError parseNonAggregateCluster( String dnsHostName = String.format( Locale.US, "%s:%d", socketAddress.getAddress(), socketAddress.getPortValue()); return StructOrError.fromStruct(CdsUpdate.forLogicalDns( - clusterName, dnsHostName, lrsServerInfo, maxConcurrentRequests, - upstreamTlsContext, isHttp11ProxyAvailable)); + clusterName, dnsHostName, lrsServerInfo, maxConcurrentRequests, upstreamTlsContext)); } return StructOrError.fromError( "Cluster " + clusterName + ": unsupported built-in discovery type: " + type); @@ -609,8 +620,6 @@ abstract static class CdsUpdate implements ResourceUpdate { @Nullable abstract UpstreamTlsContext upstreamTlsContext(); - abstract boolean isHttp11ProxyAvailable(); - // List of underlying clusters making of this aggregate cluster. // Only valid for AGGREGATE cluster. @Nullable @@ -631,8 +640,7 @@ private static Builder newBuilder(String clusterName) { .maxRingSize(0) .choiceCount(0) .filterMetadata(ImmutableMap.of()) - .parsedMetadata(ImmutableMap.of()) - .isHttp11ProxyAvailable(false); + .parsedMetadata(ImmutableMap.of()); } static Builder forAggregate(String clusterName, List prioritizedClusterNames) { @@ -645,30 +653,26 @@ static Builder forAggregate(String clusterName, List prioritizedClusterN static Builder forEds(String clusterName, @Nullable String edsServiceName, @Nullable ServerInfo lrsServerInfo, @Nullable Long maxConcurrentRequests, @Nullable UpstreamTlsContext upstreamTlsContext, - @Nullable OutlierDetection outlierDetection, - boolean isHttp11ProxyAvailable) { + @Nullable OutlierDetection outlierDetection) { return newBuilder(clusterName) .clusterType(ClusterType.EDS) .edsServiceName(edsServiceName) .lrsServerInfo(lrsServerInfo) .maxConcurrentRequests(maxConcurrentRequests) .upstreamTlsContext(upstreamTlsContext) - .outlierDetection(outlierDetection) - .isHttp11ProxyAvailable(isHttp11ProxyAvailable); + .outlierDetection(outlierDetection); } static Builder forLogicalDns(String clusterName, String dnsHostName, @Nullable ServerInfo lrsServerInfo, @Nullable Long maxConcurrentRequests, - @Nullable UpstreamTlsContext upstreamTlsContext, - boolean isHttp11ProxyAvailable) { + @Nullable UpstreamTlsContext upstreamTlsContext) { return newBuilder(clusterName) .clusterType(ClusterType.LOGICAL_DNS) .dnsHostName(dnsHostName) .lrsServerInfo(lrsServerInfo) .maxConcurrentRequests(maxConcurrentRequests) - .upstreamTlsContext(upstreamTlsContext) - .isHttp11ProxyAvailable(isHttp11ProxyAvailable); + .upstreamTlsContext(upstreamTlsContext); } enum ClusterType { @@ -745,8 +749,6 @@ Builder leastRequestLbPolicy(Integer choiceCount) { // Private, use one of the static factory methods instead. protected abstract Builder maxConcurrentRequests(Long maxConcurrentRequests); - protected abstract Builder isHttp11ProxyAvailable(boolean isHttp11ProxyAvailable); - // Private, use one of the static factory methods instead. protected abstract Builder upstreamTlsContext(UpstreamTlsContext upstreamTlsContext); diff --git a/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java b/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java index 11111fa51ca..6a3cd35bd59 100644 --- a/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java +++ b/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java @@ -20,14 +20,9 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableMap; -import com.google.common.net.InetAddresses; -import com.google.protobuf.Any; -import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Message; import io.envoyproxy.envoy.config.core.v3.Address; import io.envoyproxy.envoy.config.core.v3.HealthStatus; -import io.envoyproxy.envoy.config.core.v3.SocketAddress; import io.envoyproxy.envoy.config.endpoint.v3.ClusterLoadAssignment; import io.envoyproxy.envoy.config.endpoint.v3.Endpoint; import io.envoyproxy.envoy.type.v3.FractionalPercent; @@ -35,7 +30,6 @@ import io.grpc.internal.GrpcUtil; import io.grpc.xds.Endpoints.DropOverload; import io.grpc.xds.Endpoints.LocalityLbEndpoints; -import io.grpc.xds.MetadataRegistry.MetadataValueParser; import io.grpc.xds.XdsEndpointResource.EdsUpdate; import io.grpc.xds.client.Locality; import io.grpc.xds.client.XdsClient.ResourceUpdate; @@ -191,8 +185,7 @@ private static int getRatePerMillion(FractionalPercent percent) { @VisibleForTesting @Nullable static StructOrError parseLocalityLbEndpoints( - io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints proto) - throws ResourceInvalidException { + io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints proto) { // Filter out localities without or with 0 weight. if (!proto.hasLoadBalancingWeight() || proto.getLoadBalancingWeight().getValue() < 1) { return null; @@ -200,15 +193,6 @@ static StructOrError parseLocalityLbEndpoints( if (proto.getPriority() < 0) { return StructOrError.fromError("negative priority"); } - - ImmutableMap localityMetadata; - MetadataRegistry registry = MetadataRegistry.getInstance(); - try { - localityMetadata = registry.parseMetadata(proto.getMetadata()); - } catch (ResourceInvalidException e) { - throw new ResourceInvalidException("Failed to parse Locality Endpoint metadata: " - + e.getMessage(), e); - } List endpoints = new ArrayList<>(proto.getLbEndpointsCount()); for (io.envoyproxy.envoy.config.endpoint.v3.LbEndpoint endpoint : proto.getLbEndpointsList()) { // The endpoint field of each lb_endpoints must be set. @@ -216,13 +200,6 @@ static StructOrError parseLocalityLbEndpoints( if (!endpoint.hasEndpoint() || !endpoint.getEndpoint().hasAddress()) { return StructOrError.fromError("LbEndpoint with no endpoint/address"); } - ImmutableMap endpointMetadata; - try { - endpointMetadata = registry.parseMetadata(endpoint.getMetadata()); - } catch (ResourceInvalidException e) { - throw new ResourceInvalidException("Failed to parse Endpoint metadata: " - + e.getMessage(), e); - } List addresses = new ArrayList<>(); addresses.add(getInetSocketAddress(endpoint.getEndpoint().getAddress())); @@ -237,12 +214,10 @@ static StructOrError parseLocalityLbEndpoints( endpoints.add(Endpoints.LbEndpoint.create( new EquivalentAddressGroup(addresses), endpoint.getLoadBalancingWeight().getValue(), isHealthy, - endpoint.getEndpoint().getHostname(), - endpointMetadata)); + endpoint.getEndpoint().getHostname())); } return StructOrError.fromStruct(Endpoints.LocalityLbEndpoints.create( - endpoints, proto.getLoadBalancingWeight().getValue(), - proto.getPriority(), localityMetadata)); + endpoints, proto.getLoadBalancingWeight().getValue(), proto.getPriority())); } private static InetSocketAddress getInetSocketAddress(Address address) { @@ -295,47 +270,4 @@ public String toString() { .toString(); } } - - public static class AddressMetadataParser implements MetadataValueParser { - - @Override - public String getTypeUrl() { - return "type.googleapis.com/envoy.config.core.v3.Address"; - } - - @Override - public java.net.SocketAddress parse(Any any) throws ResourceInvalidException { - SocketAddress socketAddress; - try { - socketAddress = any.unpack(Address.class).getSocketAddress(); - } catch (InvalidProtocolBufferException ex) { - throw new ResourceInvalidException("Invalid Resource in address proto", ex); - } - validateAddress(socketAddress); - - String ip = socketAddress.getAddress(); - int port = socketAddress.getPortValue(); - - try { - return new InetSocketAddress(InetAddresses.forString(ip), port); - } catch (IllegalArgumentException e) { - throw createException("Invalid IP address or port: " + ip + ":" + port); - } - } - - private void validateAddress(SocketAddress socketAddress) throws ResourceInvalidException { - if (socketAddress.getAddress().isEmpty()) { - throw createException("Address field is empty or invalid."); - } - long port = Integer.toUnsignedLong(socketAddress.getPortValue()); - if (port > 65535) { - throw createException(String.format("Port value %d out of range 1-65535.", port)); - } - } - - private ResourceInvalidException createException(String message) { - return new ResourceInvalidException( - "Failed to parse envoy.config.core.v3.Address: " + message); - } - } } diff --git a/xds/src/test/java/io/grpc/xds/CdsLoadBalancer2Test.java b/xds/src/test/java/io/grpc/xds/CdsLoadBalancer2Test.java index 479bde76ce5..82a61e79abf 100644 --- a/xds/src/test/java/io/grpc/xds/CdsLoadBalancer2Test.java +++ b/xds/src/test/java/io/grpc/xds/CdsLoadBalancer2Test.java @@ -179,7 +179,7 @@ public void tearDown() { public void discoverTopLevelEdsCluster() { CdsUpdate update = CdsUpdate.forEds(CLUSTER, EDS_SERVICE_NAME, LRS_SERVER_INFO, 100L, upstreamTlsContext, - outlierDetection, false) + outlierDetection) .roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(CLUSTER, update); assertThat(childBalancers).hasSize(1); @@ -198,8 +198,7 @@ public void discoverTopLevelEdsCluster() { @Test public void discoverTopLevelLogicalDnsCluster() { CdsUpdate update = - CdsUpdate.forLogicalDns(CLUSTER, DNS_HOST_NAME, LRS_SERVER_INFO, 100L, upstreamTlsContext, - false) + CdsUpdate.forLogicalDns(CLUSTER, DNS_HOST_NAME, LRS_SERVER_INFO, 100L, upstreamTlsContext) .leastRequestLbPolicy(3).build(); xdsClient.deliverCdsUpdate(CLUSTER, update); assertThat(childBalancers).hasSize(1); @@ -233,7 +232,7 @@ public void nonAggregateCluster_resourceNotExist_returnErrorPicker() { @Test public void nonAggregateCluster_resourceUpdate() { CdsUpdate update = - CdsUpdate.forEds(CLUSTER, null, null, 100L, upstreamTlsContext, outlierDetection, false) + CdsUpdate.forEds(CLUSTER, null, null, 100L, upstreamTlsContext, outlierDetection) .roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(CLUSTER, update); assertThat(childBalancers).hasSize(1); @@ -244,7 +243,7 @@ public void nonAggregateCluster_resourceUpdate() { 100L, upstreamTlsContext, outlierDetection); update = CdsUpdate.forEds(CLUSTER, EDS_SERVICE_NAME, LRS_SERVER_INFO, 200L, null, - outlierDetection, false).roundRobinLbPolicy().build(); + outlierDetection).roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(CLUSTER, update); childLbConfig = (ClusterResolverConfig) childBalancer.config; instance = Iterables.getOnlyElement(childLbConfig.discoveryMechanisms); @@ -255,8 +254,7 @@ public void nonAggregateCluster_resourceUpdate() { @Test public void nonAggregateCluster_resourceRevoked() { CdsUpdate update = - CdsUpdate.forLogicalDns(CLUSTER, DNS_HOST_NAME, null, 100L, upstreamTlsContext, - false) + CdsUpdate.forLogicalDns(CLUSTER, DNS_HOST_NAME, null, 100L, upstreamTlsContext) .roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(CLUSTER, update); assertThat(childBalancers).hasSize(1); @@ -300,16 +298,16 @@ public void discoverAggregateCluster() { CLUSTER, cluster1, cluster2, cluster3, cluster4); assertThat(childBalancers).isEmpty(); CdsUpdate update3 = CdsUpdate.forEds(cluster3, EDS_SERVICE_NAME, LRS_SERVER_INFO, 200L, - upstreamTlsContext, outlierDetection, false).roundRobinLbPolicy().build(); + upstreamTlsContext, outlierDetection).roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster3, update3); assertThat(childBalancers).isEmpty(); CdsUpdate update2 = - CdsUpdate.forLogicalDns(cluster2, DNS_HOST_NAME, null, 100L, null, false) + CdsUpdate.forLogicalDns(cluster2, DNS_HOST_NAME, null, 100L, null) .roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster2, update2); assertThat(childBalancers).isEmpty(); CdsUpdate update4 = - CdsUpdate.forEds(cluster4, null, LRS_SERVER_INFO, 300L, null, outlierDetection, false) + CdsUpdate.forEds(cluster4, null, LRS_SERVER_INFO, 300L, null, outlierDetection) .roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster4, update4); assertThat(childBalancers).hasSize(1); // all non-aggregate clusters discovered @@ -364,11 +362,10 @@ public void aggregateCluster_descendantClustersRevoked() { xdsClient.deliverCdsUpdate(CLUSTER, update); assertThat(xdsClient.watchers.keySet()).containsExactly(CLUSTER, cluster1, cluster2); CdsUpdate update1 = CdsUpdate.forEds(cluster1, EDS_SERVICE_NAME, LRS_SERVER_INFO, 200L, - upstreamTlsContext, outlierDetection, false).roundRobinLbPolicy().build(); + upstreamTlsContext, outlierDetection).roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster1, update1); CdsUpdate update2 = - CdsUpdate.forLogicalDns(cluster2, DNS_HOST_NAME, LRS_SERVER_INFO, 100L, null, - false) + CdsUpdate.forLogicalDns(cluster2, DNS_HOST_NAME, LRS_SERVER_INFO, 100L, null) .roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster2, update2); FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers); @@ -415,11 +412,10 @@ public void aggregateCluster_rootClusterRevoked() { xdsClient.deliverCdsUpdate(CLUSTER, update); assertThat(xdsClient.watchers.keySet()).containsExactly(CLUSTER, cluster1, cluster2); CdsUpdate update1 = CdsUpdate.forEds(cluster1, EDS_SERVICE_NAME, LRS_SERVER_INFO, 200L, - upstreamTlsContext, outlierDetection, false).roundRobinLbPolicy().build(); + upstreamTlsContext, outlierDetection).roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster1, update1); CdsUpdate update2 = - CdsUpdate.forLogicalDns(cluster2, DNS_HOST_NAME, LRS_SERVER_INFO, 100L, null, - false) + CdsUpdate.forLogicalDns(cluster2, DNS_HOST_NAME, LRS_SERVER_INFO, 100L, null) .roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster2, update2); FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers); @@ -471,7 +467,7 @@ public void aggregateCluster_intermediateClusterChanges() { xdsClient.deliverCdsUpdate(cluster2, update2); assertThat(xdsClient.watchers.keySet()).containsExactly(CLUSTER, cluster2, cluster3); CdsUpdate update3 = CdsUpdate.forEds(cluster3, EDS_SERVICE_NAME, LRS_SERVER_INFO, 100L, - upstreamTlsContext, outlierDetection, false).roundRobinLbPolicy().build(); + upstreamTlsContext, outlierDetection).roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster3, update3); FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers); ClusterResolverConfig childLbConfig = (ClusterResolverConfig) childBalancer.config; @@ -522,7 +518,7 @@ public void aggregateCluster_withLoops() { reset(helper); CdsUpdate update3 = CdsUpdate.forEds(cluster3, EDS_SERVICE_NAME, LRS_SERVER_INFO, 100L, - upstreamTlsContext, outlierDetection, false).roundRobinLbPolicy().build(); + upstreamTlsContext, outlierDetection).roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster3, update3); verify(helper).updateBalancingState( eq(ConnectivityState.TRANSIENT_FAILURE), pickerCaptor.capture()); @@ -557,7 +553,7 @@ public void aggregateCluster_withLoops_afterEds() { .roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster2, update2); CdsUpdate update3 = CdsUpdate.forEds(cluster3, EDS_SERVICE_NAME, LRS_SERVER_INFO, 100L, - upstreamTlsContext, outlierDetection, false).roundRobinLbPolicy().build(); + upstreamTlsContext, outlierDetection).roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster3, update3); // cluster2 (aggr.) -> [cluster3 (EDS)] @@ -606,7 +602,7 @@ public void aggregateCluster_duplicateChildren() { // Define EDS cluster CdsUpdate update3 = CdsUpdate.forEds(cluster3, EDS_SERVICE_NAME, LRS_SERVER_INFO, 100L, - upstreamTlsContext, outlierDetection, false).roundRobinLbPolicy().build(); + upstreamTlsContext, outlierDetection).roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster3, update3); // cluster4 (agg) -> [cluster3 (EDS)] with dups (3 copies) @@ -653,8 +649,7 @@ public void aggregateCluster_discoveryErrorAfterChildLbCreated_propagateToChildL .roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(CLUSTER, update); CdsUpdate update1 = - CdsUpdate.forLogicalDns(cluster1, DNS_HOST_NAME, LRS_SERVER_INFO, 200L, null, - false) + CdsUpdate.forLogicalDns(cluster1, DNS_HOST_NAME, LRS_SERVER_INFO, 200L, null) .roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(cluster1, update1); FakeLoadBalancer childLb = Iterables.getOnlyElement(childBalancers); @@ -681,7 +676,7 @@ public void handleNameResolutionErrorFromUpstream_beforeChildLbCreated_returnErr @Test public void handleNameResolutionErrorFromUpstream_afterChildLbCreated_fallThrough() { CdsUpdate update = CdsUpdate.forEds(CLUSTER, EDS_SERVICE_NAME, LRS_SERVER_INFO, 100L, - upstreamTlsContext, outlierDetection, false).roundRobinLbPolicy().build(); + upstreamTlsContext, outlierDetection).roundRobinLbPolicy().build(); xdsClient.deliverCdsUpdate(CLUSTER, update); FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers); assertThat(childBalancer.shutdown).isFalse(); @@ -697,7 +692,7 @@ public void unknownLbProvider() { try { xdsClient.deliverCdsUpdate(CLUSTER, CdsUpdate.forEds(CLUSTER, EDS_SERVICE_NAME, LRS_SERVER_INFO, 100L, upstreamTlsContext, - outlierDetection, false) + outlierDetection) .lbPolicyConfig(ImmutableMap.of("unknownLb", ImmutableMap.of("foo", "bar"))).build()); } catch (Exception e) { assertThat(e).hasMessageThat().contains("unknownLb"); @@ -711,7 +706,7 @@ public void invalidLbConfig() { try { xdsClient.deliverCdsUpdate(CLUSTER, CdsUpdate.forEds(CLUSTER, EDS_SERVICE_NAME, LRS_SERVER_INFO, 100L, upstreamTlsContext, - outlierDetection, false).lbPolicyConfig( + outlierDetection).lbPolicyConfig( ImmutableMap.of("ring_hash_experimental", ImmutableMap.of("minRingSize", "-1"))) .build()); } catch (Exception e) { diff --git a/xds/src/test/java/io/grpc/xds/ClusterResolverLoadBalancerTest.java b/xds/src/test/java/io/grpc/xds/ClusterResolverLoadBalancerTest.java index 2ae05a7dbf3..2a8617912ea 100644 --- a/xds/src/test/java/io/grpc/xds/ClusterResolverLoadBalancerTest.java +++ b/xds/src/test/java/io/grpc/xds/ClusterResolverLoadBalancerTest.java @@ -36,7 +36,6 @@ import io.grpc.ChannelLogger; import io.grpc.ConnectivityState; import io.grpc.EquivalentAddressGroup; -import io.grpc.HttpConnectProxiedSocketAddress; import io.grpc.InsecureChannelCredentials; import io.grpc.LoadBalancer; import io.grpc.LoadBalancer.Helper; @@ -84,7 +83,6 @@ import io.grpc.xds.client.XdsClient; import io.grpc.xds.client.XdsResourceType; import io.grpc.xds.internal.security.CommonTlsContextTestsUtil; -import java.net.InetSocketAddress; import java.net.SocketAddress; import java.net.URI; import java.net.URISyntaxException; @@ -244,7 +242,7 @@ public void tearDown() { @Test public void edsClustersWithRingHashEndpointLbPolicy() { ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(edsDiscoveryMechanism1), ringHash, false); + Collections.singletonList(edsDiscoveryMechanism1), ringHash); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); assertThat(childBalancers).isEmpty(); @@ -256,18 +254,14 @@ public void edsClustersWithRingHashEndpointLbPolicy() { LocalityLbEndpoints localityLbEndpoints1 = LocalityLbEndpoints.create( Arrays.asList( - LbEndpoint.create(endpoint1, 0 /* loadBalancingWeight */, - true, "hostname1", ImmutableMap.of()), - LbEndpoint.create(endpoint2, 0 /* loadBalancingWeight */, - true, "hostname2", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + LbEndpoint.create(endpoint1, 0 /* loadBalancingWeight */, true, "hostname1"), + LbEndpoint.create(endpoint2, 0 /* loadBalancingWeight */, true, "hostname2")), + 10 /* localityWeight */, 1 /* priority */); LocalityLbEndpoints localityLbEndpoints2 = LocalityLbEndpoints.create( Collections.singletonList( - LbEndpoint.create( - endpoint3, 60 /* loadBalancingWeight */, true, - "hostname3", ImmutableMap.of())), - 50 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + LbEndpoint.create(endpoint3, 60 /* loadBalancingWeight */, true, "hostname3")), + 50 /* localityWeight */, 1 /* priority */); xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, ImmutableMap.of(locality1, localityLbEndpoints1, locality2, localityLbEndpoints2)); @@ -310,7 +304,7 @@ public void edsClustersWithRingHashEndpointLbPolicy() { @Test public void edsClustersWithLeastRequestEndpointLbPolicy() { ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(edsDiscoveryMechanism1), leastRequest, false); + Collections.singletonList(edsDiscoveryMechanism1), leastRequest); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); assertThat(childBalancers).isEmpty(); @@ -320,9 +314,8 @@ public void edsClustersWithLeastRequestEndpointLbPolicy() { LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints.create( Arrays.asList( - LbEndpoint.create(endpoint, 0 /* loadBalancingWeight */, true, - "hostname1", ImmutableMap.of())), - 100 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + LbEndpoint.create(endpoint, 0 /* loadBalancingWeight */, true, "hostname1")), + 100 /* localityWeight */, 1 /* priority */); xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, ImmutableMap.of(locality1, localityLbEndpoints)); @@ -357,7 +350,7 @@ public void edsClustersWithLeastRequestEndpointLbPolicy() { @Test public void edsClustersEndpointHostname_addedToAddressAttribute() { ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(edsDiscoveryMechanismWithOutlierDetection), leastRequest, false); + Collections.singletonList(edsDiscoveryMechanismWithOutlierDetection), leastRequest); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); assertThat(childBalancers).isEmpty(); @@ -367,9 +360,8 @@ public void edsClustersEndpointHostname_addedToAddressAttribute() { LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints.create( Arrays.asList( - LbEndpoint.create(endpoint, 0 /* loadBalancingWeight */, true, - "hostname1", ImmutableMap.of())), - 100 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + LbEndpoint.create(endpoint, 0 /* loadBalancingWeight */, true, "hostname1")), + 100 /* localityWeight */, 1 /* priority */); xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, ImmutableMap.of(locality1, localityLbEndpoints)); @@ -381,104 +373,11 @@ public void edsClustersEndpointHostname_addedToAddressAttribute() { .get(XdsAttributes.ATTR_ADDRESS_NAME)).isEqualTo("hostname1"); } - @Test - public void endpointAddressRewritten_whenProxyMetadataIsInEndpointMetadata() { - ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(edsDiscoveryMechanismWithOutlierDetection), leastRequest, true); - deliverLbConfig(config); - assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); - assertThat(childBalancers).isEmpty(); - - EquivalentAddressGroup endpoint = - new EquivalentAddressGroup(InetSocketAddress.createUnresolved("127.0.0.1", 8080)); - - // Proxy address in endpointMetadata (use FakeSocketAddress directly) - SocketAddress proxyAddress = new FakeSocketAddress("127.0.0.2"); - ImmutableMap endpointMetadata = - ImmutableMap.of("envoy.http11_proxy_transport_socket.proxy_address", proxyAddress); - - // No proxy in locality metadata - ImmutableMap localityMetadata = ImmutableMap.of(); - - LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints.create( - Arrays.asList( - LbEndpoint.create(endpoint, 0 /* loadBalancingWeight */, true, - "hostname1", endpointMetadata)), - 100 /* localityWeight */, 1 /* priority */, localityMetadata); - - xdsClient.deliverClusterLoadAssignment( - EDS_SERVICE_NAME1, - ImmutableMap.of(locality1, localityLbEndpoints)); - - assertThat(childBalancers).hasSize(1); - FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers); - - // Get the rewritten address - SocketAddress rewrittenAddress = - childBalancer.addresses.get(0).getAddresses().get(0); - assertThat(rewrittenAddress).isInstanceOf(HttpConnectProxiedSocketAddress.class); - HttpConnectProxiedSocketAddress proxiedSocket = - (HttpConnectProxiedSocketAddress) rewrittenAddress; - - // Assert that the target address is the original address - assertThat(proxiedSocket.getTargetAddress()) - .isEqualTo(endpoint.getAddresses().get(0)); - - // Assert that the proxy address is correctly set - assertThat(proxiedSocket.getProxyAddress()).isEqualTo(proxyAddress); - } - - @Test - public void endpointAddressRewritten_whenProxyMetadataIsInLocalityMetadata() { - ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(edsDiscoveryMechanismWithOutlierDetection), leastRequest, true); - deliverLbConfig(config); - assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); - assertThat(childBalancers).isEmpty(); - - EquivalentAddressGroup endpoint = - new EquivalentAddressGroup(InetSocketAddress.createUnresolved("127.0.0.2", 8080)); - - // No proxy in endpointMetadata - ImmutableMap endpointMetadata = ImmutableMap.of(); - - // Proxy address is now in localityMetadata - SocketAddress proxyAddress = new FakeSocketAddress("proxy-addr"); - ImmutableMap localityMetadata = - ImmutableMap.of("envoy.http11_proxy_transport_socket.proxy_address", proxyAddress); - - LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints.create( - Arrays.asList( - LbEndpoint.create(endpoint, 0 /* loadBalancingWeight */, true, - "hostname2", endpointMetadata)), - 100 /* localityWeight */, 1 /* priority */, localityMetadata); - - xdsClient.deliverClusterLoadAssignment( - EDS_SERVICE_NAME1, - ImmutableMap.of(locality1, localityLbEndpoints)); - - assertThat(childBalancers).hasSize(1); - FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers); - - // Get the rewritten address - SocketAddress rewrittenAddress = childBalancer.addresses.get(0).getAddresses().get(0); - - // Assert that the address was rewritten - assertThat(rewrittenAddress).isInstanceOf(HttpConnectProxiedSocketAddress.class); - HttpConnectProxiedSocketAddress proxiedSocket = - (HttpConnectProxiedSocketAddress) rewrittenAddress; - - // Assert that the target address is the original address - assertThat(proxiedSocket.getTargetAddress()).isEqualTo(endpoint.getAddresses().get(0)); - - // Assert that the proxy address is correctly set from locality metadata - assertThat(proxiedSocket.getProxyAddress()).isEqualTo(proxyAddress); - } @Test public void onlyEdsClusters_receivedEndpoints() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1, edsDiscoveryMechanism2), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1, edsDiscoveryMechanism2), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1, EDS_SERVICE_NAME2); assertThat(childBalancers).isEmpty(); @@ -492,21 +391,17 @@ public void onlyEdsClusters_receivedEndpoints() { LocalityLbEndpoints localityLbEndpoints1 = LocalityLbEndpoints.create( Arrays.asList( - LbEndpoint.create(endpoint1, 100, - true, "hostname1", ImmutableMap.of()), - LbEndpoint.create(endpoint2, 100, - true, "hostname1", ImmutableMap.of())), - 70 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + LbEndpoint.create(endpoint1, 100, true, "hostname1"), + LbEndpoint.create(endpoint2, 100, true, "hostname1")), + 70 /* localityWeight */, 1 /* priority */); LocalityLbEndpoints localityLbEndpoints2 = LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create(endpoint3, 100, true, - "hostname2", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + Collections.singletonList(LbEndpoint.create(endpoint3, 100, true, "hostname2")), + 10 /* localityWeight */, 1 /* priority */); LocalityLbEndpoints localityLbEndpoints3 = LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create(endpoint4, 100, true, - "hostname3", ImmutableMap.of())), - 20 /* localityWeight */, 2 /* priority */, ImmutableMap.of()); + Collections.singletonList(LbEndpoint.create(endpoint4, 100, true, "hostname3")), + 20 /* localityWeight */, 2 /* priority */); String priority1 = CLUSTER2 + "[child1]"; String priority2 = CLUSTER2 + "[child2]"; String priority3 = CLUSTER1 + "[child1]"; @@ -594,7 +489,7 @@ public void onlyEdsClusters_receivedEndpoints() { private void verifyEdsPriorityNames(List want, Map... updates) { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism2), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism2), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME2); assertThat(childBalancers).isEmpty(); @@ -660,17 +555,15 @@ locality2, createEndpoints(1) private LocalityLbEndpoints createEndpoints(int priority) { return LocalityLbEndpoints.create( Arrays.asList( - LbEndpoint.create(makeAddress("endpoint-addr-1"), 100, - true, "hostname1", ImmutableMap.of()), - LbEndpoint.create(makeAddress("endpoint-addr-2"), 100, - true, "hostname2", ImmutableMap.of())), - 70 /* localityWeight */, priority /* priority */, ImmutableMap.of()); + LbEndpoint.create(makeAddress("endpoint-addr-1"), 100, true, "hostname1"), + LbEndpoint.create(makeAddress("endpoint-addr-2"), 100, true, "hostname2")), + 70 /* localityWeight */, priority /* priority */); } @Test public void onlyEdsClusters_resourceNeverExist_returnErrorPicker() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1, edsDiscoveryMechanism2), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1, edsDiscoveryMechanism2), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1, EDS_SERVICE_NAME2); assertThat(childBalancers).isEmpty(); @@ -692,7 +585,7 @@ public void onlyEdsClusters_resourceNeverExist_returnErrorPicker() { @Test public void onlyEdsClusters_allResourcesRevoked_shutDownChildLbPolicy() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1, edsDiscoveryMechanism2), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1, edsDiscoveryMechanism2), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1, EDS_SERVICE_NAME2); assertThat(childBalancers).isEmpty(); @@ -701,14 +594,12 @@ public void onlyEdsClusters_allResourcesRevoked_shutDownChildLbPolicy() { EquivalentAddressGroup endpoint2 = makeAddress("endpoint-addr-2"); LocalityLbEndpoints localityLbEndpoints1 = LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create(endpoint1, 100, true, - "hostname1", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + Collections.singletonList(LbEndpoint.create(endpoint1, 100, true, "hostname1")), + 10 /* localityWeight */, 1 /* priority */); LocalityLbEndpoints localityLbEndpoints2 = LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create(endpoint2, 100, true, - "hostname2", ImmutableMap.of())), - 20 /* localityWeight */, 2 /* priority */, ImmutableMap.of()); + Collections.singletonList(LbEndpoint.create(endpoint2, 100, true, "hostname2")), + 20 /* localityWeight */, 2 /* priority */); xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, Collections.singletonMap(locality1, localityLbEndpoints1)); xdsClient.deliverClusterLoadAssignment( @@ -729,19 +620,17 @@ public void onlyEdsClusters_allResourcesRevoked_shutDownChildLbPolicy() { @Test public void handleEdsResource_ignoreUnhealthyEndpoints() { - ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(edsDiscoveryMechanism1), roundRobin, false); + ClusterResolverConfig config = + new ClusterResolverConfig(Collections.singletonList(edsDiscoveryMechanism1), roundRobin); deliverLbConfig(config); EquivalentAddressGroup endpoint1 = makeAddress("endpoint-addr-1"); EquivalentAddressGroup endpoint2 = makeAddress("endpoint-addr-2"); LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints.create( Arrays.asList( - LbEndpoint.create(endpoint1, 100, false /* isHealthy */, - "hostname1", ImmutableMap.of()), - LbEndpoint.create(endpoint2, 100, true /* isHealthy */, - "hostname2", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + LbEndpoint.create(endpoint1, 100, false /* isHealthy */, "hostname1"), + LbEndpoint.create(endpoint2, 100, true /* isHealthy */, "hostname2")), + 10 /* localityWeight */, 1 /* priority */); xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, Collections.singletonMap(locality1, localityLbEndpoints)); FakeLoadBalancer childBalancer = Iterables.getOnlyElement(childBalancers); @@ -751,21 +640,21 @@ public void handleEdsResource_ignoreUnhealthyEndpoints() { @Test public void handleEdsResource_ignoreLocalitiesWithNoHealthyEndpoints() { - ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(edsDiscoveryMechanism1), roundRobin, false); + ClusterResolverConfig config = + new ClusterResolverConfig(Collections.singletonList(edsDiscoveryMechanism1), roundRobin); deliverLbConfig(config); EquivalentAddressGroup endpoint1 = makeAddress("endpoint-addr-1"); EquivalentAddressGroup endpoint2 = makeAddress("endpoint-addr-2"); LocalityLbEndpoints localityLbEndpoints1 = LocalityLbEndpoints.create( Collections.singletonList(LbEndpoint.create(endpoint1, 100, false /* isHealthy */, - "hostname1", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + "hostname1")), + 10 /* localityWeight */, 1 /* priority */); LocalityLbEndpoints localityLbEndpoints2 = LocalityLbEndpoints.create( Collections.singletonList(LbEndpoint.create(endpoint2, 100, true /* isHealthy */, - "hostname2", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + "hostname2")), + 10 /* localityWeight */, 1 /* priority */); xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, ImmutableMap.of(locality1, localityLbEndpoints1, locality2, localityLbEndpoints2)); @@ -778,21 +667,21 @@ public void handleEdsResource_ignoreLocalitiesWithNoHealthyEndpoints() { @Test public void handleEdsResource_ignorePrioritiesWithNoHealthyEndpoints() { - ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(edsDiscoveryMechanism1), roundRobin, false); + ClusterResolverConfig config = + new ClusterResolverConfig(Collections.singletonList(edsDiscoveryMechanism1), roundRobin); deliverLbConfig(config); EquivalentAddressGroup endpoint1 = makeAddress("endpoint-addr-1"); EquivalentAddressGroup endpoint2 = makeAddress("endpoint-addr-2"); LocalityLbEndpoints localityLbEndpoints1 = LocalityLbEndpoints.create( Collections.singletonList(LbEndpoint.create(endpoint1, 100, false /* isHealthy */, - "hostname1", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + "hostname1")), + 10 /* localityWeight */, 1 /* priority */); LocalityLbEndpoints localityLbEndpoints2 = LocalityLbEndpoints.create( Collections.singletonList(LbEndpoint.create(endpoint2, 200, true /* isHealthy */, - "hostname2", ImmutableMap.of())), - 10 /* localityWeight */, 2 /* priority */, ImmutableMap.of()); + "hostname2")), + 10 /* localityWeight */, 2 /* priority */); String priority2 = CLUSTER1 + "[child2]"; xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, @@ -804,15 +693,15 @@ public void handleEdsResource_ignorePrioritiesWithNoHealthyEndpoints() { @Test public void handleEdsResource_noHealthyEndpoint() { - ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(edsDiscoveryMechanism1), roundRobin, false); + ClusterResolverConfig config = + new ClusterResolverConfig(Collections.singletonList(edsDiscoveryMechanism1), roundRobin); deliverLbConfig(config); EquivalentAddressGroup endpoint = makeAddress("endpoint-addr-1"); LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints.create( Collections.singletonList(LbEndpoint.create(endpoint, 100, false /* isHealthy */, - "hostname1", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + "hostname1")), + 10 /* localityWeight */, 1 /* priority */); xdsClient.deliverClusterLoadAssignment(EDS_SERVICE_NAME1, Collections.singletonMap(locality1, localityLbEndpoints)); // single endpoint, unhealthy @@ -840,7 +729,7 @@ public void oldListenerCallback_onlyLogicalDnsCluster_endpointsResolved() { void do_onlyLogicalDnsCluster_endpointsResolved() { ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(logicalDnsDiscoveryMechanism), roundRobin, false); + Collections.singletonList(logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); FakeNameResolver resolver = assertResolverCreated("/" + DNS_HOST_NAME); assertThat(childBalancers).isEmpty(); @@ -872,7 +761,7 @@ void do_onlyLogicalDnsCluster_endpointsResolved() { @Test public void onlyLogicalDnsCluster_handleRefreshNameResolution() { ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(logicalDnsDiscoveryMechanism), roundRobin, false); + Collections.singletonList(logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); FakeNameResolver resolver = assertResolverCreated("/" + DNS_HOST_NAME); assertThat(childBalancers).isEmpty(); @@ -901,7 +790,7 @@ void do_onlyLogicalDnsCluster_resolutionError_backoffAndRefresh() { InOrder inOrder = Mockito.inOrder(helper, backoffPolicyProvider, backoffPolicy1, backoffPolicy2); ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(logicalDnsDiscoveryMechanism), roundRobin, false); + Collections.singletonList(logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); FakeNameResolver resolver = assertResolverCreated("/" + DNS_HOST_NAME); assertThat(childBalancers).isEmpty(); @@ -947,7 +836,7 @@ void do_onlyLogicalDnsCluster_resolutionError_backoffAndRefresh() { public void onlyLogicalDnsCluster_refreshNameResolutionRaceWithResolutionError() { InOrder inOrder = Mockito.inOrder(backoffPolicyProvider, backoffPolicy1, backoffPolicy2); ClusterResolverConfig config = new ClusterResolverConfig( - Collections.singletonList(logicalDnsDiscoveryMechanism), roundRobin, false); + Collections.singletonList(logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); FakeNameResolver resolver = assertResolverCreated("/" + DNS_HOST_NAME); assertThat(childBalancers).isEmpty(); @@ -985,7 +874,7 @@ public void onlyLogicalDnsCluster_refreshNameResolutionRaceWithResolutionError() @Test public void edsClustersAndLogicalDnsCluster_receivedEndpoints() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); FakeNameResolver resolver = assertResolverCreated("/" + DNS_HOST_NAME); @@ -996,9 +885,8 @@ public void edsClustersAndLogicalDnsCluster_receivedEndpoints() { resolver.deliverEndpointAddresses(Arrays.asList(endpoint1, endpoint2)); LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create(endpoint3, 100, true, - "hostname3", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + Collections.singletonList(LbEndpoint.create(endpoint3, 100, true, "hostname3")), + 10 /* localityWeight */, 1 /* priority */); xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, Collections.singletonMap(locality1, localityLbEndpoints)); @@ -1021,7 +909,7 @@ public void edsClustersAndLogicalDnsCluster_receivedEndpoints() { @Test public void noEdsResourceExists_useDnsResolutionResults() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); FakeNameResolver resolver = assertResolverCreated("/" + DNS_HOST_NAME); @@ -1045,7 +933,7 @@ public void noEdsResourceExists_useDnsResolutionResults() { @Test public void edsResourceRevoked_dnsResolutionError_shutDownChildLbPolicyAndReturnErrorPicker() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); FakeNameResolver resolver = assertResolverCreated("/" + DNS_HOST_NAME); @@ -1054,9 +942,8 @@ public void edsResourceRevoked_dnsResolutionError_shutDownChildLbPolicyAndReturn EquivalentAddressGroup endpoint = makeAddress("endpoint-addr-1"); LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create(endpoint, 100, true, - "hostname1", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + Collections.singletonList(LbEndpoint.create(endpoint, 100, true, "hostname1")), + 10 /* localityWeight */, 1 /* priority */); xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, Collections.singletonMap(locality1, localityLbEndpoints)); resolver.deliverError(Status.UNKNOWN.withDescription("I am lost")); @@ -1077,7 +964,7 @@ public void edsResourceRevoked_dnsResolutionError_shutDownChildLbPolicyAndReturn @Test public void resolutionErrorAfterChildLbCreated_propagateErrorIfAllClustersEncounterError() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); FakeNameResolver resolver = assertResolverCreated("/" + DNS_HOST_NAME); @@ -1086,9 +973,8 @@ public void resolutionErrorAfterChildLbCreated_propagateErrorIfAllClustersEncoun EquivalentAddressGroup endpoint = makeAddress("endpoint-addr-1"); LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create(endpoint, 100, true, - "hostname1", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + Collections.singletonList(LbEndpoint.create(endpoint, 100, true, "hostname1")), + 10 /* localityWeight */, 1 /* priority */); xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, Collections.singletonMap(locality1, localityLbEndpoints)); assertThat(childBalancers).isEmpty(); // not created until all clusters resolved. @@ -1113,7 +999,7 @@ public void resolutionErrorAfterChildLbCreated_propagateErrorIfAllClustersEncoun @Test public void resolutionErrorBeforeChildLbCreated_returnErrorPickerIfAllClustersEncounterError() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); FakeNameResolver resolver = assertResolverCreated("/" + DNS_HOST_NAME); @@ -1136,7 +1022,7 @@ public void resolutionErrorBeforeChildLbCreated_returnErrorPickerIfAllClustersEn @Test public void resolutionErrorBeforeChildLbCreated_edsOnly_returnErrorPicker() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); assertThat(childBalancers).isEmpty(); @@ -1154,7 +1040,7 @@ public void resolutionErrorBeforeChildLbCreated_edsOnly_returnErrorPicker() { @Test public void handleNameResolutionErrorFromUpstream_beforeChildLbCreated_returnErrorPicker() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); assertResolverCreated("/" + DNS_HOST_NAME); @@ -1170,7 +1056,7 @@ public void handleNameResolutionErrorFromUpstream_beforeChildLbCreated_returnErr @Test public void handleNameResolutionErrorFromUpstream_afterChildLbCreated_fallThrough() { ClusterResolverConfig config = new ClusterResolverConfig( - Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin, false); + Arrays.asList(edsDiscoveryMechanism1, logicalDnsDiscoveryMechanism), roundRobin); deliverLbConfig(config); assertThat(xdsClient.watchers.keySet()).containsExactly(EDS_SERVICE_NAME1); FakeNameResolver resolver = assertResolverCreated("/" + DNS_HOST_NAME); @@ -1180,9 +1066,8 @@ public void handleNameResolutionErrorFromUpstream_afterChildLbCreated_fallThroug EquivalentAddressGroup endpoint2 = makeAddress("endpoint-addr-2"); LocalityLbEndpoints localityLbEndpoints = LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create(endpoint1, 100, true, - "hostname1", ImmutableMap.of())), - 10 /* localityWeight */, 1 /* priority */, ImmutableMap.of()); + Collections.singletonList(LbEndpoint.create(endpoint1, 100, true, "hostname1")), + 10 /* localityWeight */, 1 /* priority */); xdsClient.deliverClusterLoadAssignment( EDS_SERVICE_NAME1, Collections.singletonMap(locality1, localityLbEndpoints)); resolver.deliverEndpointAddresses(Collections.singletonList(endpoint2)); @@ -1256,37 +1141,37 @@ private static void assertAddressesEqual( } private static EquivalentAddressGroup makeAddress(final String name) { - return new EquivalentAddressGroup(new FakeSocketAddress(name)); - } - - static class FakeSocketAddress extends SocketAddress { - private final String name; + class FakeSocketAddress extends SocketAddress { + private final String name; - private FakeSocketAddress(String name) { - this.name = name; - } + private FakeSocketAddress(String name) { + this.name = name; + } - @Override - public int hashCode() { - return Objects.hash(name); - } + @Override + public int hashCode() { + return Objects.hash(name); + } - @Override - public boolean equals(Object o) { - if (this == o) { - return true; + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (!(o instanceof FakeSocketAddress)) { + return false; + } + FakeSocketAddress that = (FakeSocketAddress) o; + return Objects.equals(name, that.name); } - if (!(o instanceof FakeSocketAddress)) { - return false; + + @Override + public String toString() { + return name; } - FakeSocketAddress that = (FakeSocketAddress) o; - return Objects.equals(name, that.name); } - @Override - public String toString() { - return name; - } + return new EquivalentAddressGroup(new FakeSocketAddress(name)); } private static final class FakeXdsClient extends XdsClient { diff --git a/xds/src/test/java/io/grpc/xds/GrpcXdsClientImplDataTest.java b/xds/src/test/java/io/grpc/xds/GrpcXdsClientImplDataTest.java index 7fac666f983..610d147ccf9 100644 --- a/xds/src/test/java/io/grpc/xds/GrpcXdsClientImplDataTest.java +++ b/xds/src/test/java/io/grpc/xds/GrpcXdsClientImplDataTest.java @@ -18,7 +18,6 @@ import static com.google.common.truth.Truth.assertThat; import static io.envoyproxy.envoy.config.route.v3.RouteAction.ClusterSpecifierCase.CLUSTER_SPECIFIER_PLUGIN; -import static io.grpc.xds.XdsClusterResource.TRANSPORT_SOCKET_NAME_HTTP11_PROXY; import static io.grpc.xds.XdsEndpointResource.GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS; import static org.junit.Assert.fail; @@ -94,7 +93,6 @@ import io.envoyproxy.envoy.extensions.filters.network.http_connection_manager.v3.Rds; import io.envoyproxy.envoy.extensions.load_balancing_policies.client_side_weighted_round_robin.v3.ClientSideWeightedRoundRobin; import io.envoyproxy.envoy.extensions.load_balancing_policies.wrr_locality.v3.WrrLocality; -import io.envoyproxy.envoy.extensions.transport_sockets.http_11_proxy.v3.Http11ProxyUpstreamTransport; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateProviderPluginInstance; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateValidationContext; import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext; @@ -1057,7 +1055,7 @@ public void parseClusterWeight() { } @Test - public void parseLocalityLbEndpoints_withHealthyEndpoints() throws ResourceInvalidException { + public void parseLocalityLbEndpoints_withHealthyEndpoints() { io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints proto = io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints.newBuilder() .setLocality(Locality.newBuilder() @@ -1077,14 +1075,12 @@ public void parseLocalityLbEndpoints_withHealthyEndpoints() throws ResourceInval assertThat(struct.getErrorDetail()).isNull(); assertThat(struct.getStruct()).isEqualTo( LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create("172.14.14.5", 8888, - 20, true, "", ImmutableMap.of())), - 100, 1, ImmutableMap.of())); + Collections.singletonList(LbEndpoint.create("172.14.14.5", 8888, 20, true, "")), + 100, 1)); } @Test - public void parseLocalityLbEndpoints_treatUnknownHealthAsHealthy() - throws ResourceInvalidException { + public void parseLocalityLbEndpoints_treatUnknownHealthAsHealthy() { io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints proto = io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints.newBuilder() .setLocality(Locality.newBuilder() @@ -1104,13 +1100,12 @@ public void parseLocalityLbEndpoints_treatUnknownHealthAsHealthy() assertThat(struct.getErrorDetail()).isNull(); assertThat(struct.getStruct()).isEqualTo( LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create("172.14.14.5", 8888, - 20, true, "", ImmutableMap.of())), - 100, 1, ImmutableMap.of())); + Collections.singletonList(LbEndpoint.create("172.14.14.5", 8888, 20, true, "")), 100, + 1)); } @Test - public void parseLocalityLbEndpoints_withUnHealthyEndpoints() throws ResourceInvalidException { + public void parseLocalityLbEndpoints_withUnHealthyEndpoints() { io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints proto = io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints.newBuilder() .setLocality(Locality.newBuilder() @@ -1130,13 +1125,12 @@ public void parseLocalityLbEndpoints_withUnHealthyEndpoints() throws ResourceInv assertThat(struct.getErrorDetail()).isNull(); assertThat(struct.getStruct()).isEqualTo( LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create("172.14.14.5", 8888, 20, - false, "", ImmutableMap.of())), - 100, 1, ImmutableMap.of())); + Collections.singletonList(LbEndpoint.create("172.14.14.5", 8888, 20, false, "")), 100, + 1)); } @Test - public void parseLocalityLbEndpoints_ignorZeroWeightLocality() throws ResourceInvalidException { + public void parseLocalityLbEndpoints_ignorZeroWeightLocality() { io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints proto = io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints.newBuilder() .setLocality(Locality.newBuilder() @@ -1193,10 +1187,7 @@ public void parseLocalityLbEndpoints_withDualStackEndpoints() { EquivalentAddressGroup expectedEag = new EquivalentAddressGroup(socketAddressList); assertThat(struct.getStruct()).isEqualTo( LocalityLbEndpoints.create( - Collections.singletonList(LbEndpoint.create( - expectedEag, 20, true, "", ImmutableMap.of())), 100, 1, ImmutableMap.of())); - } catch (ResourceInvalidException e) { - throw new RuntimeException(e); + Collections.singletonList(LbEndpoint.create(expectedEag, 20, true, "")), 100, 1)); } finally { if (originalDualStackProp != null) { System.setProperty(GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS, originalDualStackProp); @@ -1207,7 +1198,7 @@ public void parseLocalityLbEndpoints_withDualStackEndpoints() { } @Test - public void parseLocalityLbEndpoints_invalidPriority() throws ResourceInvalidException { + public void parseLocalityLbEndpoints_invalidPriority() { io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints proto = io.envoyproxy.envoy.config.endpoint.v3.LocalityLbEndpoints.newBuilder() .setLocality(Locality.newBuilder() @@ -2465,59 +2456,6 @@ public void processCluster_parsesAudienceMetadata() assertThat(update.parsedMetadata()).isEqualTo(expectedParsedMetadata); } - @Test - public void processCluster_parsesAddressMetadata() throws Exception { - - // Create an Address message - Address address = Address.newBuilder() - .setSocketAddress(SocketAddress.newBuilder() - .setAddress("192.168.1.1") - .setPortValue(8080) - .build()) - .build(); - - // Wrap the Address in Any - Any addressMetadata = Any.newBuilder() - .setTypeUrl("type.googleapis.com/envoy.config.core.v3.Address") - .setValue(address.toByteString()) - .build(); - - Struct filterMetadata = Struct.newBuilder() - .putFields("key1", Value.newBuilder().setStringValue("value1").build()) - .putFields("key2", Value.newBuilder().setNumberValue(42).build()) - .build(); - - Metadata metadata = Metadata.newBuilder() - .putTypedFilterMetadata("ADDRESS_METADATA", addressMetadata) - .putFilterMetadata("FILTER_METADATA", filterMetadata) - .build(); - - Cluster cluster = Cluster.newBuilder() - .setName("cluster-foo.googleapis.com") - .setType(DiscoveryType.EDS) - .setEdsClusterConfig( - EdsClusterConfig.newBuilder() - .setEdsConfig( - ConfigSource.newBuilder() - .setAds(AggregatedConfigSource.getDefaultInstance())) - .setServiceName("service-foo.googleapis.com")) - .setLbPolicy(LbPolicy.ROUND_ROBIN) - .setMetadata(metadata) - .build(); - - CdsUpdate update = XdsClusterResource.processCluster( - cluster, null, LRS_SERVER_INFO, - LoadBalancerRegistry.getDefaultRegistry()); - - ImmutableMap expectedParsedMetadata = ImmutableMap.of( - "ADDRESS_METADATA", new InetSocketAddress("192.168.1.1", 8080), - "FILTER_METADATA", ImmutableMap.of( - "key1", "value1", - "key2", 42.0)); - - assertThat(update.parsedMetadata()).isEqualTo(expectedParsedMetadata); - } - @Test public void processCluster_metadataKeyCollision_resolvesToTypedMetadata() throws ResourceInvalidException, InvalidProtocolBufferException { @@ -2574,40 +2512,6 @@ public Object parse(Any value) { metadataRegistry.removeParser(testParser); } - @Test - public void parseNonAggregateCluster_withHttp11ProxyTransportSocket() - throws ResourceInvalidException, InvalidProtocolBufferException { - XdsClusterResource.isEnabledXdsHttpConnect = true; - - Http11ProxyUpstreamTransport http11ProxyUpstreamTransport = - Http11ProxyUpstreamTransport.newBuilder() - .setTransportSocket(TransportSocket.getDefaultInstance()) - .build(); - - TransportSocket transportSocket = TransportSocket.newBuilder() - .setName(TRANSPORT_SOCKET_NAME_HTTP11_PROXY) - .setTypedConfig(Any.pack(http11ProxyUpstreamTransport)) - .build(); - - Cluster cluster = Cluster.newBuilder() - .setName("cluster-http11-proxy.googleapis.com") - .setType(DiscoveryType.EDS) - .setEdsClusterConfig( - EdsClusterConfig.newBuilder() - .setEdsConfig( - ConfigSource.newBuilder().setAds(AggregatedConfigSource.getDefaultInstance())) - .setServiceName("service-http11-proxy.googleapis.com")) - .setLbPolicy(LbPolicy.ROUND_ROBIN) - .setTransportSocket(transportSocket) - .build(); - - CdsUpdate result = - XdsClusterResource.processCluster(cluster, null, LRS_SERVER_INFO, - LoadBalancerRegistry.getDefaultRegistry()); - - assertThat(result).isNotNull(); - assertThat(result.isHttp11ProxyAvailable()).isTrue(); - } @Test public void parseServerSideListener_invalidTrafficDirection() throws ResourceInvalidException { diff --git a/xds/src/test/java/io/grpc/xds/GrpcXdsClientImplTestBase.java b/xds/src/test/java/io/grpc/xds/GrpcXdsClientImplTestBase.java index 51c07cb3537..00fbfe669af 100644 --- a/xds/src/test/java/io/grpc/xds/GrpcXdsClientImplTestBase.java +++ b/xds/src/test/java/io/grpc/xds/GrpcXdsClientImplTestBase.java @@ -607,9 +607,9 @@ private void validateGoldenClusterLoadAssignment(EdsUpdate edsUpdate) { Locality.create("region1", "zone1", "subzone1"), LocalityLbEndpoints.create( ImmutableList.of(LbEndpoint.create("192.168.0.1", 8080, 2, true, - "endpoint-host-name", ImmutableMap.of())), 1, 0, ImmutableMap.of()), + "endpoint-host-name")), 1, 0), Locality.create("region3", "zone3", "subzone3"), - LocalityLbEndpoints.create(ImmutableList.of(), 2, 1, ImmutableMap.of())); + LocalityLbEndpoints.create(ImmutableList.of(), 2, 1)); } /** @@ -3246,9 +3246,7 @@ public void edsResourceUpdated() { Locality.create("region2", "zone2", "subzone2"), LocalityLbEndpoints.create( ImmutableList.of( - LbEndpoint.create("172.44.2.2", 8000, 3, - true, "endpoint-host-name", ImmutableMap.of())), - 2, 0, ImmutableMap.of())); + LbEndpoint.create("172.44.2.2", 8000, 3, true, "endpoint-host-name")), 2, 0)); verifyResourceMetadataAcked(EDS, EDS_RESOURCE, updatedClusterLoadAssignment, VERSION_2, TIME_INCREMENT * 2); verifySubscribedResourcesMetadataSizes(0, 0, 0, 1); @@ -3418,9 +3416,7 @@ public void multipleEdsWatchers() { Locality.create("region2", "zone2", "subzone2"), LocalityLbEndpoints.create( ImmutableList.of( - LbEndpoint.create("172.44.2.2", 8000, 3, - true, "endpoint-host-name", ImmutableMap.of())), - 2, 0, ImmutableMap.of())); + LbEndpoint.create("172.44.2.2", 8000, 3, true, "endpoint-host-name")), 2, 0)); verify(watcher2).onChanged(edsUpdateCaptor.capture()); edsUpdate = edsUpdateCaptor.getValue(); assertThat(edsUpdate.clusterName).isEqualTo(edsResourceTwo); @@ -3430,9 +3426,7 @@ public void multipleEdsWatchers() { Locality.create("region2", "zone2", "subzone2"), LocalityLbEndpoints.create( ImmutableList.of( - LbEndpoint.create("172.44.2.2", 8000, 3, - true, "endpoint-host-name", ImmutableMap.of())), - 2, 0, ImmutableMap.of())); + LbEndpoint.create("172.44.2.2", 8000, 3, true, "endpoint-host-name")), 2, 0)); verifyNoMoreInteractions(edsResourceWatcher); verifyResourceMetadataAcked( EDS, edsResourceTwo, clusterLoadAssignmentTwo, VERSION_2, TIME_INCREMENT * 2); diff --git a/xds/src/test/java/io/grpc/xds/XdsTestUtils.java b/xds/src/test/java/io/grpc/xds/XdsTestUtils.java index d0580ae2667..ea28734ec6a 100644 --- a/xds/src/test/java/io/grpc/xds/XdsTestUtils.java +++ b/xds/src/test/java/io/grpc/xds/XdsTestUtils.java @@ -257,17 +257,17 @@ static XdsConfig getDefaultXdsConfig(String serverHostName) // Need to create endpoints to create locality endpoints map to create edsUpdate Map lbEndpointsMap = new HashMap<>(); - LbEndpoint lbEndpoint = LbEndpoint.create( - serverHostName, ENDPOINT_PORT, 0, true, ENDPOINT_HOSTNAME, ImmutableMap.of()); + LbEndpoint lbEndpoint = + LbEndpoint.create(serverHostName, ENDPOINT_PORT, 0, true, ENDPOINT_HOSTNAME); lbEndpointsMap.put( Locality.create("", "", ""), - LocalityLbEndpoints.create(ImmutableList.of(lbEndpoint), 10, 0, ImmutableMap.of())); + LocalityLbEndpoints.create(ImmutableList.of(lbEndpoint), 10, 0)); // Need to create EdsUpdate to create CdsUpdate to create XdsClusterConfig for builder XdsEndpointResource.EdsUpdate edsUpdate = new XdsEndpointResource.EdsUpdate( EDS_NAME, lbEndpointsMap, Collections.emptyList()); XdsClusterResource.CdsUpdate cdsUpdate = XdsClusterResource.CdsUpdate.forEds( - CLUSTER_NAME, EDS_NAME, serverInfo, null, null, null, false) + CLUSTER_NAME, EDS_NAME, serverInfo, null, null, null) .lbPolicyConfig(getWrrLbConfigAsMap()).build(); XdsConfig.XdsClusterConfig clusterConfig = new XdsConfig.XdsClusterConfig( CLUSTER_NAME, cdsUpdate, new EndpointConfig(StatusOr.fromValue(edsUpdate))); diff --git a/xds/third_party/envoy/import.sh b/xds/third_party/envoy/import.sh index 7a6b33871b3..dbe6f81b1a8 100755 --- a/xds/third_party/envoy/import.sh +++ b/xds/third_party/envoy/import.sh @@ -86,7 +86,6 @@ envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.proto envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.proto envoy/extensions/load_balancing_policies/round_robin/v3/round_robin.proto envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.proto -envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto envoy/extensions/transport_sockets/tls/v3/cert.proto envoy/extensions/transport_sockets/tls/v3/common.proto envoy/extensions/transport_sockets/tls/v3/secret.proto diff --git a/xds/third_party/envoy/src/main/proto/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto b/xds/third_party/envoy/src/main/proto/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto deleted file mode 100644 index 2c9b5333f41..00000000000 --- a/xds/third_party/envoy/src/main/proto/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto +++ /dev/null @@ -1,38 +0,0 @@ -syntax = "proto3"; - -package envoy.extensions.transport_sockets.http_11_proxy.v3; - -import "envoy/config/core/v3/base.proto"; - -import "udpa/annotations/status.proto"; - -option java_package = "io.envoyproxy.envoy.extensions.transport_sockets.http_11_proxy.v3"; -option java_outer_classname = "UpstreamHttp11ConnectProto"; -option java_multiple_files = true; -option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3;http_11_proxyv3"; -option (udpa.annotations.file_status).package_version_status = ACTIVE; - -// [#protodoc-title: Upstream HTTP/1.1 Proxy] -// [#extension: envoy.transport_sockets.http_11_proxy] - -// HTTP/1.1 proxy transport socket establishes an upstream connection to a proxy address -// instead of the target host's address. This behavior is triggered when the transport -// socket is configured and proxy information is provided. -// -// Behavior when proxying: -// ======================= -// When an upstream connection is established, instead of connecting directly to the endpoint -// address, the client will connect to the specified proxy address, send an HTTP/1.1 ``CONNECT`` request -// indicating the endpoint address, and process the response. If the response has HTTP status 200, -// the connection will be passed down to the underlying transport socket. -// -// Configuring proxy information: -// ============================== -// Set ``typed_filter_metadata`` in :ref:`LbEndpoint.Metadata ` or :ref:`LocalityLbEndpoints.Metadata `. -// using the key ``envoy.http11_proxy_transport_socket.proxy_address`` and the -// proxy address in ``config::core::v3::Address`` format. -// -message Http11ProxyUpstreamTransport { - // The underlying transport socket being wrapped. Defaults to plaintext (raw_buffer) if unset. - config.core.v3.TransportSocket transport_socket = 1; -}