Commit Graph

4821 Commits

Author SHA1 Message Date
ZHANG Dapeng 3ebb3e1924
xds: HttpFilter support 2021-03-17 16:37:13 -07:00
sanjaypujare 69587c5239
xds: use the correct resource id template as per xDS server gRFC (#7978) 2021-03-17 08:22:59 -07:00
Eric Anderson c26ee03cd9 netty: Add Http2Headers.setLong() for inbound headers
Starting in Netty 4.1.60, Netty will validate Content-Length headers
using getAll() and setLong(). While getAll() was documented as only used
in tests, it doesn't appear it was currently used in any tests.

While Http2NettyTest.contentLengthPermitted() was added to confirm that
Content-Length works, it won't actually exercise any interesting
behavior until we upgrade to Netty 4.1.60. However, I did test with
Netty 4.1.60 and it reproduced the failure in
https://github.com/grpc/grpc-java/issues/7953 and passed with this
change.

Since Netty is now observing/modifying the headers, it would seem
appropriate to implement a substantial portion of the Http2Headers API.
However, the surface is much larger than we'd want to implement for a
'quick fix' that could be backported. In addition, it seems much of the
API is just convenience methods, so it is probably appropriate to split
out a AbstractHeaders class from DefaultHeaders in Netty that doesn't
make any assumptions about the header storage mechanism.
2021-03-16 16:36:18 -07:00
sanjaypujare 224247cf02
xds: implement xDS server validations (#7972) 2021-03-16 15:24:04 -07:00
yifeizhuang 71c4ef730e
xds:fix cdsLoadBalancer2 childLb shutdown (#7971) 2021-03-16 12:37:05 -07:00
sanjaypujare be6192e82a
xds: replace ServerXdsClient with ClientXdsClient (#7969) 2021-03-16 11:23:41 -07:00
Ulf Adams f872c6059d
Add .ijwb to .gitignore (#7970)
.ijwb is used for the Bazel IntelliJ plugin.
2021-03-15 01:50:13 -07:00
Chengyuan Zhang c3caafa5ae
grpclb: turn into TRANSIENT_FAILURE if given (by balancer or fallback) an empty list of addresses (#7960)
Turn LB state into TRANSIENT_FAILURE if the list of backend addresses given to be used is found to be empty. It applies to both cases in which the address list is given by the balancer or the resolver (aka, the fallback list).
2021-03-12 17:25:32 -08:00
Eric Anderson 706188ac3c
example-tls: Port to Tls{Channel,Server}Credentials
Using the new credentials API allows using generic APIs instead of
Netty-specific ones and allows using grpc-netty-shaded. The new API is
still marked experimental, but it is intended to be stabilized which
isn't the case for the Netty-specific API.

The client now looks more similar to HelloWorldClient.
2021-03-12 15:46:59 -08:00
ZHANG Dapeng 3f7aa8c592
xds: fix Node.toBuilder() bug 2021-03-12 14:06:00 -08:00
Chengyuan Zhang 8e1c9b6948
xds: change system property for reading bootstrap config (#7961)
Changes from "io.grpc.xds.bootstrapValue" to "io.grpc.xds.bootstrapConfig".
2021-03-12 13:54:58 -08:00
Chengyuan Zhang 9c562c8a6f
grpclb: should not ignore subchannels with CONNECTING state in aggregating the overall LB state (#7959)
We should treat both IDLE and CONNECTING subchannels as "connection in progress" when aggregating for the overall load balancing state. Otherwise, RPCs could fail prematurely if one subchannel enters TF while all the others are still in CONNECTING.

23d279660c made each individual subchannel stay in TF until READY if it previously was in TF. So subchannels with CONNECTING state are those in first time connecting. We should give them time to connect.
2021-03-11 16:48:01 -08:00
sanjaypujare afe883119d
xds: add server side Listener processing to ClientXdsClient (#7955)
* xds: add server side Listener processing to ClientXdsClient

* address review comments

* minor fixes for review comments
2021-03-11 16:23:50 -08:00
yifeizhuang 6a9c9901e4
grpclb: support multiple authorities in lb backends for all SRV records (#7951) 2021-03-11 13:29:41 -08:00
apolcyn 972fda2cd7
Add a flag to interop clients to allow statically configuring grpclb (#7957) 2021-03-11 10:55:18 -08:00
yifeizhuang 528ef63c58
core: Move negotiationLogger from channel attributes to GrpcHttp2ConnectionHandler (#7933) 2021-03-10 16:43:56 -08:00
ZHANG Dapeng 2ca28a2903
stub: stabilize StreamObserver APIs
Resolves #1788
2021-03-10 13:41:31 -08:00
Jiangtao Li bb737a2e31
alts: remove confusing constant name in InternalCheckGcpEnvironment.java (#7954) 2021-03-10 10:00:44 -08:00
Sergii Tkachenko c8d3cf23e6
xds: Simplify ClientXdsClientTestBase by reusing test resources 2021-03-08 09:14:22 -08:00
Chengyuan Zhang 4b52639aa1
xds: implement per-RPC hash generation (#7922)
Generates a hash value for each RPC based on the HashPolicies configured for the Route that the RPC is routed to.
2021-03-05 10:51:42 -08:00
Chengyuan Zhang b5c0a4a97a Make addServices() a final method on ServerBuilder and delete from its forwarders. 2021-03-05 10:03:22 -08:00
Chengyuan Zhang 9e2c817cd8 Make AltsServerBuilder extend ForwardingServerBuilder. 2021-03-05 10:03:22 -08:00
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