Commit Graph

5399 Commits

Author SHA1 Message Date
Chengyuan Zhang 18f5fc2d7f
api: implement admin interface API (#7928)
Adds an AdminInterface API that automatically loads available admin services (currently, only supports Channelz and CSDS).
2021-03-04 16:53:03 -08:00
Chengyuan Zhang 37b94b3074
api: delete deprecated NameResolver APIs (#7936)
Deletes deprecated (~2 years) NameResolver APIs that uses NameResolver.Helper/Attributes for passing information from Channel to resolver.
2021-03-04 13:08:18 -08:00
Sergii Tkachenko cf99e8a7b2
xds: add helper to unpack compatible com.google.protobuf.Any messages 2021-03-03 14:46:44 -08:00
Chengyuan Zhang e5ab4d743d
grpclb: fix race between address update and LB stream recreation (#7934)
When the LB stream has been closed and a retry task is scheduled. Receiving a ResolvedAddress update with LB addresses immediately creates a new RPC stream again. Then when the retry task fires, a LB stream already exists.

This change cancels the retry task when the address update causing a new LB stream to be created.
2021-03-02 22:43:26 -08:00
sanjaypujare 46a136d62b
xds: implement listener deletion/re-add and server serving/not-serving logic (#7919) 2021-03-02 10:47:50 -08:00
Chengyuan Zhang a3ca6321ba
xds: fix typo in handling malformed cluster config (#7930) 2021-03-01 16:58:23 -08:00
Chengyuan Zhang a598b973a3
api: add ServerBuilder.addServices() API (#7926) 2021-02-28 23:36:27 -08:00
Eric Anderson cfe7d7c00d Add Codecov.io badge for code coverage
We find codecov.io generally more useful than coveralls.io, so make it a
bit easier to dig into the coverage.

We put it second simply because when people think "test coverage"
without any other details they (rightly) generally assume line coverage;
condition coverage is generally a separate metric. Codecov uses a
combined line+condition coverage metric which is pretty nice, but
if you are unfamiliar with it it appears like code coverage is lower
than it actually is.
2021-02-26 15:19:16 -08:00
ZHANG Dapeng 14432dfe67
xds: import udpa/type/v1/typed_struct.proto 2021-02-26 12:22:04 -08:00
Chengyuan Zhang 7a92de619b
xds: add env var protection for google-c2p resolver (#7918) 2021-02-25 17:55:05 -08:00
ZHANG Dapeng 9b803f338b
Revert "stub: Have ClientCalls.ThreadlessExecutor reject Runnables after end of RPC" (#7920)
This reverts commit 61e0f30 (#7798).

Our stub/core implementation had a bug (#7921) that might make it possible to leak cancellation through to the executor multiple times, typically when a custom interceptor is used. Revert this commit because import of grpc to google internal fails. We think the bug found in the import is legit and in our code. So we revert this change to avoid hurting users until the underlying issue is fixed.
2021-02-25 15:46:17 -08:00
Eric Anderson ae574434ee Update README etc to reference 1.36.0 2021-02-24 10:51:14 -08:00
Nick Hill 61e0f30e38
stub: Have ClientCalls.ThreadlessExecutor reject Runnables after end of RPC
Changes originally proposed as part of #7106.

Fixes #3557
2021-02-23 15:58:05 -08:00
Chengyuan Zhang 2bfa0037ad
xds: implement cloud-to-prod resolver (#7900)
Implemented CloudToProdNameResolver, which will be used for DirectPath with URI scheme "google-c2p". The resolver is only a wrapper that delegates name resolution either to DNS or xDS resolver depending on the environment. If it is delegating to the xDS resolver, it will send HTTP requests (to a local HTTP server) to fetch metadata that is used to generate a bootstrap config. The self-generated bootstrap will be used for xDS.
2021-02-23 12:27:47 -08:00
sanjaypujare bfc67bfcf4
xds: remove the env var GRPC_XDS_EXPERIMENTAL_NEW_SERVER_API (#7914) 2021-02-23 11:15:22 -08:00
Eric Anderson 6fb84bc61c Call the HTTP/2 close() so that GOAWAY is issued 2021-02-22 22:45:24 -08:00
Eric Anderson f2eb0af550 netty: Allow handshakes to be interrupted by channel shutdown
If a handshake is ongoing during shutdown, this would substantially
reduce the time it takes to shut down. Previously, you would need to use
channel.shutdownNow() to have fast shutdown behavior, which is an
unnecessary use of the variant.

When the current approach was written WriteBufferingAndExceptionHandler
didn't exist and so it was hard to predict how the pipeline would react
to events (particularly because of HTTP/2 handler's re-definition of
close()). Now that WBAEH exists, this is more straight-forward.
2021-02-22 22:45:24 -08:00
Chengyuan Zhang 22d1af0c89
xds: implement simple safe and allocation-free xx_hash (#7912)
Implement a simple allocation-free xx_hash utility class without using sun.misc.Unsafe. The hash function mainly targets on xDS use case, which is mostly small strings (endpoint address, headers, etc) and primitive types.

In gRPC's use case, string characters need to be treated as ASCIIs to make the produced hash values match other implementations (Envoy, gRPC-Go, C-core, etc) would produce.

The hashing implementation and tests are borrowed from OpenHFT's XxHash implementation (https://github.com/OpenHFT/Zero-Allocation-Hashing/blob/master/src/main/java/net/openhft/hashing/XxHash.java, see commit 658079a50903c32c54f2ab5c86243244b3ac60ed), which is under Apache 2.0 license. For more details, see https://github.com/OpenHFT/Zero-Allocation-Hashing.

The code is made to be in third_party directory with LISENCE and NOTICE files.
2021-02-22 11:07:25 -08:00
sanjaypujare 6a581f282b
xds: implement the new filterChainMatch algorithm (#7910) 2021-02-19 15:29:27 -08:00
Eric Anderson a55e034732 interop-testing: Specify ca-cert with transport-agnostic Credentials API 2021-02-19 09:30:24 -08:00
Eric Anderson 2e0e238fb2 okhttp: Consume mTLS and Trust/KeyManager Credentials API 2021-02-19 09:30:24 -08:00
Eric Anderson 0eab1c9176 netty: Consume mTLS and Trust/KeyManager Credentials API 2021-02-19 09:30:24 -08:00
Eric Anderson d937ec5baf api: Add mTLS and Trust/KeyManager Credentials API 2021-02-19 09:30:24 -08:00
ZHANG Dapeng 132a40a1cf
xds: implement fault injection interceptor in XdsNameResolver 2021-02-18 14:35:45 -08:00
Sergii Tkachenko e5e9c7a714 xds: sync envoy proto to commit ac9a2637336decdcc52c24add5e8fc39edebb962 2021-02-18 16:11:04 -05:00
ZHANG Dapeng 29864f4fad
xds: gate HttpFilter parsing by env flag 2021-02-17 18:55:43 -08:00
Kristofer Karlsson 3c4d3d2bb2 Move pendingDeadline.cancel out of synchronized block 2021-02-17 15:14:28 -08:00
ZHANG Dapeng e73f31a561
rls: fix rls oobChannel grpclb config service name
The serviceName field in oobChannel grpclb config should not be null, otherwise it will default to the lbHelper.getAuthority(), which perviously defaulted to the lookup service before #7852, but has been overridden to the backend service for authentication in #7852.
2021-02-17 10:10:50 -08:00
yifeizhuang 97b705614b
xds: add proto leakage check at gradle build (#7899) 2021-02-16 16:19:06 -08:00
Eric Anderson 1161ad9ed8 alts: Make concurrent handshake limit part of ALTS instead of TSI
The handshake limit is more a property of ALTS than TSI. This allows
other TSI implementations to accept a high connection rate (b/179376431)
2021-02-12 17:11:21 -08:00
Doug Fawley 3752b9e365
add timeout test case to xds interop tests (#7888) 2021-02-12 14:25:20 -08:00
yifeizhuang 0d2ea9365a
interop-testing: fix alts handshaking race (#7896) 2021-02-12 09:50:49 -08:00
sanjaypujare 8030c3a11d
xds: Implement XdsServingStatusListener as per the new xDS server gRFC (#7876) 2021-02-12 09:22:26 -08:00
Chengyuan Zhang 7b70161eef
xds: XdsClient support for hashing based load balancing (#7859)
This change adds two parts to XdsClient for receiving configurations that support hashing based load balancing policies:

- Each Route contains a list of HashPolicys, which specifies the hash value generation for requests routed to that Route.
- Each Cluster resource can specify lb policy other than "round_robin". If it is "ring_hash", it contains the configuration for mapping each RPC's hash value to one of the endpoints.
2021-02-11 23:54:28 -08:00
yifeizhuang 986a36b947
examples: add ALTS example README.md (#7861) 2021-02-11 16:37:39 -08:00
Chengyuan Zhang f4ef5acfd9
gradle, README: Bump protobuf-gradle-plugin version to 0.8.15 (#7891) 2021-02-11 15:41:18 -08:00
Eric Anderson 2140480736 Start 1.37.0 development cycle 2021-02-11 13:53:10 -08:00
ZHANG Dapeng 7d9ee8f051
rls: fix wrong server field in lookup request again
The previous fix #7878 didn't work because the server field is expected to be full hostname (without port number). Need strip the port part from the authority.
2021-02-10 16:33:59 -08:00
yifeizhuang 7f7821c616
interop-testing: add fake altsHandshakerService for test (#7847) 2021-02-09 16:56:26 -08:00
martin-schaub 514101d90c
alts: Introduce AltsContext to allow outside packages accessing ALTS information 2021-02-09 09:16:28 -08:00
Serhii Zabelnykov 9ba419adc0
api: add nullable annotation to trailersFromThrowable (#7856) 2021-02-08 23:39:38 -08:00
ZHANG Dapeng 23bb2ebf31
all: publish grpc-rls
Making `io.grpc:grpc-rls` a maven artifact from next release.
2021-02-08 21:39:54 -08:00
ZHANG Dapeng cb3317b1fd
rls: fix wrong lookup request server field
The server filed in lookup request as specified in go/dynamic-request-routing/#heading=h.eqjtcpo6u8ep should be the original target, not the RLS server where the lookup request is sent to.
2021-02-08 15:53:36 -08:00
ZHANG Dapeng 2cd45e7a24
rls: forcefully close rls channel when lb is shutdown
RLS RPC deadline is configured by service config, and could be extremely long. When RLS lb is shutdown, any pending RLS PRC should be cancelled. Now using shutdownNow() to forcefully close the RLS channel.
2021-02-08 15:52:53 -08:00
ZHANG Dapeng b1daad6f30
xds: remove GRPC_XDS_EXPERIMENTAL_V3_SUPPORT env flag 2021-02-08 13:42:43 -08:00
Chengyuan Zhang 14332d294c
xds: be tolerant for unspecified locality fields in bootstrap (#7872) 2021-02-05 17:30:07 -08:00
Chengyuan Zhang 01ed082281
xds: clean up value-typed classes (#7863)
This change cleans up most value-typed classes in EnvoyProtoData, which represent immutable xDS configurations used in gRPC. This introduces AutoValue for reducing the amount of boilerplate code for pure data classes.

Not all value-typed classes in xDS have been migrated, some would need more invasive refactoring and would be done next. This change is a pure no-op refactoring. No behavior change should be introduced.

For more details, see PR description.
2021-02-05 12:48:38 -08:00
Eric Anderson f0cf435b85 README.md: Document protobuf-gradle-plugin config for lite
This is part of the examples and other documentation, but a user
starting with the README would find things not working and it be very
unclear why.

Realized this was an issue because of
https://stackoverflow.com/q/66028045/4690866 .
2021-02-03 13:07:23 -08:00
Chengyuan Zhang 0dc37ab77d
xds: reimplement stats management (#7848)
This change reimplements stats recording for the client side:

1. Implemented the new stats objects: ClusterDropStats and ClusterLocalityStats, which match C-core's implementation. The XdsClient APIs for accessing stats objects are

- addClusterDropStats(String clusterName, String edsServiceName)
- addClusterLocalityStats(String clusterName, String edsServiceName, Locality locality)

2. Eliminated the LRS LB policy and incorporate locality load recording in ClusterImplLoadBalancer. The endpoint addresses resolved in ClusterResolverLoadBalancer will attach the locality in each address attributes. In ClusterImplLoadBalancer, its helper's createSubchannel() will populate the address locality and then call XdsClient.addClusterLocalityStats(...) to obtain the per-locality stats object for recording RPCs. This stats object is attached to the created subchannel's attribute. Therefore, ClusterImplLoadBalancer receives Picker update from its child LB policy, the Picker's subchannel will always have the per-locality stats object attached. Helper.pickSubchannel(...) will populate the per-locality stats object and wrap it into the stream tracer for counting RPCs. Note the subchannel's shutdown() is wrapped to call the stats object's Release().
2021-02-03 10:45:59 -08:00
Rui Liu 563288f0ad
netty: Log expected STREAM_CLOSED exceptions for already closed streams at FINE level
See this PR in netty: https://github.com/netty/netty/pull/9798 . It's
possible that one peer has closed the stream, yet another frame from
peers arrives after it. This is largely harmless, as explained in the PR
from netty repository. If we don't do this, the log will be polluted with
these harmless logs.

Example that would no longer be logged:

```
Jan 25, 2021 6:23:51 PM io.grpc.netty.NettyServerHandler onStreamError
WARNING: Stream Error
io.netty.handler.codec.http2.Http2Exception$StreamException: Received DATA frame for an unknown stream 27
        at io.netty.handler.codec.http2.Http2Exception.streamError(Http2Exception.java:147)
        at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.shouldIgnoreHeadersOrDataFrame(DefaultHttp2ConnectionDecoder.java:596)
        at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onDataRead(DefaultHttp2ConnectionDecoder.java:239)
        ...
```
2021-02-02 12:21:55 -08:00