Commit Graph

4463 Commits

Author SHA1 Message Date
Chengyuan Zhang 2adeff56fe
xds: refactor resource subscription implementation in XdsClient (#7458)
Introduce ResourceSubscriber for tracking the state of a single resource.

Every time newly subscribing to some resource, a corresponding ResourceSubscriber is created. Note it does not control the resource discovery RPCs. It is still the XdsClient that sends RPCs for with all subscribed resource names for each type. A ResourceSubscriber can have the following states:

  - When the initial resource fetch timer (respTimer) is pending, the resource is under discovery, the resource data is unknown. Even if the XdsClient receives a response not containing the corresponding resource, it does not mean the resource is absent. We still need to wait until a response containing the resource data coming or the timer being fired. The timer is scheduled when the ResourceSubscriber is created. So the XdsClient should always create the corresponding ResourceSubscriber when it starts to subscribe a new resource.

  - If the resource fetch timer is not pending, we must know the existence of the resource data. If data field is set, it is the most recently received resource data (aka, cached entry). Otherwise, absent field is set to true, indicating the resource does not exist. The exceptional case is when the ADS stream is closed and in the retry backoff period. During that period, respTimer is cancelled and the resource existence may or may not be known. Once the backoff finishes, the XdsClient will reschedule the respTimer when it recreates the ADS stream and re-request all the resources.

Watchers can be added to existing ResourceSubscribers. At the time the watcher is added, its callback will be invoked if we've already known the existence of the resource. Otherwise, the watcher will just sit there and wait data or absence to come in the future.
2020-09-28 13:43:41 -07:00
Chengyuan Zhang 950ec30247
xds: delete XdsClientImplV2Test (#7461)
Maintaining two copies of tests is counter-productive. Having the entire set of XdsClientImpl tests for covering v2 protocol usage is an overkill.
2020-09-28 09:59:39 -07:00
ZHANG Dapeng e4c3de6334
rls: fix RLS_DATA_KEY propagation in headers 2020-09-28 09:56:01 -07:00
Chengyuan Zhang 9cbea16ccc
xds: stop setting PROXYLESS_CLIENT_HOSTNAME node metadata in LRS requests (#7459)
The PROXYLESS_CLIENT_HOSTNAME node metadata was a temporary workaround for management server to not send back all backend services as load reporting clusters. Now the management server is able to use `send_all_clusters` field to let the client side decide the group of clusters it is reporting loads for. So this node metadata is no longer needed.
2020-09-25 17:50:25 -07:00
Ran 7ca6c02312
Revert "core: delay sending cancel request on client-side when deadline expires (#6328)" (#7457) 2020-09-25 10:38:21 -07:00
Chengyuan Zhang 10b960ea5d
xds: shut down EDS downstream LB policies when no usable endpoints received (#7452) 2020-09-24 15:08:05 -07:00
Chengyuan Zhang 2e411512be
xds: rename CDS/EDS resource watch interface (#7454) 2020-09-24 10:48:58 -07:00
Chengyuan Zhang 41ba242782
xds: delete old EdsLoadBalancer codepath (#7448) 2020-09-23 17:21:18 -07:00
Chengyuan Zhang f62742561d
xds: add toString() and delete unnecessary equals()/hashCode() for LB configs (#7451) 2020-09-23 17:06:55 -07:00
Chengyuan Zhang f055200566
xds: define individual LDS/RDS data watch interface (#7453) 2020-09-23 17:00:41 -07:00
sanjaypujare 147bee8142
xds: implement fallbackProtocolNegotiator for XdsChannelBuilder (#7438) 2020-09-23 10:35:02 -07:00
ZHANG Dapeng d5668b9ee1
core,xds: remove deprecated rawConfig field from PolicySelection 2020-09-22 18:30:54 -07:00
Chengyuan Zhang bc8c758a3c
xds: log raw response messages in sync context (#7441) 2020-09-22 17:28:45 -07:00
Chengyuan Zhang b434df25cd
xds: generate EDS LB config with hardcoded locality picking policy (#7443) 2020-09-22 16:08:41 -07:00
Sergii Tkachenko ef7846496c
core: Inline AbstractManagedChannelImplBuilder 2020-09-22 10:48:31 -04:00
Chengyuan Zhang a5ae55e984
xds: sync Envoy proto to commit fd28e42f31730f5ed6f13f52999692a4885dd312 (2020-09-15) (#7445)
Sync Envoy proto to commit fd28e42f31730f5ed6f13f52999692a4885dd312 (2020-09-15, internal Envoy import CL: cl/332279092). Suppressed warning for using listening_addresses in Node and added TODO for cleaning it up.
2020-09-21 18:16:28 -07:00
Chengyuan Zhang d333304a2b
xds: promote EdsLoadBalancer2 (#7444)
Effectively migrate to the new codepath of hierarchical LB policies.
2020-09-21 16:44:09 -07:00
Chengyuan Zhang da100e8e49
build, examples, README.md: Update protobuf gradle plugin version to 0.8.13 (#7355)
Updated protobuf gradle plugin version to 0.8.13. Fixed Android Kokoro's memory issue by forcing to use a new Gradle daemon for building the previous commit.
2020-09-21 10:42:06 -07:00
Chengyuan Zhang b31d6830a2
xds: fail to create xDS channel if no server with supported channel creds found (#7400)
Create the xDS channel outside the XdsClient. Throw an XdsInitializationException if the provided server list (parsed from the bootstrap file) can not be used to create such a channel. The exception is caught by the xDS resolver and propagated to the Channel gracefully as a name resolution error.
2020-09-18 17:55:29 -07:00
Chengyuan Zhang e6b61ea207
xds: reimplement EDS LB policy with downstream LB config generations that migrate to hierarchical LB tree codepath (#7391)
Implemented the new EDS LB policy, which generates a LB config for instantiating a hierarchical load balancing subtree. The subtree includes downstream LB policies: 

- priority LB policy, which load balances individual priorities separately
- weighted-target LB policy, which load balances individual localities within the same priority separately
- lrs LB policy, which applies load recording that aggregates load stats for each locality
- leaf LB policy (round_robin)

The EDS LB policy is the place that receives endpoint information from traffic director and organizes the data into a model for hierarchical load balancing for the cluster.
2020-09-18 16:37:55 -07:00
Sergii Tkachenko b571f23ad2
core: Inline AbstractServerImplBuilder 2020-09-18 16:31:08 -04:00
Chengyuan Zhang bf7a42dbd1
api, core: delete io.grpc.LoadBalancer.loadBalancingConfig attribute (#7440) 2020-09-18 12:54:48 -07:00
sanjaypujare 04871dcc2a
xds: bootstrapper fixes: remove extra readBootstrap & avoid parseConfig (#7436) 2020-09-17 21:25:19 -07:00
Chengyuan Zhang 92cbc578a2
xds: remove logging in data path (#7437) 2020-09-17 21:08:54 -07:00
ZHANG Dapeng 3abdb2859f
grpclb: cache requestConnection if no subchannel created
An issue was found during CBT RLS client testing: The RLS lb creates grplb child balancer, calls `grpclb.handleResolvedAddress()` then immediately calls `grpclb.requestConnection()`. The subchannel in `GrpclbState.currentPicker.pickList` contains only `GrpclbState.BUFFER_ENTRY` at the moment `grpclb.requestConnection()` is called, and therefore the `requestConnection()` is no-op, and RPC is hanging.
2020-09-16 16:48:22 -07:00
Chengyuan Zhang 80f6d874cf
core: lint remove redundant field (#7433) 2020-09-16 15:32:20 -07:00
Chengyuan Zhang f04f33efe8
xds: resource (with version info) should persist across ADS streams along with XdsClient lifetime (#7427)
The version_info in the xDS protocol represents the client's knowledge for the state of that resource type. It should persist across ADS stream recreation. Even if the ADS stream is recreated, the XdsClient should persist its knowledge for resources it has received. With this implementation, client and server are stateful across the xDS communication. With persisted version_info, the management server knows resources that the client currently knows even after the stream is recreated. So it does not need to re-send resources that the client received with the previous stream.
2020-09-16 10:51:38 -07:00
Chengyuan Zhang eb871698e3
Revert "SECURITY.md: add instruction for disabling Conscrypt's default TrustManager (#6962)" (#7428)
This reverts commit e089ceaadc.
2020-09-16 10:07:52 -07:00
Sergii Tkachenko cccd940e43
okhttp: cleanup channel in channel builder tests 2020-09-16 11:38:55 -04:00
Russell Shaw 5879b53c57
netty: Add support for IBMJSSE2 (#7422)
This is a very simple change to test for IBMJSSE2 security provider in addition to the others. IBM JRE does not support the Sun provider, but instead has IBMJSSE2 which supports the same API calls.

I tested this on Z/OS machine as now it works when before it couldn't find a security provider
2020-09-16 08:07:52 -07:00
ZHANG Dapeng ee5b5929d5
api,netty: Fix TruthIncompatibleType 2020-09-15 11:22:44 -07:00
Chengyuan Zhang 9dd56a7f0f
xds: throw XdsInitializationException when reading bootstrap file encounters error (#7420)
Introduce XdsInitializationException, which is thrown when gRPC fails to read the xDS bootstrap information, or fails to create the XdsClient object with loaded bootstrap configurations. gRPC components (e.g., the XdsNameResolver) is expected to propagate such exceptions gracefully to the channel.
2020-09-14 16:26:28 -07:00
Sergii Tkachenko af6fbf6b74 okhttp: make OkHttpChannelBuilder final 2020-09-11 19:54:31 -04:00
Sergii Tkachenko d5dcfa737a
all: remove deprecated internal OverrideAuthorityChecker 2020-09-11 19:14:25 -04:00
Chengyuan Zhang 69e8204066
xds: promote XdsNameResolver2 (#7416) 2020-09-11 14:56:03 -07:00
Sergii Tkachenko b927278f22 core: cleanup AbstractManagedChannelImplBuilderTest 2020-09-11 17:07:45 -04:00
Chengyuan Zhang 8ac63626c3
xds: make channel creds required in bootstrap file (#7396) 2020-09-11 10:08:52 -07:00
ZHANG Dapeng 234125ee39
core: re-organize RealChannel with updateConfigSelector()
As mentioned in https://github.com/grpc/grpc-java/pull/7413#issuecomment-690756200 `RealChannel` did not manage `configSelector`, and therefore `configSelector.get()`, `configSelector.set()` and `drainPendingCalls()` were scattered everywhere in `ManagedChannelImpl`. This PR re-organizes `RealChannel` to manage `configSelector`.
2020-09-11 09:35:18 -07:00
ZHANG Dapeng 73dd3672fc
core: fix drainPendingCalls might be called twice
Fixing the bug: if two consecutive name resolution updates are queued together in SynchronizationContext, drainPendingCalls() might be called twice and be broken.
2020-09-10 15:11:19 -07:00
Eric Anderson 49e47a4089 Update README etc to reference 1.32.1 2020-09-10 14:50:48 -05:00
ZHANG Dapeng f3a1a3ff10
core: refactor handle config update with ConfigSelector
Get rid of `ServiceConfigInterceptor` and handle config update with `ConfigSelector` inside `ClientCallImpl`.
2020-09-10 10:32:46 -07:00
Esun Kim dca74af870 Upgrade Conscrypt to 2.5.1 2020-09-10 12:12:11 -05:00
Esun Kim 2f60c0a66c Revert "Call Cipher APIs with non-direct ByteBuffers and perform copies in the ALTS code. (cl/308901367)"
This reverts commit a7bca23053.
2020-09-10 12:12:11 -05:00
ZHANG Dapeng 1411e6f61e
core: fix pending call not drained when shutdown
There was bug that new pending calls were not drained after channel is shutdown. The bug was worked around by #7354 .

Fixing by making sure new calls fail immediately if the channel is already shutdown.
2020-09-09 17:47:10 -07:00
sanjaypujare 7c7c4a7daa
xds: accept all forms of gkeClusterUrl and fix the 'x-goog-request-params' value (#7403) 2020-09-09 16:22:34 -07:00
Eric Anderson c919594962 netty-shaded: Fix publish regression for javadoc and sources
96ad6338 accidentally caused the javadoc and sources jars to no longer
be published for grpc-netty-shaded. It would appear to be due to the
jars being empty. This commit causes them to be published again.
2020-09-09 17:39:19 -05:00
Chengyuan Zhang 431df72d2b
xds: eliminate cluster name change logic in CDS LB policy and reimplement tests (roll forward #7356) (#7395)
Eliminated the logic in CDS LB policy that handles CDS config change (aka, cluster name change). A CDS LB policy should be used for a single cluster, the cluster should be effectively final. If the upstream LB policy needs to change routing cluster, it should create separate CDS LB policies, one for each cluster.

This change also reimplemented the unit tests for CDS LB policy.
2020-09-09 12:14:03 -07:00
Chengyuan Zhang c88feeffe8
xds: always generate xds_routing LB policy as the top-level LB policy in legacy xDS resolver (to be deprecated) (#7401)
Now that routing is enabled by default, we should always generate a load balancing config that uses xds_routing as the top-level LB policy. This change is made to the legacy xDS resolver, which will soon be replaced by XdsNameResolver2. But this change allows us to merge split codepath for CDS LB policy.
2020-09-08 18:25:28 -07:00
sanjaypujare b110cf32a0
xds: add server start semantics as per the server api design (#7371) 2020-09-08 17:23:57 -07:00
Sergii Tkachenko e610637440
okhttp: Keep ChannelBuilder.checkAuthority() for backward compatibility 2020-09-08 14:33:53 -04:00