Commit Graph

755 Commits

Author SHA1 Message Date
yifeizhuang deea4e737a
xds: fix NullPointerException for unknown xdstp resources (#9245) 2022-06-06 14:36:01 -07:00
Eric Anderson 4d00e0cb02 xds: Remove unused Bouncy Castle dependency 2022-06-06 12:29:43 -07:00
Terry Wilson f8da92e176
xds: Update xDS protos (#9223) 2022-05-27 15:56:31 -07:00
Terry Wilson 69d4e71309
Enable xDS custom LB config by default. (#9214) 2022-05-26 17:03:14 -07:00
Terry Wilson e2f7e676cf
xds: Make a copy of Metadata for thread safety. (#9212) 2022-05-25 15:57:24 -07:00
Terry Wilson de3388bd21
xds: Custom LB configs to support UDPA TypeStruct (#9198)
* xds: Custom LB configs to support UDPA TypeStruct

The legacy com.github.udpa.udpa.type.v1.TypedStruct proto should be supported in addition to the current com.github.udpa.udpa.type.v1.TypedStruct one.

Co-authored-by: Sergii Tkachenko <hi@sergii.org>
2022-05-24 13:55:02 -07:00
Terry Wilson 48ea07efce
xds: Use weighted_target LB provider in wrr_locality (#9195)
Fixes a bug where WrrLocalityLoadBalancer would use the endpoint picking policy provider instead of WeightedTargetLoadBalancerProvider.

Also adds a test to fake control plane integration test that caught this bug. The test scaffolding is also updated to have the test server echo all client headers back in the response.

The test load balancer in the test is an almost straight copy of: https://github.com/grpc/grpc-java/blob/master/interop-testing/src/test/java/io/grpc/testing/integration/RpcBehaviorLoadBalancerProviderTest.java
2022-05-24 13:51:12 -07:00
Eric Anderson f9e1c0f37f
xds: Protect xdstp processing with federation env var
There are still some cases for xdstp processing, but they are to percent
encoding replacement strings. Those seem better to leave running since
it looks like it they could be triggered even with federation disabled
in the bootstrap processing.
2022-05-23 08:16:11 -07:00
yifeizhuang c39b3583a1
orca: change metric recorder api to: clear/set/put/remove/setAll (#9180) 2022-05-18 10:54:19 -07:00
Eric Anderson ea09d3eebd Add Bazel build support for xds, googleapis to flesh out maven_install
Not updating the example WORKSPACE because it doesn't have any
Bazel-enabled build that depends on xds and so doesn't need the
additional repository dependencies.

Fixes #9162
2022-05-16 10:05:35 -07:00
cfredri4 1d4e82e9ae
xds: Allow unspecified listener traffic direction to work with Istio (#9173)
* Allow unspecified listener traffic direction to work with Istio
2022-05-16 09:35:55 -07:00
Terry Wilson 8a84611d9d
xds: Update the env variable to enable custom LB config (#9170) 2022-05-13 15:18:02 -07:00
Sergii Tkachenko 23ab7d0309 xds: ignore routes with unsupported optional cluster specifiers
Support for the is_optional logic in Cluster Specifier Plugins:
if unsupported Cluster Specifier Plugin is optional,
don't NACK, and skip any routes that point to it.
2022-05-13 13:03:04 -07:00
Terry Wilson c6bfce034f
xds: Check for env variable before doing custom LB config (#9165) 2022-05-12 12:57:11 -07:00
Terry Wilson 36d1d5fe45
xsd: wrr_locality to not propagate locality weight attribute (#9158)
WrrLocalityLoadBalancer should remove the locality weights attribute from Resolved addresses after using the information. Not propagating this attribute will make it impossible for another child wrr_locality from working. This is not a supported situation and this change make the failure happen earlier and to be more obvious as to the cause.
2022-05-12 12:51:21 -07:00
yifeizhuang 0fd8a6fcea
xds: add OrcaOobHelperWrapper.setListener(), allow receiving reports per subchannel (#9143)
remove OrcaOobHelperWrapper layer. Use OrcaOobUtil.updateListener() to set OrcaOobReportListener per each subchannel, not per helper. OrcaOobReportListener is per helper+subchannel unique.

Orca stats are created when creating helper.createSubchannels(), overriding subchannel attributes to store orcaState in the orcaHelper created subchannels
2022-05-12 10:50:58 -07:00
Terry Wilson 1ee93758cd
xds: More nuanced LoadBalancerConfigFactory tests (#9161)
Also some refactoring.
2022-05-11 23:01:04 -07:00
yifeizhuang b771403273
xds: separate orca APIs and implementations (#9144)
moved orcaMetrics to service project and renamed to MetricRecorder, added internal accessor. Maybe we can combine metricsRecorder and callMetricRecorder, they looks almost the same things.
OrcaServiceImpl depends on metricRecorder, not visa versa.
2022-05-11 15:54:05 -07:00
Terry Wilson f68be9f87c
xsd: Fix some lint errors. (#9159) 2022-05-11 09:37:24 -07:00
Terry Wilson c20904d681
xds: Use wrr_locality LB and support load_balancing_policy in Cluster (#9141)
Instead of providing round robin or least request configurations directly, ClientXdsClient now wraps them in a WRR locality config.

ClusterResolverLoadBalancer passes this configuration directly to PriorityLoadBalancer to use as the endpoint LB policy it provides to ClusterImplLoadBalancer. A new ResolvedAddresses attribute is also set that has all the locality weights. This is needed by WrrLocalityLoadBalancer when it configures WeightedTargetLoadBalancer.

Renames the LegacyLoadBalancerConfigFactory to just LoadBalancerConfigFactory and gives it responsibility for both the legacy and the new LB config mechanism.

The new configuration mechanism is explained in gRFC A52: https://github.com/grpc/proposal/pull/298
2022-05-06 14:54:10 -07:00
Ran e258fc743b
Use `ImmutableMap.Builder.buildOrThrow()` instead of deprecated `build()`. (#9132) 2022-05-02 11:51:42 -07:00
Eric Anderson 0431aee1ac xds: Remove unnecessary SuppressWarnings("unchecked") 2022-05-02 09:51:18 -07:00
yifeizhuang f3378c8876
xds: fix java doc warnings in orca (#9091) 2022-05-02 07:52:31 -07:00
yifeizhuang 9a5467b2ff
xds: move orca to java package io.grpc.xds.orca (#9086)
1. move orca from xds and from service to io.grpc.xds.orca new package
2. keep CallMetricsRecorder and InternalCallMetricsRecorder in service
3. Added APIs for recording utilization/requestCost/cpuUtilization/memoryUtilzation for per-query requests, added internal data structure equivalent to OrcaLoadReport
2022-04-29 14:56:44 -07:00
Terry Wilson e147b5ebfb
cds: Import Envoy load balancing extension protos. (#9133) 2022-04-29 14:42:27 -07:00
yifeizhuang 5686018d40
xds: NACK EDS resources with duplicate localities in the same priority (#9119) 2022-04-29 10:17:47 -07:00
Sergii Tkachenko b3d4607a62
binder, xds: address minor linter fixes (#9130) 2022-04-29 09:42:15 -07:00
Terry Wilson 4c916c4ed1
xds: A new wrr_locality load balancer. (#9103)
This LB is the parent for weighted_target and will configure it based on the child policy it gets in its configuration and locality weights that come in a ResolvedAddresses attribute.

Described in [A52: gRPC xDS Custom Load Balancer Configuration](https://github.com/grpc/proposal/pull/298)
2022-04-28 13:51:46 -07:00
Sergii Tkachenko 7dc4fc929c
xds, api: minor cleanup to address linter suggestions (#9116) 2022-04-27 13:02:46 -07:00
Sergii Tkachenko ecf1b37746
xds: remove google.security.meshca.v1 proto (#9115)
Remove unused xds/third_party/istio/src/main/proto/security/proto/providers/google/meshca.proto
and xds/src/generated/main/grpc/com/google/security/meshca/v1/MeshCertificateServiceGrpc.java
generated from it.
2022-04-26 17:39:09 -07:00
Sergii Tkachenko b1720f10a5
xds: Envoy proto sync to 2022-04-08 (#9101)
Proto updates:

- cncf/xds: Sort xds/import.sh protos alphabetically
- cncf/xds: Sync protos to cncf/xds@d92e9ce (commit 2021-12-16, corresponding to
  envoy cl/440193522). It's a no-op for used protos, but helpful to import the
  latest matcher.proto
- cncf/xds: Import xds/type/matcher/v3/matcher.proto with dependencies
- envoyproxy/protoc-gen-validate: Sync protos to
  envoyproxy/protoc-gen-validate@dfcdc5e (commit 2022-03-10, corresponding to
  envoy cl/440193522) to pick up ignore_empty field required for the following
  envoy sync
- envoyproxy/envoy Sync protos to envoyproxy/envoy@e33f444 (commit 2022-04-07,
  cl/440193522). This is the minimal version needed to pick up
  ClusterSpecifierPlugin.is_optional. a. Generated code:
  AggregatedDiscoveryServiceGrpc was regenerated from the updated proto. This
  is a no-op, just a minor change to the docblocks. b. Deprecated fields had to
  be taken care of manually, see "Manual updates to the code" below.
- envoyproxy/envoy Sync protos to the latest imported version
  envoyproxy/envoy@5d74719 (commit 2022-04-08, cl/443359189). Not needed for
  anything specific, just the last version, and was easy to import.


Manual updates to the code as the result of envoyproxy/envoy@e33f444 sync:

- Deprecated ConfigSource.path replaced with the ConfigSource.path_config_source
  in test fake resources. The ConfigSource.path isn't in active code paths, so
  no prod code changes needed.
- Suppress CertificateValidationContext.match_subject_alt_names deprecations in
  test files. Surprisingly, we don't report deprecations in prod files, despite
  the fact this field is used in prod code a few times.
2022-04-25 16:38:17 -07:00
sanjaypujare 538db03d56
api: add support for SocketAddress types in ManagedChannelProvider (#9076)
* api: add support for SocketAddress types in ManagedChannelProvider
also add support for SocketAddress types in NameResolverProvider
Use scheme in target URI to select a NameRseolverProvider and get
that provider's supported SocketAddress types.
implement selection in ManagedChannelRegistry of appropriate
ManagedChannelProvider based on NameResolver's SocketAddress types
2022-04-22 09:10:55 -07:00
Terry Wilson 8e65700edc
xds: ClientXdsClient to provide JSON LB configurations (v2) (#9095)
This refactoring is done in preparation of a larger change where LB configuration will be provided in the xDS Cluster proto message load_balancing_policy field. This field will allow for the configuration of custom LB policies with arbitrary configuration data.

- Instead of directly creating Java configuration objects, the client delegates to a new factory class to generate JSON configurations
- This factory is considered a "legacy" one as a separate factory will be introduced to build configs based on the new load_balancing_policy field
- The client will use a LoadBalancerProvider to parse the generated config to assure it is valid.
- Overlapping LB config validation that exists both in ClientXdsClient and LB providers will be removed from the client.

This is a second attempt at #8996 that was reverted by #9092.

The initial PR was reverted because the change caused the duplicate CDS update detection in ClientXdsClient to fail. This was because equality checking of PolicySelection instances cannot be relied on. This PR uses the JSON config instead - CdsLoadBalancer2 will handle the conversion from JSON config to PolicySelection.
2022-04-21 14:18:42 -07:00
Sergii Tkachenko a5829107c3
xds: include node ID in RPC failure status messages from the XdsClient (#9099) 2022-04-21 09:52:31 -07:00
yifeizhuang 3a303af02f
xds: priority reset failover timer when connecting if seen ready or idle since TF (#9093)
changes in priority:
Keep track of whether a child has seen TRANSIENT_FAILURE more recently than IDLE or READY, and use this to decide whether to restart the failover timer when a child reports CONNECTING. This ensures that we properly start the failover timer when the ring_hash child policy transitions from IDLE to CONNECTING at startup.
Behaviour change also affects address updates the current priority from CONNECTING to CONNECTING, previously it reports one CONNECTING, right now it does not report and wait there due to failover timer in effect. This helps to try the next priority.
2022-04-20 10:40:03 -07:00
Terry Wilson e2449a7738
Revert "xds: ClientXdsClient to make PolicySelection determination" (#9092)
* Revert "- Change config builder to a static factory class. - Remove validation and default value logic that already exists in providers from the factory. - Using the PolicySelection in CdsUpdate instead of the JSON config."

This reverts commit 54c72b945e.

* Revert "xds: ClientXdsClient to provide LB config in JSON"

This reverts commit 4903b44a82.
2022-04-19 09:24:04 -07:00
yifeizhuang 467ac7a4e8
xds: fix presubmit lints errors for style (#9090) 2022-04-18 17:44:41 -07:00
yifeizhuang 81c4571282
xds: fix ring-hash-picker behaviour (#9085) 2022-04-18 12:16:08 -07:00
yifeizhuang a0da558b12
xds: change ring_hash LB aggregation rule to handles transient_failures (#9084) 2022-04-17 20:45:34 -07:00
Terry Wilson 54c72b945e - Change config builder to a static factory class.
- Remove validation and default value logic that already exists in providers from the factory.
- Using the PolicySelection in CdsUpdate instead of the JSON config.
2022-04-13 12:40:43 -07:00
Terry Wilson 4903b44a82 xds: ClientXdsClient to provide LB config in JSON
This refactoring is done in preparation of a larger change where LB
configuration will be provided in the xDS Cluster proto message
load_balancing_policy field. This field will allow for the configuration
of custom LB policies with arbitrary configuration data.

- Instead of directly creating Java configuration objects, the client
  delegates to a new builder to generate JSON configurations
- This factory is considered a "legacy" one as a separate factory will
  be introduced to build configs based on the new load_balancing_policy
  field
- The client will use a LoadBalancerProvider to parse the generated
  config to assure it is valid.
- CdsLoadBalancer2 will parse to config again to produce the LB config
  object passed down to child LBs.
2022-04-13 12:40:43 -07:00
Eric Anderson 569b7b0b95 xds: Unconditionally apply backoff on LRS stream recreation
This would limit LRS stream creation to one per second, even if the
old stream was considered good as it received a response. This is the
same change as made to ADS in 957079194a.

b/224833499
2022-04-07 14:44:36 -07:00
Anirudh Ramachandra 79f2562306
xds: Improve code clarity by removing Unnecessary fully qualified names and using Immutable interface types. (#9025)
1. Unnecessary fully qualified names
Currently in XdsCredentialsRegistry, the child classes are referred by
their fully qualified names i.e.
'io.grpc.xds.internal.GoogleDefaultXdsCredentialsProvider' instead of
importing GoogleDefaultXdsCredentialsProvider and just using
GoogleDefaultXdsCredentialsProvider.class.

2. Use immutable interfaces instead of the generic collection interface
   i.e. ImmutableMap instead of just Map.

These improvements are related to #8924.
2022-04-04 07:19:53 -07:00
Eric Anderson 1ab7a6dd0f
xds: Remove sleeps in FileWatcherCertificateProviderTest (#8968)
This reduces test time by 7 seconds.
2022-04-01 16:35:51 -07:00
Eric Anderson 432fcf4c98 xds: Reduce XdsServer.start() test time by 24.5s
Just using 100ms is mostly sufficient, but could potentially still flake
on the start()s that should return successfully. Waiting for the
XdsServingStatusListener to be called greatly reduces the amount of
processing needing to be done for start() to react and thus should
greatly avoid flakiness.
2022-04-01 13:34:26 -07:00
Kurt Alfred Kluever f04a49a7bd
Use try/catch idiom instead of @Test(expected = ...) (#9037) 2022-03-31 19:49:12 -07:00
yifeizhuang 7572afb32b
xds: verify and fix presubmit lints errors (#9036) 2022-03-31 12:07:44 -07:00
Eric Anderson 957079194a xds: Unconditionally apply backoff on ADS stream recreation
This would limit ADS stream creation to one per second, even if the
old stream was considered good as it received a response. This shouldn't
really ever trigger, and if it does 1 QPS is probably still too high.
But 1 QPS is _substantially_ better than a closed loop and there's very
few additional signals we could use to avoid resetting the backoff.

b/224833499
2022-03-29 16:36:33 -07:00
yifeizhuang 72ae95792c
xds: add OrcaServiceImpl (#8993) 2022-03-29 08:48:02 -07:00
Anirudh Ramachandra d3f7dc0059
xds: Support custom credentials using XdsCredentialsRegistry (#8924)
Currently the credentials used for xDS communications is hardcoded in the BootstrapperImpl. The bootstrap config chooses one of the possible hardcoded credential.

This commit adds support for a credential plugin which allows users to register custom credentials through XdsCredentialProviders. gRPC will automatically discover the implementations via Java's SPI mechanism

Bootstrapper will use XdsCredentialRegistry to retrieve the list of supported credentials. The current hardcoded list of credentials(google_default, insecure and tls) are registered by default to keep the behavior as is.
2022-03-28 10:20:50 -07:00