|
40 | 40 | import io.envoyproxy.envoy.extensions.transport_sockets.http_11_proxy.v3.Http11ProxyUpstreamTransport; |
41 | 41 | import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CertificateValidationContext; |
42 | 42 | import io.envoyproxy.envoy.extensions.transport_sockets.tls.v3.CommonTlsContext; |
| 43 | +import io.grpc.InternalLogId; |
43 | 44 | import io.grpc.LoadBalancerRegistry; |
44 | 45 | import io.grpc.NameResolver; |
45 | 46 | import io.grpc.internal.GrpcUtil; |
|
50 | 51 | import io.grpc.xds.XdsClusterResource.CdsUpdate; |
51 | 52 | import io.grpc.xds.client.BackendMetricPropagation; |
52 | 53 | import io.grpc.xds.client.XdsClient.ResourceUpdate; |
| 54 | +import io.grpc.xds.client.XdsLogger; |
| 55 | +import io.grpc.xds.client.XdsLogger.XdsLogLevel; |
53 | 56 | import io.grpc.xds.client.XdsResourceType; |
54 | 57 | import io.grpc.xds.internal.security.CommonTlsContextUtil; |
55 | 58 | import java.util.List; |
@@ -87,6 +90,8 @@ class XdsClusterResource extends XdsResourceType<CdsUpdate> { |
87 | 90 | "type.googleapis.com/envoy.extensions.transport_sockets.raw_buffer.v3.RawBuffer"; |
88 | 91 | private final LoadBalancerRegistry loadBalancerRegistry |
89 | 92 | = LoadBalancerRegistry.getDefaultRegistry(); |
| 93 | + private static final XdsLogger logger = XdsLogger.withLogId( |
| 94 | + InternalLogId.allocate("xds-cluster-resource", "sergiitk")); |
90 | 95 |
|
91 | 96 | private static final XdsClusterResource instance = new XdsClusterResource(); |
92 | 97 |
|
@@ -266,17 +271,23 @@ private static StructOrError<CdsUpdate.Builder> parseNonAggregateCluster( |
266 | 271 | String transportSocketName = hasTransportSocket ? transportSocket.getName() : "<invalid>"; |
267 | 272 | boolean socketIsTls = transportSocketName.equals(TRANSPORT_SOCKET_NAME_TLS); |
268 | 273 | boolean socketIsH1Proxy = transportSocketName.equals(TRANSPORT_SOCKET_NAME_HTTP11_PROXY); |
269 | | - boolean supportSocketIsH1Proxy = isEnabledXdsHttpConnect && socketIsH1Proxy; |
| 274 | + boolean socketIsH1ProxyAndSupported = isEnabledXdsHttpConnect && socketIsH1Proxy; |
270 | 275 |
|
271 | | - if (hasTransportSocket && !socketIsTls && !supportSocketIsH1Proxy) { |
272 | | - return StructOrError.fromError( |
273 | | - "transport-socket with name " + transportSocketName + " not supported, socketIsTls=" |
274 | | - + socketIsTls + ", socketIsH1Proxy=" + socketIsH1Proxy |
275 | | - + ", isEnabledXdsHttpConnect=" + isEnabledXdsHttpConnect |
276 | | - + ", supportSocketIsH1Proxy=" + supportSocketIsH1Proxy + "."); |
| 276 | + if (hasTransportSocket && !(socketIsTls || socketIsH1ProxyAndSupported)) { |
| 277 | + String errMsg = "transport-socket with name " + transportSocketName + " not supported"; |
| 278 | + |
| 279 | + @SuppressWarnings("AlreadyChecked") // todo remove |
| 280 | + String extraErrorMsg = errMsg |
| 281 | + + ", socketIsTls=" + socketIsTls |
| 282 | + + ", socketIsH1Proxy=" + socketIsH1Proxy |
| 283 | + + ", isEnabledXdsHttpConnect=" + isEnabledXdsHttpConnect |
| 284 | + + ", socketIsH1ProxyAndSupported=" + socketIsH1ProxyAndSupported + "."; |
| 285 | + logger.log(XdsLogLevel.ERROR, extraErrorMsg); |
| 286 | + |
| 287 | + return StructOrError.fromError(errMsg + "."); |
277 | 288 | } |
278 | 289 |
|
279 | | - if (hasTransportSocket && supportSocketIsH1Proxy) { |
| 290 | + if (hasTransportSocket && socketIsH1ProxyAndSupported) { |
280 | 291 | isHttp11ProxyAvailable = true; |
281 | 292 | try { |
282 | 293 | Http11ProxyUpstreamTransport wrappedTransportSocket = transportSocket |
|
0 commit comments