grpc 1.49.0.pre1-x86_64-linux → 1.50.0.pre1-x86_64-linux
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +54 -153
- data/include/grpc/event_engine/endpoint_config.h +11 -5
- data/include/grpc/event_engine/event_engine.h +1 -1
- data/include/grpc/impl/codegen/atm_gcc_atomic.h +19 -28
- data/include/grpc/impl/codegen/atm_gcc_sync.h +0 -2
- data/include/grpc/impl/codegen/atm_windows.h +0 -2
- data/include/grpc/impl/codegen/grpc_types.h +6 -0
- data/src/core/ext/filters/channel_idle/channel_idle_filter.cc +3 -3
- data/src/core/ext/filters/client_channel/backup_poller.cc +4 -6
- data/src/core/ext/filters/client_channel/client_channel.cc +41 -22
- data/src/core/ext/filters/client_channel/client_channel.h +1 -1
- data/src/core/ext/filters/client_channel/client_channel_plugin.cc +0 -16
- data/src/core/ext/filters/client_channel/http_proxy.cc +12 -19
- data/src/core/ext/filters/client_channel/http_proxy.h +3 -2
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc +6 -4
- data/src/core/ext/filters/client_channel/lb_policy/child_policy_handler.h +5 -4
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +0 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +114 -103
- data/src/core/ext/filters/client_channel/lb_policy/oob_backend_metric.cc +20 -11
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.cc +106 -108
- data/src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h +16 -0
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +20 -13
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +165 -257
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +218 -231
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +10 -6
- data/src/core/ext/filters/client_channel/lb_policy/rls/rls.cc +389 -444
- data/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +16 -16
- data/src/core/ext/filters/client_channel/lb_policy/subchannel_list.h +8 -13
- data/src/core/ext/filters/client_channel/lb_policy/weighted_target/weighted_target.cc +87 -96
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +38 -37
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +106 -186
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +106 -93
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +170 -218
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +1 -1
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +38 -18
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.cc +84 -37
- data/src/core/ext/filters/client_channel/resolver/polling_resolver.h +11 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +1 -0
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +5 -3
- data/src/core/ext/filters/client_channel/resolver_result_parsing.cc +5 -4
- data/src/core/ext/filters/client_channel/retry_filter.cc +25 -29
- data/src/core/ext/filters/client_channel/subchannel.cc +38 -33
- data/src/core/ext/filters/client_channel/subchannel.h +12 -3
- data/src/core/ext/filters/client_channel/subchannel_stream_client.cc +1 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +23 -16
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +8 -0
- data/src/core/ext/filters/http/client/http_client_filter.cc +1 -2
- data/src/core/ext/filters/http/message_compress/message_compress_filter.cc +2 -4
- data/src/core/ext/filters/http/message_compress/message_decompress_filter.cc +0 -2
- data/src/core/ext/filters/http/server/http_server_filter.cc +1 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +12 -8
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +32 -26
- data/src/core/ext/transport/chttp2/transport/bin_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +25 -130
- data/src/core/ext/transport/chttp2/transport/decode_huff.cc +287 -0
- data/src/core/ext/transport/chttp2/transport/decode_huff.h +1018 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +83 -51
- data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -6
- data/src/core/ext/transport/chttp2/transport/frame_ping.cc +1 -2
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +2 -20
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +28 -28
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.cc +1 -10
- data/src/core/ext/transport/chttp2/transport/hpack_parser_table.h +11 -6
- data/src/core/ext/transport/chttp2/transport/internal.h +2 -0
- data/src/core/ext/transport/chttp2/transport/parsing.cc +44 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +3 -14
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -3
- data/src/core/ext/xds/certificate_provider_store.cc +63 -3
- data/src/core/ext/xds/certificate_provider_store.h +9 -1
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.cc +5 -5
- data/src/core/ext/xds/file_watcher_certificate_provider_factory.h +1 -1
- data/src/core/ext/xds/xds_api.cc +21 -17
- data/src/core/ext/xds/xds_api.h +7 -0
- data/src/core/ext/xds/xds_bootstrap.cc +5 -537
- data/src/core/ext/xds/xds_bootstrap.h +39 -111
- data/src/core/ext/xds/xds_bootstrap_grpc.cc +370 -0
- data/src/core/ext/xds/xds_bootstrap_grpc.h +169 -0
- data/src/core/ext/xds/xds_client.cc +219 -145
- data/src/core/ext/xds/xds_client.h +19 -17
- data/src/core/ext/xds/xds_client_grpc.cc +18 -80
- data/src/core/ext/xds/xds_client_grpc.h +2 -25
- data/src/core/ext/xds/xds_client_stats.cc +4 -4
- data/src/core/ext/xds/xds_cluster.cc +87 -79
- data/src/core/ext/xds/xds_cluster.h +5 -5
- data/src/core/ext/xds/xds_cluster_specifier_plugin.cc +3 -1
- data/src/core/ext/xds/xds_common_types.cc +13 -5
- data/src/core/ext/xds/xds_endpoint.cc +8 -6
- data/src/core/ext/xds/xds_endpoint.h +3 -4
- data/src/core/ext/xds/xds_lb_policy_registry.cc +4 -2
- data/src/core/ext/xds/xds_listener.cc +25 -20
- data/src/core/ext/xds/xds_listener.h +3 -4
- data/src/core/ext/xds/xds_resource_type.h +11 -8
- data/src/core/ext/xds/xds_route_config.cc +15 -16
- data/src/core/ext/xds/xds_route_config.h +3 -3
- data/src/core/ext/xds/xds_server_config_fetcher.cc +7 -5
- data/src/core/ext/xds/xds_transport_grpc.cc +15 -7
- data/src/core/lib/backoff/backoff.cc +2 -4
- data/src/core/lib/channel/call_finalization.h +1 -3
- data/src/core/lib/channel/channel_args.h +114 -14
- data/src/core/lib/channel/channel_trace.cc +3 -4
- data/src/core/lib/channel/promise_based_filter.cc +18 -19
- data/src/core/lib/channel/status_util.cc +27 -0
- data/src/core/lib/channel/status_util.h +10 -0
- data/src/core/lib/config/core_configuration.cc +5 -1
- data/src/core/lib/config/core_configuration.h +33 -0
- data/src/core/lib/debug/stats.cc +26 -30
- data/src/core/lib/debug/stats.h +2 -12
- data/src/core/lib/debug/stats_data.cc +118 -614
- data/src/core/lib/debug/stats_data.h +67 -465
- data/src/core/lib/debug/trace.cc +0 -2
- data/src/core/lib/event_engine/channel_args_endpoint_config.cc +12 -20
- data/src/core/lib/event_engine/channel_args_endpoint_config.h +13 -7
- data/src/core/lib/event_engine/forkable.cc +19 -16
- data/src/core/lib/event_engine/poller.h +14 -12
- data/src/core/lib/event_engine/posix_engine/timer_manager.cc +53 -32
- data/src/core/lib/event_engine/posix_engine/timer_manager.h +23 -1
- data/src/core/lib/event_engine/thread_pool.cc +131 -94
- data/src/core/lib/event_engine/thread_pool.h +56 -23
- data/src/core/lib/event_engine/time_util.cc +30 -0
- data/src/core/lib/event_engine/time_util.h +32 -0
- data/src/core/lib/event_engine/utils.cc +0 -5
- data/src/core/lib/event_engine/utils.h +0 -4
- data/src/core/lib/event_engine/windows/iocp.cc +13 -7
- data/src/core/lib/event_engine/windows/iocp.h +2 -1
- data/src/core/lib/event_engine/windows/win_socket.cc +1 -1
- data/src/core/lib/experiments/config.cc +146 -0
- data/src/core/lib/experiments/config.h +43 -0
- data/src/core/lib/experiments/experiments.cc +75 -0
- data/src/core/lib/experiments/experiments.h +56 -0
- data/src/core/lib/gpr/alloc.cc +1 -9
- data/src/core/lib/gpr/log_windows.cc +0 -1
- data/src/core/lib/gpr/string_util_windows.cc +3 -30
- data/src/core/lib/gpr/sync_abseil.cc +0 -14
- data/src/core/lib/gpr/sync_posix.cc +0 -14
- data/src/core/lib/gpr/time_posix.cc +0 -6
- data/src/core/lib/gpr/time_precise.h +1 -1
- data/src/core/lib/gpr/tmpfile_windows.cc +5 -7
- data/src/core/lib/gpr/useful.h +11 -0
- data/src/core/lib/{gpr → gprpp}/env.h +25 -12
- data/src/core/lib/{gpr → gprpp}/env_linux.cc +20 -15
- data/src/core/lib/{gpr → gprpp}/env_posix.cc +11 -10
- data/src/core/lib/gprpp/env_windows.cc +56 -0
- data/src/core/lib/gprpp/fork.cc +14 -22
- data/src/core/lib/gprpp/fork.h +0 -8
- data/src/core/lib/gprpp/global_config_env.cc +7 -6
- data/src/core/lib/gprpp/notification.h +67 -0
- data/src/core/lib/gprpp/packed_table.h +40 -0
- data/src/core/lib/gprpp/ref_counted_ptr.h +20 -33
- data/src/core/lib/gprpp/sorted_pack.h +98 -0
- data/src/core/lib/gprpp/status_helper.h +6 -0
- data/src/core/lib/gprpp/table.h +9 -1
- data/src/core/lib/gprpp/tchar.cc +49 -0
- data/src/core/lib/gprpp/tchar.h +33 -0
- data/src/core/lib/gprpp/time.cc +21 -0
- data/src/core/lib/gprpp/time.h +55 -0
- data/src/core/lib/gprpp/validation_errors.cc +61 -0
- data/src/core/lib/gprpp/validation_errors.h +110 -0
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper.h +3 -3
- data/src/core/{ext/filters/client_channel → lib/handshaker}/proxy_mapper_registry.cc +14 -36
- data/src/core/lib/handshaker/proxy_mapper_registry.h +75 -0
- data/src/core/lib/iomgr/call_combiner.cc +0 -8
- data/src/core/lib/iomgr/closure.h +0 -1
- data/src/core/lib/iomgr/endpoint_pair_posix.cc +14 -10
- data/src/core/lib/iomgr/endpoint_pair_windows.cc +2 -2
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +1 -38
- data/src/core/lib/iomgr/ev_poll_posix.cc +2 -17
- data/src/core/lib/iomgr/exec_ctx.cc +0 -10
- data/src/core/lib/iomgr/exec_ctx.h +7 -31
- data/src/core/lib/iomgr/iocp_windows.cc +1 -2
- data/src/core/lib/iomgr/iomgr.cc +6 -8
- data/src/core/lib/iomgr/iomgr_fwd.h +1 -0
- data/src/core/lib/iomgr/pollset.h +1 -1
- data/src/core/lib/iomgr/pollset_set.h +0 -1
- data/src/core/lib/iomgr/resolve_address.h +1 -0
- data/src/core/lib/iomgr/resolve_address_impl.h +1 -0
- data/src/core/lib/iomgr/resolve_address_posix.cc +5 -0
- data/src/core/lib/iomgr/resolve_address_windows.cc +5 -0
- data/src/core/lib/iomgr/sockaddr_utils_posix.cc +2 -1
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +12 -34
- data/src/core/lib/iomgr/socket_utils_posix.cc +83 -1
- data/src/core/lib/iomgr/socket_utils_posix.h +98 -6
- data/src/core/lib/iomgr/tcp_client.cc +6 -7
- data/src/core/lib/iomgr/tcp_client.h +11 -11
- data/src/core/lib/iomgr/tcp_client_cfstream.cc +6 -6
- data/src/core/lib/iomgr/tcp_client_posix.cc +33 -29
- data/src/core/lib/iomgr/tcp_client_posix.h +12 -9
- data/src/core/lib/iomgr/tcp_client_windows.cc +6 -6
- data/src/core/lib/iomgr/tcp_posix.cc +131 -114
- data/src/core/lib/iomgr/tcp_posix.h +3 -1
- data/src/core/lib/iomgr/tcp_server.cc +5 -4
- data/src/core/lib/iomgr/tcp_server.h +9 -6
- data/src/core/lib/iomgr/tcp_server_posix.cc +17 -28
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +2 -2
- data/src/core/lib/iomgr/tcp_server_utils_posix_common.cc +3 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +6 -7
- data/src/core/lib/iomgr/tcp_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.h +0 -1
- data/src/core/lib/iomgr/timer_generic.cc +4 -4
- data/src/core/lib/iomgr/timer_manager.cc +1 -2
- data/src/core/lib/iomgr/wakeup_fd_eventfd.cc +0 -2
- data/src/core/lib/json/json_object_loader.cc +21 -52
- data/src/core/lib/json/json_object_loader.h +56 -76
- data/src/core/lib/json/json_util.cc +2 -1
- data/src/core/lib/load_balancing/lb_policy.h +5 -5
- data/src/core/lib/load_balancing/lb_policy_registry.cc +29 -55
- data/src/core/lib/load_balancing/lb_policy_registry.h +23 -11
- data/src/core/lib/promise/activity.h +2 -3
- data/src/core/lib/promise/context.h +1 -1
- data/src/core/lib/promise/sleep.cc +16 -4
- data/src/core/lib/promise/sleep.h +8 -2
- data/src/core/lib/resolver/resolver.h +13 -3
- data/src/core/lib/resource_quota/api.cc +9 -0
- data/src/core/lib/resource_quota/api.h +6 -0
- data/src/core/lib/resource_quota/arena.cc +1 -3
- data/src/core/lib/resource_quota/memory_quota.cc +8 -24
- data/src/core/lib/resource_quota/memory_quota.h +6 -19
- data/src/core/lib/resource_quota/periodic_update.cc +2 -3
- data/src/core/{ext/xds → lib/security/certificate_provider}/certificate_provider_factory.h +3 -3
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.cc +60 -0
- data/src/core/lib/security/certificate_provider/certificate_provider_registry.h +70 -0
- data/src/core/lib/security/credentials/channel_creds_registry_init.cc +1 -0
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +15 -16
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -1
- data/src/core/lib/security/credentials/google_default/credentials_generic.cc +5 -8
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +6 -6
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +3 -2
- data/src/core/lib/security/credentials/jwt/jwt_verifier.h +1 -1
- data/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc +1 -2
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.cc +4 -3
- data/src/core/lib/security/credentials/tls/grpc_tls_certificate_provider.h +4 -2
- data/src/core/lib/security/credentials/tls/tls_utils.cc +3 -1
- data/src/core/lib/security/transport/client_auth_filter.cc +12 -1
- data/src/core/lib/security/transport/secure_endpoint.cc +0 -4
- data/src/core/lib/surface/call.cc +1 -11
- data/src/core/lib/surface/channel.cc +3 -2
- data/src/core/lib/surface/completion_queue.cc +16 -28
- data/src/core/lib/surface/completion_queue.h +1 -1
- data/src/core/lib/surface/completion_queue_factory.cc +5 -0
- data/src/core/lib/surface/init.cc +16 -11
- data/src/core/lib/surface/init_internally.cc +24 -0
- data/src/core/lib/surface/init_internally.h +28 -0
- data/src/core/lib/surface/server.cc +1 -7
- data/src/core/lib/surface/server.h +4 -6
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/bdp_estimator.cc +1 -3
- data/src/core/lib/transport/metadata_batch.cc +2 -3
- data/src/core/lib/transport/metadata_batch.h +9 -7
- data/src/core/lib/transport/parsed_metadata.h +4 -2
- data/src/core/lib/transport/status_conversion.cc +1 -3
- data/src/core/lib/transport/tcp_connect_handshaker.cc +9 -5
- data/src/core/lib/transport/transport.h +0 -1
- data/src/core/lib/transport/transport_impl.h +0 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +23 -46
- data/src/core/plugin_registry/grpc_plugin_registry_extra.cc +13 -25
- data/src/ruby/ext/grpc/extconf.rb +1 -1
- data/src/ruby/lib/grpc/2.6/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/2.7/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.0/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/3.1/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/grpc_c.so +0 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/spec/channel_spec.rb +5 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +1 -1
- data/src/ruby/spec/user_agent_spec.rb +1 -1
- metadata +32 -19
- data/src/core/ext/filters/client_channel/proxy_mapper_registry.h +0 -56
- data/src/core/ext/xds/certificate_provider_registry.cc +0 -103
- data/src/core/ext/xds/certificate_provider_registry.h +0 -59
- data/src/core/lib/event_engine/promise.h +0 -78
- data/src/core/lib/gpr/env_windows.cc +0 -74
- data/src/core/lib/gpr/string_windows.h +0 -32
- data/src/core/lib/profiling/basic_timers.cc +0 -295
- data/src/core/lib/profiling/stap_timers.cc +0 -50
- data/src/core/lib/profiling/timers.h +0 -94
- data/src/ruby/lib/grpc/2.5/grpc_c.so +0 -0
@@ -45,7 +45,6 @@
|
|
45
45
|
#include "src/core/lib/gprpp/sync.h"
|
46
46
|
#include "src/core/lib/gprpp/time.h"
|
47
47
|
#include "src/core/lib/gprpp/work_serializer.h"
|
48
|
-
#include "src/core/lib/iomgr/exec_ctx.h"
|
49
48
|
#include "src/core/lib/uri/uri_parser.h"
|
50
49
|
|
51
50
|
namespace grpc_core {
|
@@ -76,9 +75,7 @@ class XdsClient : public DualRefCounted<XdsClient> {
|
|
76
75
|
~XdsClient() override;
|
77
76
|
|
78
77
|
const XdsBootstrap& bootstrap() const {
|
79
|
-
|
80
|
-
// would return a null object if bootstrap_ was null.
|
81
|
-
return *bootstrap_;
|
78
|
+
return *bootstrap_; // ctor asserts that it is non-null
|
82
79
|
}
|
83
80
|
|
84
81
|
XdsTransportFactory* transport_factory() const {
|
@@ -188,8 +185,9 @@ class XdsClient : public DualRefCounted<XdsClient> {
|
|
188
185
|
void MaybeStartLrsCall();
|
189
186
|
void StopLrsCallLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
|
190
187
|
|
191
|
-
|
192
|
-
|
188
|
+
// Returns non-OK if there has been an error since the last time the
|
189
|
+
// ADS stream saw a response.
|
190
|
+
const absl::Status& status() const { return status_; }
|
193
191
|
|
194
192
|
void SubscribeLocked(const XdsResourceType* type,
|
195
193
|
const XdsResourceName& name)
|
@@ -200,14 +198,17 @@ class XdsClient : public DualRefCounted<XdsClient> {
|
|
200
198
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
|
201
199
|
|
202
200
|
private:
|
203
|
-
void
|
204
|
-
|
201
|
+
void OnConnectivityFailure(absl::Status status);
|
202
|
+
|
203
|
+
// Enqueues error notifications to watchers. Caller must drain
|
204
|
+
// XdsClient::work_serializer_ after releasing the lock.
|
205
|
+
void SetChannelStatusLocked(absl::Status status)
|
205
206
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&XdsClient::mu_);
|
206
207
|
|
207
208
|
// The owning xds client.
|
208
209
|
WeakRefCountedPtr<XdsClient> xds_client_;
|
209
210
|
|
210
|
-
const XdsBootstrap::XdsServer& server_;
|
211
|
+
const XdsBootstrap::XdsServer& server_; // Owned by bootstrap.
|
211
212
|
|
212
213
|
OrphanablePtr<XdsTransportFactory::XdsTransport> transport_;
|
213
214
|
|
@@ -220,6 +221,8 @@ class XdsClient : public DualRefCounted<XdsClient> {
|
|
220
221
|
// Stores the most recent accepted resource version for each resource type.
|
221
222
|
std::map<const XdsResourceType*, std::string /*version*/>
|
222
223
|
resource_type_version_map_;
|
224
|
+
|
225
|
+
absl::Status status_;
|
223
226
|
};
|
224
227
|
|
225
228
|
struct ResourceState {
|
@@ -248,7 +251,7 @@ class XdsClient : public DualRefCounted<XdsClient> {
|
|
248
251
|
std::map<RefCountedPtr<XdsLocalityName>, LocalityState,
|
249
252
|
XdsLocalityName::Less>
|
250
253
|
locality_stats;
|
251
|
-
Timestamp last_report_time =
|
254
|
+
Timestamp last_report_time = Timestamp::Now();
|
252
255
|
};
|
253
256
|
|
254
257
|
// Load report data.
|
@@ -261,9 +264,6 @@ class XdsClient : public DualRefCounted<XdsClient> {
|
|
261
264
|
LoadReportMap load_report_map;
|
262
265
|
};
|
263
266
|
|
264
|
-
// Sends an error notification to all watchers.
|
265
|
-
void NotifyOnErrorLocked(absl::Status status)
|
266
|
-
ABSL_EXCLUSIVE_LOCKS_REQUIRED(mu_);
|
267
267
|
// Sends an error notification to a specific set of watchers.
|
268
268
|
void NotifyWatchersOnErrorLocked(
|
269
269
|
const std::map<ResourceWatcherInterface*,
|
@@ -311,14 +311,16 @@ class XdsClient : public DualRefCounted<XdsClient> {
|
|
311
311
|
v2_resource_types_ ABSL_GUARDED_BY(mu_);
|
312
312
|
upb::SymbolTable symtab_ ABSL_GUARDED_BY(mu_);
|
313
313
|
|
314
|
-
//
|
315
|
-
|
316
|
-
|
314
|
+
// Map of existing xDS server channels.
|
315
|
+
// Key is owned by the bootstrap config.
|
316
|
+
std::map<const XdsBootstrap::XdsServer*, ChannelState*>
|
317
|
+
xds_server_channel_map_ ABSL_GUARDED_BY(mu_);
|
317
318
|
|
318
319
|
std::map<std::string /*authority*/, AuthorityState> authority_state_map_
|
319
320
|
ABSL_GUARDED_BY(mu_);
|
320
321
|
|
321
|
-
|
322
|
+
// Key is owned by the bootstrap config.
|
323
|
+
std::map<const XdsBootstrap::XdsServer*, LoadReportServer>
|
322
324
|
xds_load_report_server_map_ ABSL_GUARDED_BY(mu_);
|
323
325
|
|
324
326
|
// Stores started watchers whose resource name was not parsed successfully,
|
@@ -19,18 +19,12 @@
|
|
19
19
|
#include "src/core/ext/xds/xds_client_grpc.h"
|
20
20
|
|
21
21
|
#include <algorithm>
|
22
|
-
#include <map>
|
23
22
|
#include <memory>
|
24
23
|
#include <string>
|
25
24
|
#include <utility>
|
26
|
-
#include <vector>
|
27
25
|
|
28
26
|
#include "absl/base/thread_annotations.h"
|
29
|
-
#include "absl/memory/memory.h"
|
30
27
|
#include "absl/status/status.h"
|
31
|
-
#include "absl/strings/str_cat.h"
|
32
|
-
#include "absl/strings/str_format.h"
|
33
|
-
#include "absl/strings/str_join.h"
|
34
28
|
#include "absl/strings/string_view.h"
|
35
29
|
#include "absl/types/optional.h"
|
36
30
|
|
@@ -40,9 +34,8 @@
|
|
40
34
|
#include <grpc/support/log.h>
|
41
35
|
#include <grpc/support/string_util.h>
|
42
36
|
|
43
|
-
#include "src/core/ext/xds/certificate_provider_factory.h"
|
44
|
-
#include "src/core/ext/xds/certificate_provider_registry.h"
|
45
37
|
#include "src/core/ext/xds/xds_bootstrap.h"
|
38
|
+
#include "src/core/ext/xds/xds_bootstrap_grpc.h"
|
46
39
|
#include "src/core/ext/xds/xds_channel_args.h"
|
47
40
|
#include "src/core/ext/xds/xds_cluster_specifier_plugin.h"
|
48
41
|
#include "src/core/ext/xds/xds_http_filters.h"
|
@@ -50,9 +43,8 @@
|
|
50
43
|
#include "src/core/ext/xds/xds_transport_grpc.h"
|
51
44
|
#include "src/core/lib/channel/channel_args.h"
|
52
45
|
#include "src/core/lib/debug/trace.h"
|
53
|
-
#include "src/core/lib/gpr/env.h"
|
54
46
|
#include "src/core/lib/gprpp/debug_location.h"
|
55
|
-
#include "src/core/lib/gprpp/
|
47
|
+
#include "src/core/lib/gprpp/env.h"
|
56
48
|
#include "src/core/lib/gprpp/orphanable.h"
|
57
49
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
58
50
|
#include "src/core/lib/gprpp/sync.h"
|
@@ -60,7 +52,6 @@
|
|
60
52
|
#include "src/core/lib/iomgr/error.h"
|
61
53
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
62
54
|
#include "src/core/lib/iomgr/load_file.h"
|
63
|
-
#include "src/core/lib/json/json.h"
|
64
55
|
#include "src/core/lib/slice/slice_internal.h"
|
65
56
|
#include "src/core/lib/slice/slice_refcount.h"
|
66
57
|
#include "src/core/lib/transport/error_utils.h"
|
@@ -101,31 +92,31 @@ namespace {
|
|
101
92
|
|
102
93
|
absl::StatusOr<std::string> GetBootstrapContents(const char* fallback_config) {
|
103
94
|
// First, try GRPC_XDS_BOOTSTRAP env var.
|
104
|
-
|
105
|
-
if (path
|
95
|
+
auto path = GetEnv("GRPC_XDS_BOOTSTRAP");
|
96
|
+
if (path.has_value()) {
|
106
97
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
107
98
|
gpr_log(GPR_INFO,
|
108
99
|
"Got bootstrap file location from GRPC_XDS_BOOTSTRAP "
|
109
100
|
"environment variable: %s",
|
110
|
-
path
|
101
|
+
path->c_str());
|
111
102
|
}
|
112
103
|
grpc_slice contents;
|
113
104
|
grpc_error_handle error =
|
114
|
-
grpc_load_file(path
|
105
|
+
grpc_load_file(path->c_str(), /*add_null_terminator=*/true, &contents);
|
115
106
|
if (!GRPC_ERROR_IS_NONE(error)) return grpc_error_to_absl_status(error);
|
116
107
|
std::string contents_str(StringViewFromSlice(contents));
|
117
108
|
grpc_slice_unref_internal(contents);
|
118
109
|
return contents_str;
|
119
110
|
}
|
120
111
|
// Next, try GRPC_XDS_BOOTSTRAP_CONFIG env var.
|
121
|
-
|
122
|
-
if (env_config
|
112
|
+
auto env_config = GetEnv("GRPC_XDS_BOOTSTRAP_CONFIG");
|
113
|
+
if (env_config.has_value()) {
|
123
114
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
124
115
|
gpr_log(GPR_INFO,
|
125
116
|
"Got bootstrap contents from GRPC_XDS_BOOTSTRAP_CONFIG "
|
126
117
|
"environment variable");
|
127
118
|
}
|
128
|
-
return env_config
|
119
|
+
return std::move(*env_config);
|
129
120
|
}
|
130
121
|
// Finally, try fallback config.
|
131
122
|
if (fallback_config != nullptr) {
|
@@ -144,21 +135,16 @@ absl::StatusOr<std::string> GetBootstrapContents(const char* fallback_config) {
|
|
144
135
|
|
145
136
|
absl::StatusOr<RefCountedPtr<GrpcXdsClient>> GrpcXdsClient::GetOrCreate(
|
146
137
|
const ChannelArgs& args, const char* reason) {
|
147
|
-
// Construct certificate provider plugin map.
|
148
|
-
auto certificate_provider_plugin_map =
|
149
|
-
absl::make_unique<GrpcXdsCertificateProviderPluginMap>();
|
150
138
|
// If getting bootstrap from channel args, create a local XdsClient
|
151
139
|
// instance for the channel or server instead of using the global instance.
|
152
140
|
absl::optional<absl::string_view> bootstrap_config = args.GetString(
|
153
141
|
GRPC_ARG_TEST_ONLY_DO_NOT_USE_IN_PROD_XDS_BOOTSTRAP_CONFIG);
|
154
142
|
if (bootstrap_config.has_value()) {
|
155
|
-
|
156
|
-
|
157
|
-
*bootstrap_config, std::move(certificate_provider_plugin_map), &error);
|
158
|
-
if (!GRPC_ERROR_IS_NONE(error)) return grpc_error_to_absl_status(error);
|
143
|
+
auto bootstrap = GrpcXdsBootstrap::Create(*bootstrap_config);
|
144
|
+
if (!bootstrap.ok()) return bootstrap.status();
|
159
145
|
grpc_channel_args* xds_channel_args = args.GetPointer<grpc_channel_args>(
|
160
146
|
GRPC_ARG_TEST_ONLY_DO_NOT_USE_IN_PROD_XDS_CLIENT_CHANNEL_ARGS);
|
161
|
-
return MakeRefCounted<GrpcXdsClient>(std::move(bootstrap),
|
147
|
+
return MakeRefCounted<GrpcXdsClient>(std::move(*bootstrap),
|
162
148
|
ChannelArgs::FromC(xds_channel_args));
|
163
149
|
}
|
164
150
|
// Otherwise, use the global instance.
|
@@ -175,18 +161,16 @@ absl::StatusOr<RefCountedPtr<GrpcXdsClient>> GrpcXdsClient::GetOrCreate(
|
|
175
161
|
bootstrap_contents->c_str());
|
176
162
|
}
|
177
163
|
// Parse bootstrap.
|
178
|
-
|
179
|
-
|
180
|
-
*bootstrap_contents, std::move(certificate_provider_plugin_map), &error);
|
181
|
-
if (!GRPC_ERROR_IS_NONE(error)) return grpc_error_to_absl_status(error);
|
164
|
+
auto bootstrap = GrpcXdsBootstrap::Create(*bootstrap_contents);
|
165
|
+
if (!bootstrap.ok()) return bootstrap.status();
|
182
166
|
// Instantiate XdsClient.
|
183
167
|
auto xds_client = MakeRefCounted<GrpcXdsClient>(
|
184
|
-
std::move(bootstrap), ChannelArgs::FromC(g_channel_args));
|
168
|
+
std::move(*bootstrap), ChannelArgs::FromC(g_channel_args));
|
185
169
|
g_xds_client = xds_client.get();
|
186
170
|
return xds_client;
|
187
171
|
}
|
188
172
|
|
189
|
-
GrpcXdsClient::GrpcXdsClient(std::unique_ptr<
|
173
|
+
GrpcXdsClient::GrpcXdsClient(std::unique_ptr<GrpcXdsBootstrap> bootstrap,
|
190
174
|
const ChannelArgs& args)
|
191
175
|
: XdsClient(
|
192
176
|
std::move(bootstrap), MakeOrphanable<GrpcXdsTransportFactory>(args),
|
@@ -195,9 +179,8 @@ GrpcXdsClient::GrpcXdsClient(std::unique_ptr<XdsBootstrap> bootstrap,
|
|
195
179
|
GRPC_ARG_XDS_RESOURCE_DOES_NOT_EXIST_TIMEOUT_MS)
|
196
180
|
.value_or(Duration::Seconds(15)))),
|
197
181
|
certificate_provider_store_(MakeOrphanable<CertificateProviderStore>(
|
198
|
-
static_cast<const
|
199
|
-
|
200
|
-
->plugin_map())) {}
|
182
|
+
static_cast<const GrpcXdsBootstrap&>(this->bootstrap())
|
183
|
+
.certificate_providers())) {}
|
201
184
|
|
202
185
|
GrpcXdsClient::~GrpcXdsClient() {
|
203
186
|
MutexLock lock(g_mu);
|
@@ -229,51 +212,6 @@ void SetXdsFallbackBootstrapConfig(const char* config) {
|
|
229
212
|
|
230
213
|
} // namespace internal
|
231
214
|
|
232
|
-
//
|
233
|
-
// GrpcXdsCertificateProviderPluginMap
|
234
|
-
//
|
235
|
-
|
236
|
-
absl::Status GrpcXdsCertificateProviderPluginMap::AddPlugin(
|
237
|
-
const std::string& instance_name, const std::string& plugin_name,
|
238
|
-
const Json& config) {
|
239
|
-
CertificateProviderFactory* factory =
|
240
|
-
CertificateProviderRegistry::LookupCertificateProviderFactory(
|
241
|
-
plugin_name);
|
242
|
-
if (factory == nullptr) {
|
243
|
-
return absl::InvalidArgumentError(
|
244
|
-
absl::StrCat("Unrecognized plugin name: ", plugin_name));
|
245
|
-
}
|
246
|
-
grpc_error_handle error = GRPC_ERROR_NONE;
|
247
|
-
auto parsed_config = factory->CreateCertificateProviderConfig(config, &error);
|
248
|
-
if (!GRPC_ERROR_IS_NONE(error)) {
|
249
|
-
absl::Status status = grpc_error_to_absl_status(error);
|
250
|
-
GRPC_ERROR_UNREF(error);
|
251
|
-
return status;
|
252
|
-
}
|
253
|
-
plugin_map_.insert({instance_name, {plugin_name, std::move(parsed_config)}});
|
254
|
-
return absl::OkStatus();
|
255
|
-
}
|
256
|
-
|
257
|
-
bool GrpcXdsCertificateProviderPluginMap::HasPlugin(
|
258
|
-
const std::string& instance_name) const {
|
259
|
-
return plugin_map_.find(instance_name) != plugin_map_.end();
|
260
|
-
}
|
261
|
-
|
262
|
-
std::string GrpcXdsCertificateProviderPluginMap::ToString() const {
|
263
|
-
std::vector<std::string> parts = {"{\n"};
|
264
|
-
for (const auto& entry : plugin_map_) {
|
265
|
-
parts.push_back(
|
266
|
-
absl::StrFormat(" %s={\n"
|
267
|
-
" plugin_name=%s\n"
|
268
|
-
" config=%s\n"
|
269
|
-
" },\n",
|
270
|
-
entry.first, entry.second.plugin_name,
|
271
|
-
entry.second.config->ToString()));
|
272
|
-
}
|
273
|
-
parts.push_back("}");
|
274
|
-
return absl::StrJoin(parts, "");
|
275
|
-
}
|
276
|
-
|
277
215
|
} // namespace grpc_core
|
278
216
|
|
279
217
|
// The returned bytes may contain NULL(0), so we can't use c-string.
|
@@ -20,23 +20,20 @@
|
|
20
20
|
#include <grpc/support/port_platform.h>
|
21
21
|
|
22
22
|
#include <memory>
|
23
|
-
#include <string>
|
24
23
|
|
25
|
-
#include "absl/status/status.h"
|
26
24
|
#include "absl/status/statusor.h"
|
27
25
|
#include "absl/strings/string_view.h"
|
28
26
|
|
29
27
|
#include <grpc/impl/codegen/grpc_types.h>
|
30
28
|
|
31
29
|
#include "src/core/ext/xds/certificate_provider_store.h"
|
32
|
-
#include "src/core/ext/xds/
|
30
|
+
#include "src/core/ext/xds/xds_bootstrap_grpc.h"
|
33
31
|
#include "src/core/ext/xds/xds_client.h"
|
34
32
|
#include "src/core/lib/channel/channel_args.h"
|
35
33
|
#include "src/core/lib/gpr/useful.h"
|
36
34
|
#include "src/core/lib/gprpp/orphanable.h"
|
37
35
|
#include "src/core/lib/gprpp/ref_counted_ptr.h"
|
38
36
|
#include "src/core/lib/iomgr/iomgr_fwd.h"
|
39
|
-
#include "src/core/lib/json/json.h"
|
40
37
|
|
41
38
|
namespace grpc_core {
|
42
39
|
|
@@ -47,7 +44,7 @@ class GrpcXdsClient : public XdsClient {
|
|
47
44
|
const ChannelArgs& args, const char* reason);
|
48
45
|
|
49
46
|
// Do not instantiate directly -- use GetOrCreate() instead.
|
50
|
-
GrpcXdsClient(std::unique_ptr<
|
47
|
+
GrpcXdsClient(std::unique_ptr<GrpcXdsBootstrap> bootstrap,
|
51
48
|
const ChannelArgs& args);
|
52
49
|
~GrpcXdsClient() override;
|
53
50
|
|
@@ -77,26 +74,6 @@ void UnsetGlobalXdsClientForTest();
|
|
77
74
|
void SetXdsFallbackBootstrapConfig(const char* config);
|
78
75
|
} // namespace internal
|
79
76
|
|
80
|
-
// Exposed for testing purposes only.
|
81
|
-
class GrpcXdsCertificateProviderPluginMap
|
82
|
-
: public XdsCertificateProviderPluginMapInterface {
|
83
|
-
public:
|
84
|
-
const CertificateProviderStore::PluginDefinitionMap& plugin_map() const {
|
85
|
-
return plugin_map_;
|
86
|
-
}
|
87
|
-
|
88
|
-
absl::Status AddPlugin(const std::string& instance_name,
|
89
|
-
const std::string& plugin_name,
|
90
|
-
const Json& config) override;
|
91
|
-
|
92
|
-
bool HasPlugin(const std::string& instance_name) const override;
|
93
|
-
|
94
|
-
std::string ToString() const override;
|
95
|
-
|
96
|
-
private:
|
97
|
-
CertificateProviderStore::PluginDefinitionMap plugin_map_;
|
98
|
-
};
|
99
|
-
|
100
77
|
} // namespace grpc_core
|
101
78
|
|
102
79
|
#endif // GRPC_CORE_EXT_XDS_XDS_CLIENT_GRPC_H
|
@@ -53,7 +53,7 @@ XdsClusterDropStats::XdsClusterDropStats(
|
|
53
53
|
eds_service_name_(eds_service_name) {
|
54
54
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
55
55
|
gpr_log(GPR_INFO, "[xds_client %p] created drop stats %p for {%s, %s, %s}",
|
56
|
-
xds_client_.get(), this, lrs_server_.server_uri.c_str(),
|
56
|
+
xds_client_.get(), this, lrs_server_.server_uri().c_str(),
|
57
57
|
std::string(cluster_name_).c_str(),
|
58
58
|
std::string(eds_service_name_).c_str());
|
59
59
|
}
|
@@ -63,7 +63,7 @@ XdsClusterDropStats::~XdsClusterDropStats() {
|
|
63
63
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
64
64
|
gpr_log(GPR_INFO,
|
65
65
|
"[xds_client %p] destroying drop stats %p for {%s, %s, %s}",
|
66
|
-
xds_client_.get(), this, lrs_server_.server_uri.c_str(),
|
66
|
+
xds_client_.get(), this, lrs_server_.server_uri().c_str(),
|
67
67
|
std::string(cluster_name_).c_str(),
|
68
68
|
std::string(eds_service_name_).c_str());
|
69
69
|
}
|
@@ -108,7 +108,7 @@ XdsClusterLocalityStats::XdsClusterLocalityStats(
|
|
108
108
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
109
109
|
gpr_log(GPR_INFO,
|
110
110
|
"[xds_client %p] created locality stats %p for {%s, %s, %s, %s}",
|
111
|
-
xds_client_.get(), this, lrs_server_.server_uri.c_str(),
|
111
|
+
xds_client_.get(), this, lrs_server_.server_uri().c_str(),
|
112
112
|
std::string(cluster_name_).c_str(),
|
113
113
|
std::string(eds_service_name_).c_str(),
|
114
114
|
name_->AsHumanReadableString().c_str());
|
@@ -119,7 +119,7 @@ XdsClusterLocalityStats::~XdsClusterLocalityStats() {
|
|
119
119
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_xds_client_trace)) {
|
120
120
|
gpr_log(GPR_INFO,
|
121
121
|
"[xds_client %p] destroying locality stats %p for {%s, %s, %s, %s}",
|
122
|
-
xds_client_.get(), this, lrs_server_.server_uri.c_str(),
|
122
|
+
xds_client_.get(), this, lrs_server_.server_uri().c_str(),
|
123
123
|
std::string(cluster_name_).c_str(),
|
124
124
|
std::string(eds_service_name_).c_str(),
|
125
125
|
name_->AsHumanReadableString().c_str());
|
@@ -24,9 +24,10 @@
|
|
24
24
|
|
25
25
|
#include "absl/memory/memory.h"
|
26
26
|
#include "absl/status/status.h"
|
27
|
+
#include "absl/status/statusor.h"
|
27
28
|
#include "absl/strings/str_cat.h"
|
28
|
-
#include "absl/strings/str_format.h"
|
29
29
|
#include "absl/strings/str_join.h"
|
30
|
+
#include "absl/strings/strip.h"
|
30
31
|
#include "envoy/config/cluster/v3/circuit_breaker.upb.h"
|
31
32
|
#include "envoy/config/cluster/v3/cluster.upb.h"
|
32
33
|
#include "envoy/config/cluster/v3/cluster.upbdefs.h"
|
@@ -65,27 +66,26 @@ std::string XdsClusterResource::ToString() const {
|
|
65
66
|
case EDS:
|
66
67
|
contents.push_back("cluster_type=EDS");
|
67
68
|
if (!eds_service_name.empty()) {
|
68
|
-
contents.push_back(
|
69
|
-
absl::StrFormat("eds_service_name=%s", eds_service_name));
|
69
|
+
contents.push_back(absl::StrCat("eds_service_name=", eds_service_name));
|
70
70
|
}
|
71
71
|
break;
|
72
72
|
case LOGICAL_DNS:
|
73
73
|
contents.push_back("cluster_type=LOGICAL_DNS");
|
74
|
-
contents.push_back(absl::
|
74
|
+
contents.push_back(absl::StrCat("dns_hostname=", dns_hostname));
|
75
75
|
break;
|
76
76
|
case AGGREGATE:
|
77
77
|
contents.push_back("cluster_type=AGGREGATE");
|
78
78
|
contents.push_back(
|
79
|
-
absl::
|
80
|
-
|
79
|
+
absl::StrCat("prioritized_cluster_names=[",
|
80
|
+
absl::StrJoin(prioritized_cluster_names, ", "), "]"));
|
81
81
|
}
|
82
82
|
if (!common_tls_context.Empty()) {
|
83
|
-
contents.push_back(
|
84
|
-
|
83
|
+
contents.push_back(
|
84
|
+
absl::StrCat("common_tls_context=", common_tls_context.ToString()));
|
85
85
|
}
|
86
86
|
if (lrs_load_reporting_server.has_value()) {
|
87
|
-
contents.push_back(absl::
|
88
|
-
|
87
|
+
contents.push_back(absl::StrCat("lrs_load_reporting_server_name=",
|
88
|
+
lrs_load_reporting_server->server_uri()));
|
89
89
|
}
|
90
90
|
contents.push_back(absl::StrCat("lb_policy=", lb_policy));
|
91
91
|
if (lb_policy == "RING_HASH") {
|
@@ -93,7 +93,7 @@ std::string XdsClusterResource::ToString() const {
|
|
93
93
|
contents.push_back(absl::StrCat("max_ring_size=", max_ring_size));
|
94
94
|
}
|
95
95
|
contents.push_back(
|
96
|
-
absl::
|
96
|
+
absl::StrCat("max_concurrent_requests=", max_concurrent_requests));
|
97
97
|
return absl::StrCat("{", absl::StrJoin(contents, ", "), "}");
|
98
98
|
}
|
99
99
|
|
@@ -106,39 +106,41 @@ namespace {
|
|
106
106
|
absl::StatusOr<CommonTlsContext> UpstreamTlsContextParse(
|
107
107
|
const XdsResourceType::DecodeContext& context,
|
108
108
|
const envoy_config_core_v3_TransportSocket* transport_socket) {
|
109
|
-
CommonTlsContext common_tls_context;
|
110
|
-
// Record Upstream tls context
|
111
|
-
absl::string_view name = UpbStringToAbsl(
|
112
|
-
envoy_config_core_v3_TransportSocket_name(transport_socket));
|
113
|
-
if (name != "envoy.transport_sockets.tls") {
|
114
|
-
return absl::InvalidArgumentError(
|
115
|
-
absl::StrCat("Unrecognized transport socket: ", name));
|
116
|
-
}
|
117
109
|
auto* typed_config =
|
118
110
|
envoy_config_core_v3_TransportSocket_typed_config(transport_socket);
|
119
|
-
if (typed_config
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
111
|
+
if (typed_config == nullptr) {
|
112
|
+
return absl::InvalidArgumentError("transport_socket.typed_config not set");
|
113
|
+
}
|
114
|
+
absl::string_view type_url = absl::StripPrefix(
|
115
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(typed_config)),
|
116
|
+
"type.googleapis.com/");
|
117
|
+
if (type_url !=
|
118
|
+
"envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext") {
|
119
|
+
return absl::InvalidArgumentError(
|
120
|
+
absl::StrCat("Unrecognized transport socket type: ", type_url));
|
121
|
+
}
|
122
|
+
const upb_StringView encoded_upstream_tls_context =
|
123
|
+
google_protobuf_Any_value(typed_config);
|
124
|
+
auto* upstream_tls_context =
|
125
|
+
envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_parse(
|
126
|
+
encoded_upstream_tls_context.data, encoded_upstream_tls_context.size,
|
127
|
+
context.arena);
|
128
|
+
if (upstream_tls_context == nullptr) {
|
129
|
+
return absl::InvalidArgumentError("Can't decode upstream tls context.");
|
130
|
+
}
|
131
|
+
auto* common_tls_context_proto =
|
132
|
+
envoy_extensions_transport_sockets_tls_v3_UpstreamTlsContext_common_tls_context(
|
133
|
+
upstream_tls_context);
|
134
|
+
CommonTlsContext common_tls_context;
|
135
|
+
if (common_tls_context_proto != nullptr) {
|
136
|
+
auto common_context =
|
137
|
+
CommonTlsContext::Parse(context, common_tls_context_proto);
|
138
|
+
if (!common_context.ok()) {
|
139
|
+
return absl::InvalidArgumentError(
|
140
|
+
absl::StrCat("Error parsing UpstreamTlsContext: ",
|
141
|
+
common_context.status().message()));
|
141
142
|
}
|
143
|
+
common_tls_context = std::move(*common_context);
|
142
144
|
}
|
143
145
|
if (common_tls_context.certificate_validation_context
|
144
146
|
.ca_certificate_provider_instance.instance_name.empty()) {
|
@@ -245,42 +247,45 @@ absl::StatusOr<XdsClusterResource> CdsResourceParse(
|
|
245
247
|
absl::Status status = CdsLogicalDnsParse(cluster, &cds_update);
|
246
248
|
if (!status.ok()) errors.emplace_back(status.message());
|
247
249
|
} else {
|
248
|
-
|
250
|
+
const auto* custom_cluster_type =
|
251
|
+
envoy_config_cluster_v3_Cluster_cluster_type(cluster);
|
252
|
+
if (custom_cluster_type == nullptr) {
|
249
253
|
errors.push_back("DiscoveryType is not valid.");
|
250
254
|
} else {
|
251
|
-
const
|
252
|
-
|
253
|
-
envoy_config_cluster_v3_Cluster_cluster_type(cluster);
|
254
|
-
upb_StringView type_name =
|
255
|
-
envoy_config_cluster_v3_Cluster_CustomClusterType_name(
|
255
|
+
const auto* typed_config =
|
256
|
+
envoy_config_cluster_v3_Cluster_CustomClusterType_typed_config(
|
256
257
|
custom_cluster_type);
|
257
|
-
if (
|
258
|
-
errors.
|
258
|
+
if (typed_config == nullptr) {
|
259
|
+
errors.push_back("cluster_type.typed_config not set");
|
259
260
|
} else {
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
const envoy_extensions_clusters_aggregate_v3_ClusterConfig*
|
268
|
-
aggregate_cluster_config =
|
269
|
-
envoy_extensions_clusters_aggregate_v3_ClusterConfig_parse(
|
270
|
-
aggregate_cluster_config_upb_stringview.data,
|
271
|
-
aggregate_cluster_config_upb_stringview.size,
|
272
|
-
context.arena);
|
273
|
-
if (aggregate_cluster_config == nullptr) {
|
274
|
-
errors.emplace_back("Can't parse aggregate cluster.");
|
261
|
+
absl::string_view type_url = absl::StripPrefix(
|
262
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(typed_config)),
|
263
|
+
"type.googleapis.com/");
|
264
|
+
if (type_url !=
|
265
|
+
"envoy.extensions.clusters.aggregate.v3.ClusterConfig") {
|
266
|
+
errors.push_back(
|
267
|
+
absl::StrCat("unknown cluster_type extension: ", type_url));
|
275
268
|
} else {
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
269
|
+
cds_update.cluster_type = XdsClusterResource::ClusterType::AGGREGATE;
|
270
|
+
// Retrieve aggregate clusters.
|
271
|
+
const upb_StringView aggregate_cluster_config_upb_stringview =
|
272
|
+
google_protobuf_Any_value(typed_config);
|
273
|
+
const auto* aggregate_cluster_config =
|
274
|
+
envoy_extensions_clusters_aggregate_v3_ClusterConfig_parse(
|
275
|
+
aggregate_cluster_config_upb_stringview.data,
|
276
|
+
aggregate_cluster_config_upb_stringview.size, context.arena);
|
277
|
+
if (aggregate_cluster_config == nullptr) {
|
278
|
+
errors.emplace_back("Can't parse aggregate cluster.");
|
279
|
+
} else {
|
280
|
+
size_t size;
|
281
|
+
const upb_StringView* clusters =
|
282
|
+
envoy_extensions_clusters_aggregate_v3_ClusterConfig_clusters(
|
283
|
+
aggregate_cluster_config, &size);
|
284
|
+
for (size_t i = 0; i < size; ++i) {
|
285
|
+
const upb_StringView cluster = clusters[i];
|
286
|
+
cds_update.prioritized_cluster_names.emplace_back(
|
287
|
+
UpbStringToStdString(cluster));
|
288
|
+
}
|
284
289
|
}
|
285
290
|
}
|
286
291
|
}
|
@@ -353,7 +358,8 @@ absl::StatusOr<XdsClusterResource> CdsResourceParse(
|
|
353
358
|
if (!envoy_config_core_v3_ConfigSource_has_self(lrs_server)) {
|
354
359
|
errors.emplace_back("LRS ConfigSource is not self.");
|
355
360
|
}
|
356
|
-
cds_update.lrs_load_reporting_server.emplace(
|
361
|
+
cds_update.lrs_load_reporting_server.emplace(
|
362
|
+
static_cast<const GrpcXdsBootstrap::GrpcXdsServer&>(context.server));
|
357
363
|
}
|
358
364
|
// The Cluster resource encodes the circuit breaking parameters in a list of
|
359
365
|
// Thresholds messages, where each message specifies the parameters for a
|
@@ -506,38 +512,40 @@ void MaybeLogCluster(const XdsResourceType::DecodeContext& context,
|
|
506
512
|
|
507
513
|
} // namespace
|
508
514
|
|
509
|
-
|
515
|
+
XdsResourceType::DecodeResult XdsClusterResourceType::Decode(
|
510
516
|
const XdsResourceType::DecodeContext& context,
|
511
517
|
absl::string_view serialized_resource, bool is_v2) const {
|
518
|
+
DecodeResult result;
|
512
519
|
// Parse serialized proto.
|
513
520
|
auto* resource = envoy_config_cluster_v3_Cluster_parse(
|
514
521
|
serialized_resource.data(), serialized_resource.size(), context.arena);
|
515
522
|
if (resource == nullptr) {
|
516
|
-
|
523
|
+
result.resource =
|
524
|
+
absl::InvalidArgumentError("Can't parse Cluster resource.");
|
525
|
+
return result;
|
517
526
|
}
|
518
527
|
MaybeLogCluster(context, resource);
|
519
528
|
// Validate resource.
|
520
|
-
DecodeResult result;
|
521
529
|
result.name =
|
522
530
|
UpbStringToStdString(envoy_config_cluster_v3_Cluster_name(resource));
|
523
531
|
auto cds_resource = CdsResourceParse(context, resource, is_v2);
|
524
532
|
if (!cds_resource.ok()) {
|
525
533
|
if (GRPC_TRACE_FLAG_ENABLED(*context.tracer)) {
|
526
534
|
gpr_log(GPR_ERROR, "[xds_client %p] invalid Cluster %s: %s",
|
527
|
-
context.client, result.name
|
535
|
+
context.client, result.name->c_str(),
|
528
536
|
cds_resource.status().ToString().c_str());
|
529
537
|
}
|
530
538
|
result.resource = cds_resource.status();
|
531
539
|
} else {
|
532
540
|
if (GRPC_TRACE_FLAG_ENABLED(*context.tracer)) {
|
533
541
|
gpr_log(GPR_INFO, "[xds_client %p] parsed Cluster %s: %s", context.client,
|
534
|
-
result.name
|
542
|
+
result.name->c_str(), cds_resource->ToString().c_str());
|
535
543
|
}
|
536
544
|
auto resource = absl::make_unique<ResourceDataSubclass>();
|
537
545
|
resource->resource = std::move(*cds_resource);
|
538
546
|
result.resource = std::move(resource);
|
539
547
|
}
|
540
|
-
return
|
548
|
+
return result;
|
541
549
|
}
|
542
550
|
|
543
551
|
} // namespace grpc_core
|