Commit Graph

183 Commits

Author SHA1 Message Date
Chengyuan Zhang f70f73f16c
xds: integrate LRS into XdsClient (#6490)
This change integrates invocation of client side load reporting into XdsClient's implementation:

- Changed LRS client implementation based on LRS design changes. In the new design, first LRS request contains a single ClusterStats message with cluster_name set to the cluster (AKA, CDS cluster) that this LRS client is reporting loads for (no stats data in first request). Then server responses back the name of cluster service (AKA, EDS service) to report loads for.

- Implemented newly proposed LRS client API for adding/removing sources of load stats data.

- Implemented XdsClient APIs for initiating/stopping load reporting.
2019-12-09 23:47:31 -08:00
Chengyuan Zhang 942c1c6b5f
xds: fix bug of verifying xDS requests with ordered resource names
Use matcher that takes care of resource name ordering for comparing requests.
2019-12-09 16:39:26 -08:00
Eric Gribkoff e66ab4e63b
xds: update deprecated charset import (#6502) 2019-12-09 16:23:27 -08:00
Chengyuan Zhang 2de5b4e254
xds: move methods for building test xDS proto messages into a utility class (#6501)
Move helper methods for building xDS protobuf messages into a utility class for code sharing. Tests for gRPC components that use `XdsClient` instance may want to use these methods as well.
2019-12-09 12:59:00 -08:00
ZHANG Dapeng 718f0369cb
core: refactor GracefulSwitchLoadBalancer to switch based on LoadBalancer.Factory
`GracefulSwitchLoadBalancer` was doing switch based on `LoadBalancerProvider.getPolicyName()`. This turned out to be very awkward when I have to synthesize a policy name for the provider, and what I actually care about is the identity of the lb provider not necessarily the policy name.

Now `GracefulSwitchLoadBalancer` is doing switch based on identity of `LoadBalancer.Factory`, which is simpler.
2019-12-09 11:57:16 -08:00
Chengyuan Zhang d3d977d096
xds: extract channel creation out of XdsClient's implementation (#6494)
Introduce a `XdsChannelFactory` for gRPC components that instantiate `XdsClient` instances.
2019-12-08 19:10:12 -08:00
ZHANG Dapeng 30688a1eff
xds: remove xds balancer_name from resolved service config
`XdsNameResolver` will eventually send out a CDS config instead EDS config, but balancer_name should never be sent out from `XdsNameResolver` anyway.

This PR is mainly to unblock current staging test.
2019-12-06 14:36:31 -08:00
sanjaypujare 3145ef0b7c
xds: implementation of file based plugin credential (#6485) 2019-12-06 10:27:51 -08:00
Chengyuan Zhang d168632f82
xds: support multiple xDS servers in bootstrap file (#6493)
Support bootstrap file containing multiple xDS servers, with each has its own server URI and channel credential options. Multiple xDS servers are provided in case of one not reachable. For now, we would only use the first one.

This change also formats JSON strings in bootstrap related tests and add several tests for parsing bootstrap JSON as completeness.

Implementation of XdsClient is changed to take in a list of xDS servers. But still, we only use the first one.
2019-12-05 16:45:28 -08:00
Tomo Suzuki 29638780ae build: Replaced outdated comments (#6492) 2019-12-05 13:53:51 -08:00
ZHANG Dapeng b739239e8d
xds: apply error handling for FallbackLb.handleResolvedAddresses
Apply the same error handling for `FallbackLb.handleResolvedAddresses()` as `LookasideLb` and `CdsLoadBalancer`.
2019-12-05 13:51:01 -08:00
ZHANG Dapeng 9c2501f146
xds: add CdsLoadBalancer
- Contains `ClusterWatcher` implementation. On cluster update, `ClusterWatcherImpl` spawns an EDS child balancer if not created, then based on the ClusterUpdate data, it sends an edsConfig to the EDS child balancer.
- `CdsLoadBalancer` reads `XdsClientRef` and `CdsConfig` from `resolvedAddresses`. Base on `resolvedAddresses`, it register a `ClusterWatcherImpl` to `XdsClient`.
- For a different cluster resource name in CdsConfig when `handleResolvedAddresses()`, `CdsLoadBalancer` will gracefully switch to the new cluster.
2019-12-05 11:04:54 -08:00
ZHANG Dapeng b833aae615
xds: fix build
Fix build failure of 96da68bab3
https://travis-ci.org/grpc/grpc-java/builds/620854037?utm_source=github_status&utm_medium=notification
2019-12-04 16:00:06 -08:00
Chengyuan Zhang 96da68bab3
xds: modify LRS client interface (#6483)
Add two APIs to LoadReportClient interface:

- addLoadStatsStore(String, LoadStatsStore)

- removeLoadStatsStore(String)

Each LoadReportClient is responsible for reporting loads for a single cluster. But a gRPC client can spread loads to multiple EDS services per cluster, while loads for each EDS service should be aggregated separately.

With this change, starting a LoadReportClient only starts LRS RPC, the source of load data to be reported is added via addLoadStatsStore API.
2019-12-04 14:22:30 -08:00
sanjaypujare 5b837c4a59
xds: add UpstreamTlsContext to ClusterUpdate (#6481) 2019-12-04 13:18:42 -08:00
ZHANG Dapeng 6b2e754746
xds: refactor EDS policy to use ObjectPool<XdsClient> with error handling fixes (#6450) 2019-12-04 10:40:20 -08:00
Chengyuan Zhang 06dd24e248
xds: integrate CDS protocol in XdsClient (#6416)
Add CDS protocol integration into XdsClient. gRPC client interacts with XdsClient for CDS results via adding a cluster watcher to receive cluster information from traffic director. Multiple watchers can exist to receive cluster information for the same or different clusters.
2019-12-02 13:57:36 -08:00
sanjaypujare 7b6ab2558c
xds: Implementation of SdsSslContextProvider using SdsClient (#6444) 2019-11-27 15:17:12 -08:00
Jihun Cho 09d5093295
xds: simplify condition (#6463) 2019-11-25 13:22:38 -08:00
Jihun Cho 7db873f1f6
Roll-forward of stub,compiler: generated stub extends Abstract{Async,Future,Blocking}Stub #6196 (#6458)
This reverts commit 2eb3f8c34e (#6317).
2019-11-25 09:41:16 -08:00
Chengyuan Zhang 0a0d9f6684
xds: integrate EDS protocol into XdsClient (#6370)
This change implements EDS protocol in XdsClient, which requests for endpoint information for a given cluster for gRPC's load balancing usage. Note EDS is a quasi-incremental protocol, which means each response may contain only a subset of present resources. Absence of resources should be revealed by response timeout. Currently, timeout is not implemented, endpoint watchers will wait indefinitely if endpoints for the cluster interested in does not exist.
2019-11-24 23:35:58 -08:00
ZHANG Dapeng 81efecd86a
remove getLoadStatsStore method from LocalityStore
Currently `LoadStatsStore` is create by `LocalityStore` and `LoadReportClient` retrieves `LoadStatsStore` from `LocalityStore.getLoadStatsStore()`.

But `LocalityStore` is create by EDS policy, whereas `LoadReportClient` and `LoadStatsStore` should be created by CDS (if not EDS-only), before `LocalityStore` is created. If `LoadReportClient` is embedded in `XdsClientImpl`, it need a `LoadStatsStore` which shouldn't be created by `LocalityStore`.

Instead, `LoadStatsStore` should be create before `LocalityStore` is created, and be passed to `LocalityStore`'s constructor. A getter is not needed.
2019-11-21 12:37:48 -08:00
Jihun Cho eaf99cf7fe
core,xds: add missing JUnit RunWith annotation (#6457) 2019-11-21 11:52:34 -08:00
Chengyuan Zhang c2d68039ba
xds: implement LDS/RDS over ADS in XdsClient (#6320)
Implement envoy's LDS and RDS protocols in XdsClient. gRPC has a special purpose xDS resolver to instantiate an XdsClient object and add a watcher to initiate xDS communication with management server to retrieve information used in service config, which configures gRPC's load balancing plugin.
2019-11-20 00:43:08 -08:00
ZHANG Dapeng 17c3e48240
xds: refactor to eliminate LookasideChannelLb
This is a followup of #6425 to further refactor/cleanup. Now that `LookasideChannelLb` does very little thing, it does not need to be a class anymore.
2019-11-19 17:46:43 -08:00
Chengyuan Zhang c7a6f62831
xds: add gRPC-Java build version into Node parsed for xDS protocol (#6443) 2019-11-19 14:14:18 -08:00
Chengyuan Zhang 86bfefdaf2
api, core: make channel logger accessible through NameResolver.Args (#6430) 2019-11-18 16:33:39 -08:00
ZHANG Dapeng bd1f819024
xds: add an Attributes for XdsClient reference 2019-11-18 15:20:38 -08:00
sanjaypujare b05ce13df2
xds: implementation of SdsClient to be used by SDS based SslContextProviders (#6400) 2019-11-18 10:36:42 -08:00
Chengyuan Zhang a49bd6efaa
xds: do not globally cache results of reading bootstrap file (#6420)
Do not cache content read from bootstrap file. Each call of readBootstrap() should just trigger reading file explicitly.
2019-11-14 17:04:34 -08:00
ZHANG Dapeng 194d1512c0
xds: refactor xds policy to use XdsClient
This is a refactor of the existing xds policy to use XdsClient. It does neither create a copy of EDS policy as in #6371 nor re-implement an EDS policy. This should be similar to the idea of https://github.com/grpc/grpc/pull/20368 in C-core. 

Here it refactors `XdsComms2` to an implementation of `XdsClient`, which can be drop-in replaced by `XdsClientImp` when it's available.
2019-11-14 15:10:44 -08:00
sanjaypujare 80c78ddede
xds: add inline bytes support to CertificationValidationContext we use in SdsTrustManagerFactory (#6429) 2019-11-14 10:51:42 -08:00
Chengyuan Zhang b38134eebd
xds: add APIs for initiating LRS in XdsClient (#6419) 2019-11-13 16:05:36 -08:00
ZHANG Dapeng ce2b0174b2
xds: ignore endpoints with health_status != HEALTHY or UNKNOWN
Let child balancer (currently is Round Robin) handle the address list with only healthy addresses for its locality. If no healthy address available, let the child balancer handleNameResolutionError.
2019-11-12 13:40:25 -08:00
ZHANG Dapeng 6d3fb53128
xds: not use Immutable collections in method signature 2019-11-07 15:18:59 -08:00
ZHANG Dapeng b38d3ee571
all: remove unnecessary SuppressWarnings 2019-11-06 15:20:04 -08:00
Chengyuan Zhang 794517a7c3
xds: modify XdsClient interface and define data to be used by gRPC client from xDS responses (#6390)
This change completes the definition of XdsClient interface and fill the content of data types passing from XdsClient to each resource watcher.
2019-11-05 23:59:04 -08:00
sanjaypujare 6d51163933
xds: use ReferenceCountingSslContextProviderMap in TlsContextManager for clients and servers (#6385) 2019-11-04 17:32:48 -08:00
Chengyuan Zhang 44c4fee95b
xds: build channel to xDS server with GoogleDefaultChannelBuilder if bootstrap file specifies so (#6362)
This change adds support to build channel to xDS server with Google Default Credentials based on bootstrap file's "channel_creds" field.
2019-11-03 16:12:20 -08:00
ZHANG Dapeng 97d4fa6614
xds: fix lint warning for throwing RuntimeException 2019-11-01 16:52:24 -07:00
Chengyuan Zhang c931c87430
xds: refactor gRPC's data types for envoy proto messages (#6361)
This change cleans up the definitions of gRPC's data types for envoy's proto messages. These data types carry only information needed for gRPC's logic extracted from envoy's proto messages. Each data type has a static method to convert from its corresponding envoy's proto.
2019-11-01 10:08:20 -07:00
sanjaypujare b1eb48a910
xds: reference counting map for SslContextProvider needed for TlsContextManager (#6350) 2019-10-31 10:40:19 -07:00
Chengyuan Zhang 39af8690a7
xds: refactor Bootstrapper implementation to be more use friendly (#6339)
Existing Bootstrapper is an eagerly loaded singleton and reading bootstrap file is done when first time referencing Boostrapper class. This is not use friendly for error propagation.
This change added an instance method Bootstrapper#readBootstrap() for reading the bootstrap file. Instead of making the Bootstrapper instance a singleton, make the bootstrap data (aka, BootstrapInfo) a singleton. Now reading the bootstrap file happens when the first Bootstrapper instance first time calling Bootstrapper#readBootstrap().
2019-10-30 12:14:00 -07:00
sanjaypujare d04529256a
xds: rename SecretProvider to SslContextProvider and make it non-generic (#6349) 2019-10-29 11:25:10 -07:00
sanjaypujare d6b64bbf80
xds: add sds.proto to imported envoy proto files (#6346) 2019-10-28 15:51:27 -07:00
Chengyuan Zhang c66c26805f
xds: define XdsClient interface (#6303)
Defines an XdsClient interface, which is the blueprint for the class that encapsulates all of the logic for communicating with the xDS server. Also defines watcher interfaces for watching CDS/EDS updates.
2019-10-24 16:46:20 -07:00
sanjaypujare 48b41dce9e
xds: Client and server proto negotiators and handlers added to SdsProtocolNegotiators (#6319) 2019-10-24 15:27:53 -07:00
ZHANG Dapeng b009e92156
xds: Bump perfmark to 0.19.0
Resolves #6217
2019-10-22 16:55:39 -07:00
Jihun Cho 2eb3f8c34e
stub,compiler: Rollback Abstract{Future,Blocking,Async}Stub (#6317)
rollback of #6304 & #6196
2019-10-22 13:27:30 -07:00
sanjaypujare ed845991db
xds: remove unused SecretManager code based on separate TlsCertificate and CertificateValidationContext secrets (#6310) 2019-10-21 16:45:45 -07:00