Commit Graph

4876 Commits

Author SHA1 Message Date
Chengyuan Zhang a857b5c911
xds: refactor Bootstrapper (#7810)
Split Bootstrapper into Bootstrapper interface and BootstrapperImpl for the concrete implementation. The implementation is cleaned up for better readability and testing. 

Note after this change, the environment variable/system property for setting the path to bootstrap file will be read statically at the time BootstrapImpl class is loaded, instead of when bootstrap() is called. Since in either case the bootstrap file is read for at most once (when the first Channel is created and its resolver starts), the change shouldn't have behavior change from the gRPC client's perspective.
2021-01-19 19:00:15 -08:00
ZHANG Dapeng c1f9658a72
buildscripts: fix buildscript unbound variable error 2021-01-19 18:33:55 -08:00
ZHANG Dapeng 56fc8b8626
buildscripts: add xds_v3 buildscripts 2021-01-19 15:01:21 -08:00
Chengyuan Zhang 29753f2009
xds: google_default should use TLS if address contains no cluster name (#7818)
Fixes bug introduced by 4130c5a1b8. TLS should be selected for addresses without cluster name attributes, even if grpc-xds is in classpath.
2021-01-19 10:16:06 -08:00
Jan Tattermusch b5a0d14da7 testing: Avoid trying Conscrypt on ARM with OpenJDK
This allows io.grpc.testing.integration.Http2OkHttpTest to pass on ARM.

Currently Concrypt doesn't offer an ARM version of the native
components for OpenJDK, so running Http2OkHttpTest ends up with a
failure when ran on an ARM machine:
java.lang.UnsatisfiedLinkError: no conscrypt_openjdk_jni-linux-aarch_64 in java.library.path
2021-01-19 09:27:01 -08:00
Jan Tattermusch 76c5a651a1
Add a simple way to run grpc-java test inside emulated ARM64 docker container 2021-01-19 09:05:22 -08:00
Chengyuan Zhang 1b23cf4f39
xds: fix lint warnings (#7817) 2021-01-15 17:03:39 -08:00
Chengyuan Zhang 4130c5a1b8
alts, xds: backend handshake protocol selection support for xDS in directpath (#7783)
Attaches an attribute on endpoint addresses resolved/discovered using xDS plugin. The attribute indicates whether the endpoint address is a direct Google service endpoint or a CFE. This lets the GoogleDefault credentials choose between ALTS (direct Google service endpoint) and TLS (CFE).

Due to dependency relation between grpc-xds and grpc-alts, GoogleDefault credentials will use the attribute key defined in grpc-xds reflectively.
2021-01-15 16:51:57 -08:00
Kun Zhang 23d279660c
grpclb: keep RR Subchannel state in TRANSIENT_FAILURE until becoming READY (#7816)
If all RR servers are unhealthy, it's possible that at least one
connection is CONNECTING at every moment which causes RR to stay in
CONNECTING. It's better to keep the TRANSIENT_FAILURE state in that
case so that fail-fast RPCs can fail fast.

The same changes have been made for RoundRobinLoadBalancer in #6657
2021-01-15 15:19:52 -08:00
Chengyuan Zhang 9016cf55d7
xds: make XdsAttributes really public internal (#7815)
Change XdsAttributes to InternalXdsAttributes. It is public internal and may be accessed out of grpc-xds.
2021-01-15 12:54:00 -08:00
Chengyuan Zhang 458b0e4447
xds: throw UnsupportedOperation for unimplemented XdsClient interface methods (#7814)
Letting unimplemented XdsClient methods throw avoids misuses.
2021-01-15 11:26:34 -08:00
Chengyuan Zhang 727b17bbcb
xds: delete old CDS and EDS LB policies (#7811)
Deleted old CDS and EDS LB policies as we've migrated to new LB hierachy support new fetures.
2021-01-15 00:06:26 -08:00
Chengyuan Zhang b01dfb9d3c
xds: promote CdsLoadBalancer2 (#7807)
This change migrates to the new LB hierarchy of CDS -> cluster_resolver -> priority -> cluster_impl -> ...
2021-01-14 15:45:18 -08:00
Chengyuan Zhang a584baf86a
xds: implement new CDS LB policy for supporting aggregate clusters (#7722)
The new CDS LB policy supports discovering aggregate clusters and logical DNS clusters. If the cluster given by its config is an aggregate cluster, it recursively resolves into a list of underlying clusters. It creates a cluster_resolver LB policy as its child policy that receives a list of DiscoveryMechanisms with each containing cluster-level configurations for a single non-aggregate cluster.
2021-01-14 13:17:55 -08:00
Chengyuan Zhang ffcc360ba9
core: further clean up leftovers in ManagedChannelImpl's LoadBalancer.Helper and Subchannel implementations (#7806) 2021-01-14 10:41:36 -08:00
Eric Gribkoff 3b03d317cd
Update README etc to reference 1.35.0 (#7804) 2021-01-13 19:34:33 -08:00
Chengyuan Zhang 389c5403e9
core: make subchannel creation timing restriction stricter (#7790)
Throw for subchannel creation if the channel is being shutting down and the delayed transport is terminated (aka, all retry calls has been finished). This enforces load balancer implementations to avoid creating subchannels after being shut down.
2021-01-13 17:01:02 -08:00
Yifei Zhuang ff59104b62
Revert "interop-testing: allow multiple port in test server (#7799)" (#7805)
This reverts commit dac8347063.

Changing from Grpc. newServerBuilder to NettyServerBuilder breaks interop-test with credentials.
2021-01-13 15:08:42 -08:00
Eric Anderson 03d04f1944 api: Reword retry javadoc to make clear service config is source of configuration
Multiple users have tried things like
`mcb.enableRetry().maxRetryAttempts(3)` and been confused when no
retries were performed. Providing a reference to the gRFC and
`defaultServiceConfig()` should greatly increase the clarity of how to
use the method.
2021-01-13 11:36:08 -08:00
Yifei Zhuang dac8347063
interop-testing: allow multiple port in test server (#7799) 2021-01-13 09:47:26 -08:00
Chengyuan Zhang b66d182bb9
api: delete LoadBalancer.Helper APIs that had been deprecated for a long time (#7793) 2021-01-11 15:25:35 -08:00
Chengyuan Zhang ca7f1e4cee
xds: slightly refactor and improve tests for cluster_manager LB policy (#7773) 2021-01-11 10:49:39 -08:00
Chengyuan Zhang 32173975e0
Revert "netty: add exporting SSL/TLS master key log feature (#7724)" (#7792)
This reverts commit 9bc05fba67.
2021-01-08 15:45:58 -08:00
huangqiangxiong 9bc05fba67
netty: add exporting SSL/TLS master key log feature (#7724)
Enable this feature by setting the system property
   -Dio.netty.ssl.masterKeyHandler=true
or
   System.setProperty(SslMasterKeyHandler.SYSTEM_PROP_KEY, "true");
The keys will be written to the log named "io.netty.wireshark" in
the warnning level. To export the keys to a file, you can configure
log factory like: (with log4j.xml for example)
<appender name="key-file" class="org.apache.log4j.RollingFileAppender">
	<param name="file" value="d:/keyfile.txt"/>
	<layout class="org.apache.log4j.PatternLayout">
		<param name="ConversionPattern" value="%m%n"/>
	</layout>
</appender>
<category name="io.netty.wireshark">
	<priority value="DEBUG" />
	<appender-ref ref="key-file" />
</category>

Wireshark can analyze the messages gRPC over TLS with this
key log file.

close #7199
2021-01-08 13:11:24 -08:00
sanjaypujare 2dba43c727
xds: reorder the shutdown of delegate and xds-client for better semantics of ServerWrapperForXds (#7791) 2021-01-08 12:02:09 -08:00
Chengyuan Zhang 18772e2470
xds: wire up re-resolution requests from LB policies for DNS clusters and bypass requests from LB policies for EDS clusters (#7769)
This change wires up the refreshNameResolution() API for triggering DNS re-resolution in ClusterResolverLoadBalancer, which provides a way for downstream LB policies to request a resolution refresh and only re-resolution requests from LB policies for the DNS cluster should trigger the DNS refresh.
2021-01-08 01:08:13 -08:00
Chengyuan Zhang 2755afeaa5
xds: clean up verbose getters and builders on XdsClient interface (#7784)
Eliminate getters and builders for xDS resource data. They are (should be effectively) immutable and mostly only used for internal implementations. Cleaning up getters and builders significantly reduces the verbosity.
2021-01-07 14:55:05 -08:00
Chengyuan Zhang ff52893c79
android-interop-testing: fix wrong instrumented test runner (#7789) 2021-01-07 11:20:24 -08:00
Chengyuan Zhang 70dd45ae70
xds: fix LB policy address and balancing state update propagations (#7772)
Delaying handleResolvedAddresses() for propagating configs to the child LB policy can be problematic. For example, if channel shutdown has been enqueued when calling child policy's handleResolvedAddresses() is being enqueued (e.g., receiving updates from XdsClient), it should not be executed. Otherwise, subchannels may be created by LBs that have already been shut down.

This change fixes LB config propagations in LB policies that manage a group of child LBs and delay the propagation for avoiding reentrancy. LB policies will always directly propagate child LB config/addresses updates directly. On the other hand, upcalls from child LB policies for balancing state updates will be queued and executed later.
2021-01-06 18:25:03 -08:00
sanjaypujare f788eec9e0
xds: multiple changes needed for PSM security GA as discussed (#7777)
* xds: multiple changes needed for GA:
- check to allow XdsServerBuilder.build() only once
- add transportBuilder() to XdsServerBuilder
- remove "grpc/server" hardcoding
- reorder the shutdown of delegate and xdsClient as per new design
2021-01-06 16:44:34 -08:00
Elliotte Rusty Harold 43d2e53a2a
alts: Remove dependency on Apache commons lang 2021-01-06 10:05:44 -08:00
Chengyuan Zhang edfc0d4d02
android-interop-testing: downgrade target SDK version to 26 and eliminate androidx dependencies (#7781)
androidx.appcompat is not ready to be used internally. This change downgrades android-interop-testing's target SDK version to 26 and use android.support's appcompat instead.
2021-01-05 17:41:08 -08:00
Yifei Zhuang 53da588dd1
Move multiple-port ServerImpl to NettyServer (#7674)
Change InternalServer to handle multiple addresses and implemented in NettyServer.
It makes ServerImpl to have a single transport server, and this single transport server (NettyServer) will bind to all listening addresses during bootstrap. (#7674)
2021-01-05 13:24:16 -08:00
ZHANG Dapeng ccef406f89
api: fix LoadBalancer javadoc 2021-01-05 13:12:06 -08:00
Chengyuan Zhang 4548cc5632
xds: fix regression for deleting EDS resources referenced by unchanged CDS resources (#7778)
A bug was introduced in the previous change for processing CDS responses. It mistakenly deleted EDS resources valid still referenced by CDS resources. EDS resource names either appear as the edsServiceName for CDS resources or has the same name as the CDS resources whose edsServiceName is null.

In the previous change, EDS resources having the same name as CDS resources are not retained. This caused LB subtrees for those EDS resources are shut down mistakenly, leading to RPC fails.
2021-01-05 12:08:40 -08:00
Eric Gribkoff f2f3bbeb5d
Start 1.36.0 development cycle (#7770) 2020-12-30 17:14:04 -08:00
Chengyuan Zhang 73fe68eeca
xds: support getting logical DNS and aggregate cluster configurations from CDS responses (#7696)
This change adds support for receiving and extracting configurations for logical DNS clusters and aggregate clusters.
2020-12-30 16:30:35 -08:00
Chengyuan Zhang 64d2bf1256
android, cronet, android-interop-testing: bump Android versions (#7740)
Bumps target SDK version of grpc-android, grpc-cronet, grpc-android-interop-testing to API 29. Major related changes are:

- Migrated android.support to androidx, which is required for Android Q.
- android.net.NetworkInfo is deprecated in SDK 29, suppressed compiler warnings as it is needed for supporting old Android versions.
- Robolectric requires Java 9+ for Android 29, which causes unit tests in grpc-cronet fail. Added annotation to emulate Android 28 for grpc-cronet's test.
- Upgraded Android dependencies accordingly in android-interop-testing.
2020-12-29 18:05:09 -08:00
Eric Anderson 8359d0b710
netty: Upgrade to Netty 4.1.52 and tcnative 2.0.34
The tiny cache size was removed from the bytebuf allocator and so was
deprecated. TLSv1.3 was enabled by the upgrade, which fails mTLS
connections at different times. Conscrypt is incompatible with the
default TrustManager when TLSv1.3 is enabled so we explicitly disable
TLSv1.3 when Conscrypt is used for the moment.
2020-12-29 15:20:46 -08:00
Chengyuan Zhang cddc1a500c
xds: decouple xds channel creation and bootstrapping (#7764)
This change fixes the problem of mismatched lifecycle of the xDS channel and XdsClient. Reading the bootstrap will determine and create the ChannelCredentials for each specified xDS server. An exception will be thrown if any xDS server specifies some channel_creds type that is not supported, not just for the first server (which is the only one to be used now). Reading the bootstrap also determines the xDS protocol version. The xDS channel will have the same lifecycle as the XdsClient instance: an xDS channel is created at the first call of getObject() and is shut down at the same time as the XdsClient is shutting down. A new xDS channel will be created when the ObjectPool creates a new XdsClient instance.
2020-12-28 18:39:14 -08:00
sanjaypujare 67ad78608c
xds: fix typo in a log message (#7762) 2020-12-27 18:10:45 -08:00
Eric Anderson 20197d36ce core: Include wait-for-ready in deadline exceeded insights
There was a report from a user in b/176088054 that experienced an RPC
waiting_for_connection that failed after 45 minutes due to deadline.
That would be quite normal for wait-for-ready, but because we didn't
include that detail in the status we have to do code inspection to
determine if wait-for-ready was enabled.
2020-12-23 13:37:21 -08:00
Eric Anderson b3899087d0 api: Improve code clarity by using Arrays.copyOf()
As noticed by a linter
2020-12-23 13:08:01 -08:00
sanjaypujare a4aa955d66
xds: don't add ServerTlsHandler if current handler is removed - also fix logging. (#7755) 2020-12-23 12:58:53 -08:00
ZHANG Dapeng 7d77f64773
compiler: remove some of the static imports in codegen (#7751)
Resolves #7741 
Some of the static methods in generated code have the same method name but different package name, such `ClientCalls.asyncClientStreamingCall` and `ServerCalls.asyncClientStreamingCall`. It's less readable using static import than using full-qualified method name in-place.
2020-12-23 11:28:03 -08:00
Sergii Tkachenko e5f57adb7f
buildscripts: xDS Kubernetes Interop tests buildscript 2020-12-23 09:52:01 -05:00
ZHANG Dapeng 90d61178a3
all: ChannelCredentials.withoutBearerTokens() and LoadBalancer.Helper API change (#7748)
API change (See go/grpc-rls-callcreds-to-server):

- Add `ChannelCredentials.withoutBearerTokens()`
- Add `createResolvingOobChannelBuilder(String, ChannelCredentials)`, `getChannelCredentials()` and `getUnsafeChannelCredentials()` for `LoadBalancer.Helper`

This PR does not include the implementation of `createResolvingOobChannelBuilder(String, ChannelCredentials)`.
2020-12-22 22:48:39 -08:00
sanjaypujare e530e10648
xds: import latest envoy and udpa protos to get new fields (#7747) 2020-12-22 12:22:40 -08:00
Chengyuan Zhang 5212e3c6df
xds: implement xds_cluster_resolver LB policy (#7685)
Implementation of the xDS cluster_resolver LB policy. It will replace the existing EdsLoadBalancer2.

The cluster_resolver LB policy supports discovering endpoints for aggregate clusters. Its config contains a list of DiscoveryMechanisms for each underlying cluster (the CDS LB policy will flatten an aggregate cluster to a list of underlying clusters), with each represents the mechanism (via EDS or DNS) to be used for resolving endpoints of each underlying cluster. Endpoints in underlying cluster will be resolved independently, but endpoint addresses and the priority/locality structure for each underlying cluster will be combined together before passing down to the child LB policy (aka, Priority LB policy).
2020-12-22 12:16:30 -08:00
Chengyuan Zhang 1e49ac665a
buildscript: ensure dependency convergence (#7745)
Run grpc-all:dependency task in Kokoro. For some unknown reason, building grpc-all doesn't reliably catch dependency conflicts.
2020-12-22 09:09:11 -08:00