Commit Graph

4821 Commits

Author SHA1 Message Date
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
Sergii Tkachenko 461b10a907 services: add support for channelz.GetServer() 2021-02-01 19:33:16 -05:00
Martin Schaub 4c5559d54f Make clearer that AltsAuthContext is internal by renaming 2021-02-01 16:31:33 -08:00
Sergii Tkachenko 7f3ddca30f xds: sort FILES in import.sh scripts alphabetically 2021-02-01 18:43:41 -05:00
ZHANG Dapeng 92e7fd370b
core: user is responsible to override authority for resolvingOobChannelBuilder
ManagedChannelImpl should not override authority for createResolvingOobChannel(target, creds), because ManagedChannelImpl does not know what target and creds are.
2021-01-29 09:50:59 -08:00
yifeizhuang ef76337f5c
core: add more delayedStream tests (#7843)
Add more delayedStream tests related to #7750, where we changed to call realStream.start() synchronously with setting realStream.
2021-01-29 09:42:10 -08:00
ZHANG Dapeng 9bb9fef6b0
rls: use channel creds to create resolvingOobChannel 2021-01-29 09:29:39 -08:00
ZHANG Dapeng 9437783838
core: enhance ManagedChannelBuilder.overrideAuthority()
Enhance `ManagedChannelBuilder.overrideAuthority()` to make it impossible to use a different authority to a backend by wrapping ClientTransportFactory.newClientTransport() and setting ClientTransportOptions’ authority. To avoid confusing the LB policy, it would need to keep the original addresses to return during `Subchannel.getAddresses()`

The class `OverrideAuthorityNameResolverFactory` is deleted and its logic is moved into `ManagedChannelImpl`.
2021-01-29 09:29:06 -08:00
sanjaypujare 64676198c5
xds: implement all string matcher types for SAN list matching (#7801) 2021-01-29 08:32:17 +05:30
ZHANG Dapeng 45a151810c
all: implement Helper.createResolvingOobChannelBuilder(target, creds)
- Add APIs to `ClientTransportFactory`:
```java
public interface ClientTransportFactory {
  /**
   * Swaps to a new ChannelCredentials with all other settings unchanged. Returns null if the
   * ChannelCredentials is not supported by the current ClientTransportFactory settings.
   */
  SwapChannelCredentialsResult swapChannelCredentials(ChannelCredentials channelCreds);

  final class SwapChannelCredentialsResult {
    final ClientTransportFactory transportFactory;
    @Nullable final CallCredentials callCredentials;
  }
}
```

- Add `ChannelCredentials` to constructor args of `ManagedChannelImplBuilder`:
 ```java
public ManagedChannelImplBuilder(
      String target, @Nullable ChannelCredentials channelCreds, @Nullable CallCredentials callCreds, ...)
  ```
2021-01-28 09:49:53 -08:00
ZHANG Dapeng a6df2b2ff4
xds: parse HttpFault filter from LDS/RDS response 2021-01-27 20:45:18 -08:00
Chengyuan Zhang 09869528f8
xds: fix bug of missing cluster_service_name conversion in v2 ClusterStats (#7849) 2021-01-27 18:18:22 -08:00
Chengyuan Zhang 14a38ef9b5
interop-testing: implement test client support for xDS timeout test (#7837)
Changes the xDS interop test client to support timeout test.

- Synced xDS test proto messages with grpc-proto.
- Changed RpcConfig to be the configuration for per test method type. Added timeoutSec for its deadline configuration.
- Changed accumulated stats to include RPC status instead of just succeeded/failed.
2021-01-27 17:09:01 -08:00
yifeizhuang ac2ead70b4
core: delay CallCredentialsApplyingTransport shutdown until metadataApplier finalized (#7813)
Improve the CallCredentialsApplyingTransport shutdown lifecycle management. Right now CallCredentialsApplyingTransport shutdown the delegated real transport too early. It should be waiting for the metadataAppliers to finish because they may execute asynchronously. In addition, there is no shutdown check on CallCredentialsApplyingTransport for newStream(). The degraded lifecycle implementation may cause RejectionExecutionException, or accepting new RPCs after the underlying transport is already closed during channel shutdown.

We added listener on metadataApplier to notify completion, a magic counter to track the pending metadataApplier for delaying shutdown, also added shutdown check for newStream().
2021-01-26 12:01:16 -08:00
Eric Anderson dbd903c018
core: Rewrite builder class signatures to avoid internal class
This provides us a path forward with #7211 (hiding
AbstractManagedChannelImplBuilder and AbstractServerImplBuilder) while
providing users a migration path to manage the ABI breakage (#7552). We
do a .class hack so that recompiling avoids the internal class reference
yet the old methods are still available.

Leaving the classes as-is causes javac to compile two versions of each
method, one returning the public class (e.g. ServerBuilder) and one
returning the internal class (e.g., AbstractServerImplBuilder). However,
we rewrite the signature that is used at compile time so that new
compilations will not reference internal-returning methods.

This is intended to be temporary, just to give a migration path. Once we
have given users some time to recompile we will remove this rewriting
and change the generics to use public classes.
2021-01-25 17:29:12 -08:00
Doug Fawley ec270a7757
interop-testing: support rpc sleep behavior for xDS test server (#7836) 2021-01-25 10:14:37 -08:00
Eric Gribkoff 0ffd942fd2
buildscripts: increase xds job timeouts (#7831) 2021-01-25 04:33:01 -08:00
Srini Polavarapu 2a62de0559
Add link to CVE process (#7832) 2021-01-22 12:42:05 -08:00
Chengyuan Zhang 92364c89c7
xds: support reading bootstrap config directly from env var or system property values (#7826)
This change supports reading the bootstrap config from the following places (in order):

- If GRPC_XDS_BOOTSTRAP exists then use its value as the name of the bootstrap file. If the file is missing or the contents of the file are malformed, return an error.

- Else, if io.grpc.xds.bootstrap exists then use its value as the name of the bootstrap file. If the file is missing or the contents are malformed, return an error.

- Else, if GRPC_XDS_BOOTSTRAP_CONFIG exists then use its value as the bootstrap config. If the value is malformed, return an error.

- Else, if io.grpc.xds.bootstrapValue exists then use its value as the bootstrap config. If the value is malformed, return an error.
2021-01-22 00:26:45 -08:00
Nick Hill 2072df9be6
Random acts of garbage reduction
I noticed some opportunities to reduce allocations on hot paths
2021-01-21 10:45:31 -08:00
ZHANG Dapeng ae82c41032
xds: import fault proto 2021-01-21 09:56:57 -08:00
Eric Anderson 7b8105e100
core: DelayedStream should start() real stream immediately
DelayedClientTransport needs to avoid becoming terminated while it owns
RPCs. Previously DelayedClientTransport could terminate when some of its
RPCs had their realStream but realStream.start() hadn't yet been called.

To avoid that, we now make sure to call realStream.start()
synchronously with setting realStream. Since start() and the method
calls before start execute quickly, we can run it in-line. But it does
mean we now need to split the Stream methods into "before start" and
"after start" categories for queuing.

Fixes #6283
2021-01-20 15:01:49 -08:00
Sergii Tkachenko cd2c168f5b examples: Highlight the suggestion to checkout a tag 2021-01-20 15:40:51 -05:00
ZHANG Dapeng 150f994315
buildscript: fix execution path of xds.sh in xds_v3.sh 2021-01-20 09:21:36 -08:00
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