grpc 1.49.1-x86_64-linux → 1.50.0-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 +33 -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 +112 -96
- 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 +84 -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 +13 -15
- 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 +1 -1
- 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 +1 -0
- data/src/core/lib/iomgr/resolve_address_windows.cc +1 -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/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 +31 -17
- 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
@@ -26,7 +26,6 @@
|
|
26
26
|
#include <string>
|
27
27
|
#include <vector>
|
28
28
|
|
29
|
-
#include "absl/status/statusor.h"
|
30
29
|
#include "absl/strings/string_view.h"
|
31
30
|
#include "absl/types/optional.h"
|
32
31
|
#include "envoy/config/cluster/v3/cluster.upbdefs.h"
|
@@ -36,6 +35,7 @@
|
|
36
35
|
|
37
36
|
#include "src/core/ext/filters/client_channel/lb_policy/outlier_detection/outlier_detection.h"
|
38
37
|
#include "src/core/ext/xds/xds_bootstrap.h"
|
38
|
+
#include "src/core/ext/xds/xds_bootstrap_grpc.h"
|
39
39
|
#include "src/core/ext/xds/xds_common_types.h"
|
40
40
|
#include "src/core/ext/xds/xds_resource_type.h"
|
41
41
|
#include "src/core/ext/xds/xds_resource_type_impl.h"
|
@@ -61,7 +61,7 @@ struct XdsClusterResource {
|
|
61
61
|
|
62
62
|
// The LRS server to use for load reporting.
|
63
63
|
// If not set, load reporting will be disabled.
|
64
|
-
absl::optional<
|
64
|
+
absl::optional<GrpcXdsBootstrap::GrpcXdsServer> lrs_load_reporting_server;
|
65
65
|
|
66
66
|
// The LB policy to use (e.g., "ROUND_ROBIN" or "RING_HASH").
|
67
67
|
std::string lb_policy;
|
@@ -101,9 +101,9 @@ class XdsClusterResourceType
|
|
101
101
|
return "envoy.api.v2.Cluster";
|
102
102
|
}
|
103
103
|
|
104
|
-
|
105
|
-
|
106
|
-
|
104
|
+
DecodeResult Decode(const XdsResourceType::DecodeContext& context,
|
105
|
+
absl::string_view serialized_resource,
|
106
|
+
bool is_v2) const override;
|
107
107
|
|
108
108
|
bool AllResourcesRequiredInSotW() const override { return true; }
|
109
109
|
|
@@ -33,6 +33,7 @@
|
|
33
33
|
|
34
34
|
#include <grpc/support/log.h>
|
35
35
|
|
36
|
+
#include "src/core/lib/config/core_configuration.h"
|
36
37
|
#include "src/core/lib/json/json.h"
|
37
38
|
#include "src/core/lib/load_balancing/lb_policy_registry.h"
|
38
39
|
#include "src/proto/grpc/lookup/v1/rls_config.upb.h"
|
@@ -97,7 +98,8 @@ XdsRouteLookupClusterSpecifierPlugin::GenerateLoadBalancingPolicyConfig(
|
|
97
98
|
// the gRPC LB policy registry instead of requiring each plugin to do that
|
98
99
|
// itself.
|
99
100
|
auto config =
|
100
|
-
|
101
|
+
CoreConfiguration::Get().lb_policy_registry().ParseLoadBalancingConfig(
|
102
|
+
lb_policy_config);
|
101
103
|
if (!config.ok()) {
|
102
104
|
return absl::InvalidArgumentError(absl::StrCat(
|
103
105
|
kXdsRouteLookupClusterSpecifierPluginConfigName,
|
@@ -21,6 +21,7 @@
|
|
21
21
|
#include <stddef.h>
|
22
22
|
|
23
23
|
#include <algorithm>
|
24
|
+
#include <map>
|
24
25
|
#include <utility>
|
25
26
|
|
26
27
|
#include "absl/status/status.h"
|
@@ -37,8 +38,9 @@
|
|
37
38
|
#include "upb/upb.h"
|
38
39
|
#include "xds/type/v3/typed_struct.upb.h"
|
39
40
|
|
41
|
+
#include "src/core/ext/xds/certificate_provider_store.h"
|
40
42
|
#include "src/core/ext/xds/upb_utils.h"
|
41
|
-
#include "src/core/ext/xds/
|
43
|
+
#include "src/core/ext/xds/xds_bootstrap_grpc.h"
|
42
44
|
#include "src/core/ext/xds/xds_client.h"
|
43
45
|
|
44
46
|
namespace grpc_core {
|
@@ -125,8 +127,11 @@ CertificateProviderInstanceParse(
|
|
125
127
|
UpbStringToStdString(
|
126
128
|
envoy_extensions_transport_sockets_tls_v3_CommonTlsContext_CertificateProviderInstance_certificate_name(
|
127
129
|
certificate_provider_instance_proto))};
|
128
|
-
|
129
|
-
|
130
|
+
const auto& bootstrap =
|
131
|
+
static_cast<const GrpcXdsBootstrap&>(context.client->bootstrap());
|
132
|
+
if (bootstrap.certificate_providers().find(
|
133
|
+
certificate_provider_plugin_instance.instance_name) ==
|
134
|
+
bootstrap.certificate_providers().end()) {
|
130
135
|
return absl::InvalidArgumentError(
|
131
136
|
absl::StrCat("Unrecognized certificate provider instance name: ",
|
132
137
|
certificate_provider_plugin_instance.instance_name));
|
@@ -147,8 +152,11 @@ CertificateProviderPluginInstanceParse(
|
|
147
152
|
UpbStringToStdString(
|
148
153
|
envoy_extensions_transport_sockets_tls_v3_CertificateProviderPluginInstance_certificate_name(
|
149
154
|
certificate_provider_plugin_instance_proto))};
|
150
|
-
|
151
|
-
|
155
|
+
const auto& bootstrap =
|
156
|
+
static_cast<const GrpcXdsBootstrap&>(context.client->bootstrap());
|
157
|
+
if (bootstrap.certificate_providers().find(
|
158
|
+
certificate_provider_plugin_instance.instance_name) ==
|
159
|
+
bootstrap.certificate_providers().end()) {
|
152
160
|
return absl::InvalidArgumentError(
|
153
161
|
absl::StrCat("Unrecognized certificate provider instance name: ",
|
154
162
|
certificate_provider_plugin_instance.instance_name));
|
@@ -25,6 +25,7 @@
|
|
25
25
|
|
26
26
|
#include "absl/memory/memory.h"
|
27
27
|
#include "absl/status/status.h"
|
28
|
+
#include "absl/status/statusor.h"
|
28
29
|
#include "absl/strings/str_cat.h"
|
29
30
|
#include "absl/strings/str_join.h"
|
30
31
|
#include "absl/types/optional.h"
|
@@ -342,40 +343,41 @@ absl::StatusOr<XdsEndpointResource> EdsResourceParse(
|
|
342
343
|
|
343
344
|
} // namespace
|
344
345
|
|
345
|
-
|
346
|
+
XdsResourceType::DecodeResult XdsEndpointResourceType::Decode(
|
346
347
|
const XdsResourceType::DecodeContext& context,
|
347
348
|
absl::string_view serialized_resource, bool is_v2) const {
|
349
|
+
DecodeResult result;
|
348
350
|
// Parse serialized proto.
|
349
351
|
auto* resource = envoy_config_endpoint_v3_ClusterLoadAssignment_parse(
|
350
352
|
serialized_resource.data(), serialized_resource.size(), context.arena);
|
351
353
|
if (resource == nullptr) {
|
352
|
-
|
354
|
+
result.resource = absl::InvalidArgumentError(
|
353
355
|
"Can't parse ClusterLoadAssignment resource.");
|
356
|
+
return result;
|
354
357
|
}
|
355
358
|
MaybeLogClusterLoadAssignment(context, resource);
|
356
359
|
// Validate resource.
|
357
|
-
DecodeResult result;
|
358
360
|
result.name = UpbStringToStdString(
|
359
361
|
envoy_config_endpoint_v3_ClusterLoadAssignment_cluster_name(resource));
|
360
362
|
auto eds_resource = EdsResourceParse(context, resource, is_v2);
|
361
363
|
if (!eds_resource.ok()) {
|
362
364
|
if (GRPC_TRACE_FLAG_ENABLED(*context.tracer)) {
|
363
365
|
gpr_log(GPR_ERROR, "[xds_client %p] invalid ClusterLoadAssignment %s: %s",
|
364
|
-
context.client, result.name
|
366
|
+
context.client, result.name->c_str(),
|
365
367
|
eds_resource.status().ToString().c_str());
|
366
368
|
}
|
367
369
|
result.resource = eds_resource.status();
|
368
370
|
} else {
|
369
371
|
if (GRPC_TRACE_FLAG_ENABLED(*context.tracer)) {
|
370
372
|
gpr_log(GPR_INFO, "[xds_client %p] parsed ClusterLoadAssignment %s: %s",
|
371
|
-
context.client, result.name
|
373
|
+
context.client, result.name->c_str(),
|
372
374
|
eds_resource->ToString().c_str());
|
373
375
|
}
|
374
376
|
auto resource = absl::make_unique<ResourceDataSubclass>();
|
375
377
|
resource->resource = std::move(*eds_resource);
|
376
378
|
result.resource = std::move(resource);
|
377
379
|
}
|
378
|
-
return
|
380
|
+
return result;
|
379
381
|
}
|
380
382
|
|
381
383
|
} // namespace grpc_core
|
@@ -28,7 +28,6 @@
|
|
28
28
|
#include <utility>
|
29
29
|
#include <vector>
|
30
30
|
|
31
|
-
#include "absl/status/statusor.h"
|
32
31
|
#include "absl/strings/string_view.h"
|
33
32
|
#include "envoy/config/endpoint/v3/endpoint.upbdefs.h"
|
34
33
|
#include "upb/def.h"
|
@@ -129,9 +128,9 @@ class XdsEndpointResourceType
|
|
129
128
|
return "envoy.api.v2.ClusterLoadAssignment";
|
130
129
|
}
|
131
130
|
|
132
|
-
|
133
|
-
|
134
|
-
|
131
|
+
DecodeResult Decode(const XdsResourceType::DecodeContext& context,
|
132
|
+
absl::string_view serialized_resource,
|
133
|
+
bool is_v2) const override;
|
135
134
|
|
136
135
|
void InitUpbSymtab(upb_DefPool* symtab) const override {
|
137
136
|
envoy_config_endpoint_v3_ClusterLoadAssignment_getmsgdef(symtab);
|
@@ -43,6 +43,7 @@
|
|
43
43
|
|
44
44
|
#include "src/core/ext/xds/upb_utils.h"
|
45
45
|
#include "src/core/ext/xds/xds_common_types.h"
|
46
|
+
#include "src/core/lib/config/core_configuration.h"
|
46
47
|
#include "src/core/lib/load_balancing/lb_policy_registry.h"
|
47
48
|
|
48
49
|
namespace grpc_core {
|
@@ -238,8 +239,9 @@ absl::StatusOr<Json::Array> XdsLbPolicyRegistry::ConvertXdsLbPolicyConfig(
|
|
238
239
|
} else if (type->typed_struct != nullptr) {
|
239
240
|
// Custom lb policy config
|
240
241
|
std::string custom_type = std::string(type->type);
|
241
|
-
if (!
|
242
|
-
|
242
|
+
if (!CoreConfiguration::Get()
|
243
|
+
.lb_policy_registry()
|
244
|
+
.LoadBalancingPolicyExists(custom_type.c_str(), nullptr)) {
|
243
245
|
// Skip unsupported custom lb policy.
|
244
246
|
continue;
|
245
247
|
}
|
@@ -25,9 +25,11 @@
|
|
25
25
|
|
26
26
|
#include "absl/memory/memory.h"
|
27
27
|
#include "absl/status/status.h"
|
28
|
+
#include "absl/status/statusor.h"
|
28
29
|
#include "absl/strings/str_cat.h"
|
29
30
|
#include "absl/strings/str_format.h"
|
30
31
|
#include "absl/strings/str_join.h"
|
32
|
+
#include "absl/strings/strip.h"
|
31
33
|
#include "envoy/config/core/v3/address.upb.h"
|
32
34
|
#include "envoy/config/core/v3/base.upb.h"
|
33
35
|
#include "envoy/config/core/v3/config_source.upb.h"
|
@@ -505,28 +507,30 @@ absl::StatusOr<XdsListenerResource::DownstreamTlsContext>
|
|
505
507
|
DownstreamTlsContextParse(
|
506
508
|
const XdsResourceType::DecodeContext& context,
|
507
509
|
const envoy_config_core_v3_TransportSocket* transport_socket) {
|
508
|
-
|
509
|
-
envoy_config_core_v3_TransportSocket_name(transport_socket));
|
510
|
-
if (name != "envoy.transport_sockets.tls") {
|
511
|
-
return absl::InvalidArgumentError(
|
512
|
-
absl::StrCat("Unrecognized transport socket: ", name));
|
513
|
-
}
|
514
|
-
std::vector<std::string> errors;
|
515
|
-
XdsListenerResource::DownstreamTlsContext downstream_tls_context;
|
516
|
-
auto* typed_config =
|
510
|
+
const auto* typed_config =
|
517
511
|
envoy_config_core_v3_TransportSocket_typed_config(transport_socket);
|
518
512
|
if (typed_config == nullptr) {
|
519
513
|
return absl::InvalidArgumentError("transport socket typed config unset");
|
520
514
|
}
|
515
|
+
absl::string_view type_url = absl::StripPrefix(
|
516
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(typed_config)),
|
517
|
+
"type.googleapis.com/");
|
518
|
+
if (type_url !=
|
519
|
+
"envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext") {
|
520
|
+
return absl::InvalidArgumentError(
|
521
|
+
absl::StrCat("Unrecognized transport socket type: ", type_url));
|
522
|
+
}
|
521
523
|
const upb_StringView encoded_downstream_tls_context =
|
522
524
|
google_protobuf_Any_value(typed_config);
|
523
|
-
auto* downstream_tls_context_proto =
|
525
|
+
const auto* downstream_tls_context_proto =
|
524
526
|
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_parse(
|
525
527
|
encoded_downstream_tls_context.data,
|
526
528
|
encoded_downstream_tls_context.size, context.arena);
|
527
529
|
if (downstream_tls_context_proto == nullptr) {
|
528
530
|
return absl::InvalidArgumentError("Can't decode downstream tls context.");
|
529
531
|
}
|
532
|
+
std::vector<std::string> errors;
|
533
|
+
XdsListenerResource::DownstreamTlsContext downstream_tls_context;
|
530
534
|
auto* common_tls_context =
|
531
535
|
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_common_tls_context(
|
532
536
|
downstream_tls_context_proto);
|
@@ -556,7 +560,6 @@ DownstreamTlsContextParse(
|
|
556
560
|
envoy_extensions_transport_sockets_tls_v3_DownstreamTlsContext_LENIENT_STAPLING) {
|
557
561
|
errors.emplace_back("ocsp_staple_policy: Only LENIENT_STAPLING supported");
|
558
562
|
}
|
559
|
-
|
560
563
|
if (downstream_tls_context.common_tls_context
|
561
564
|
.tls_certificate_provider_instance.instance_name.empty()) {
|
562
565
|
errors.emplace_back(
|
@@ -712,10 +715,10 @@ absl::StatusOr<FilterChain> FilterChainParse(
|
|
712
715
|
if (typed_config == nullptr) {
|
713
716
|
errors.emplace_back("No typed_config found in filter.");
|
714
717
|
} else {
|
715
|
-
absl::string_view type_url =
|
716
|
-
UpbStringToAbsl(google_protobuf_Any_type_url(typed_config))
|
718
|
+
absl::string_view type_url = absl::StripPrefix(
|
719
|
+
UpbStringToAbsl(google_protobuf_Any_type_url(typed_config)),
|
720
|
+
"type.googleapis.com/");
|
717
721
|
if (type_url !=
|
718
|
-
"type.googleapis.com/"
|
719
722
|
"envoy.extensions.filters.network.http_connection_manager.v3."
|
720
723
|
"HttpConnectionManager") {
|
721
724
|
errors.emplace_back(absl::StrCat("Unsupported filter type ", type_url));
|
@@ -1059,39 +1062,41 @@ void MaybeLogListener(const XdsResourceType::DecodeContext& context,
|
|
1059
1062
|
|
1060
1063
|
} // namespace
|
1061
1064
|
|
1062
|
-
|
1065
|
+
XdsResourceType::DecodeResult XdsListenerResourceType::Decode(
|
1063
1066
|
const XdsResourceType::DecodeContext& context,
|
1064
1067
|
absl::string_view serialized_resource, bool is_v2) const {
|
1068
|
+
DecodeResult result;
|
1065
1069
|
// Parse serialized proto.
|
1066
1070
|
auto* resource = envoy_config_listener_v3_Listener_parse(
|
1067
1071
|
serialized_resource.data(), serialized_resource.size(), context.arena);
|
1068
1072
|
if (resource == nullptr) {
|
1069
|
-
|
1073
|
+
result.resource =
|
1074
|
+
absl::InvalidArgumentError("Can't parse Listener resource.");
|
1075
|
+
return result;
|
1070
1076
|
}
|
1071
1077
|
MaybeLogListener(context, resource);
|
1072
1078
|
// Validate resource.
|
1073
|
-
DecodeResult result;
|
1074
1079
|
result.name =
|
1075
1080
|
UpbStringToStdString(envoy_config_listener_v3_Listener_name(resource));
|
1076
1081
|
auto listener = LdsResourceParse(context, resource, is_v2);
|
1077
1082
|
if (!listener.ok()) {
|
1078
1083
|
if (GRPC_TRACE_FLAG_ENABLED(*context.tracer)) {
|
1079
1084
|
gpr_log(GPR_ERROR, "[xds_client %p] invalid Listener %s: %s",
|
1080
|
-
context.client, result.name
|
1085
|
+
context.client, result.name->c_str(),
|
1081
1086
|
listener.status().ToString().c_str());
|
1082
1087
|
}
|
1083
1088
|
result.resource = listener.status();
|
1084
1089
|
} else {
|
1085
1090
|
if (GRPC_TRACE_FLAG_ENABLED(*context.tracer)) {
|
1086
1091
|
gpr_log(GPR_INFO, "[xds_client %p] parsed Listener %s: %s",
|
1087
|
-
context.client, result.name
|
1092
|
+
context.client, result.name->c_str(),
|
1088
1093
|
listener->ToString().c_str());
|
1089
1094
|
}
|
1090
1095
|
auto resource = absl::make_unique<ResourceDataSubclass>();
|
1091
1096
|
resource->resource = std::move(*listener);
|
1092
1097
|
result.resource = std::move(resource);
|
1093
1098
|
}
|
1094
|
-
return
|
1099
|
+
return result;
|
1095
1100
|
}
|
1096
1101
|
|
1097
1102
|
} // namespace grpc_core
|
@@ -30,7 +30,6 @@
|
|
30
30
|
#include <string>
|
31
31
|
#include <vector>
|
32
32
|
|
33
|
-
#include "absl/status/statusor.h"
|
34
33
|
#include "absl/strings/string_view.h"
|
35
34
|
#include "absl/types/optional.h"
|
36
35
|
#include "envoy/config/listener/v3/listener.upbdefs.h"
|
@@ -210,9 +209,9 @@ class XdsListenerResourceType
|
|
210
209
|
return "envoy.api.v2.Listener";
|
211
210
|
}
|
212
211
|
|
213
|
-
|
214
|
-
|
215
|
-
|
212
|
+
DecodeResult Decode(const XdsResourceType::DecodeContext& context,
|
213
|
+
absl::string_view serialized_resource,
|
214
|
+
bool is_v2) const override;
|
216
215
|
|
217
216
|
bool AllResourcesRequiredInSotW() const override { return true; }
|
218
217
|
|
@@ -23,6 +23,7 @@
|
|
23
23
|
|
24
24
|
#include "absl/status/statusor.h"
|
25
25
|
#include "absl/strings/string_view.h"
|
26
|
+
#include "absl/types/optional.h"
|
26
27
|
#include "upb/arena.h"
|
27
28
|
#include "upb/def.h"
|
28
29
|
|
@@ -31,6 +32,8 @@
|
|
31
32
|
|
32
33
|
namespace grpc_core {
|
33
34
|
|
35
|
+
class XdsClient;
|
36
|
+
|
34
37
|
// Interface for an xDS resource type.
|
35
38
|
// Used to inject type-specific logic into XdsClient.
|
36
39
|
class XdsResourceType {
|
@@ -53,7 +56,11 @@ class XdsResourceType {
|
|
53
56
|
|
54
57
|
// Result returned by Decode().
|
55
58
|
struct DecodeResult {
|
56
|
-
|
59
|
+
// The resource's name, if it can be determined.
|
60
|
+
// If the name is not returned, the resource field should contain a
|
61
|
+
// non-OK status.
|
62
|
+
absl::optional<std::string> name;
|
63
|
+
// The parsed and validated resource, or an error status.
|
57
64
|
absl::StatusOr<std::unique_ptr<ResourceData>> resource;
|
58
65
|
};
|
59
66
|
|
@@ -66,13 +73,9 @@ class XdsResourceType {
|
|
66
73
|
virtual absl::string_view v2_type_url() const = 0;
|
67
74
|
|
68
75
|
// Decodes and validates a serialized resource proto.
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
// Otherwise, returns a DecodeResult with a valid resource.
|
73
|
-
virtual absl::StatusOr<DecodeResult> Decode(
|
74
|
-
const DecodeContext& context, absl::string_view serialized_resource,
|
75
|
-
bool is_v2) const = 0;
|
76
|
+
virtual DecodeResult Decode(const DecodeContext& context,
|
77
|
+
absl::string_view serialized_resource,
|
78
|
+
bool is_v2) const = 0;
|
76
79
|
|
77
80
|
// Returns true if r1 and r2 are equal.
|
78
81
|
// Must be invoked only on resources returned by this object's Decode()
|
@@ -55,7 +55,6 @@
|
|
55
55
|
#include "upb/upb.h"
|
56
56
|
|
57
57
|
#include <grpc/status.h>
|
58
|
-
#include <grpc/support/alloc.h>
|
59
58
|
#include <grpc/support/log.h>
|
60
59
|
|
61
60
|
#include "src/core/ext/xds/upb_utils.h"
|
@@ -68,8 +67,8 @@
|
|
68
67
|
#include "src/core/ext/xds/xds_routing.h"
|
69
68
|
#include "src/core/lib/channel/status_util.h"
|
70
69
|
#include "src/core/lib/debug/trace.h"
|
71
|
-
#include "src/core/lib/gpr/env.h"
|
72
70
|
#include "src/core/lib/gpr/string.h"
|
71
|
+
#include "src/core/lib/gprpp/env.h"
|
73
72
|
#include "src/core/lib/gprpp/match.h"
|
74
73
|
#include "src/core/lib/gprpp/time.h"
|
75
74
|
#include "src/core/lib/iomgr/error.h"
|
@@ -79,19 +78,19 @@ namespace grpc_core {
|
|
79
78
|
|
80
79
|
// TODO(yashykt): Remove once RBAC is no longer experimental
|
81
80
|
bool XdsRbacEnabled() {
|
82
|
-
|
81
|
+
auto value = GetEnv("GRPC_XDS_EXPERIMENTAL_RBAC");
|
82
|
+
if (!value.has_value()) return false;
|
83
83
|
bool parsed_value;
|
84
|
-
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
85
|
-
gpr_free(value);
|
84
|
+
bool parse_succeeded = gpr_parse_bool_value(value->c_str(), &parsed_value);
|
86
85
|
return parse_succeeded && parsed_value;
|
87
86
|
}
|
88
87
|
|
89
88
|
// TODO(donnadionne): Remove once RLS is no longer experimental
|
90
89
|
bool XdsRlsEnabled() {
|
91
|
-
|
90
|
+
auto value = GetEnv("GRPC_EXPERIMENTAL_XDS_RLS_LB");
|
91
|
+
if (!value.has_value()) return false;
|
92
92
|
bool parsed_value;
|
93
|
-
bool parse_succeeded = gpr_parse_bool_value(value, &parsed_value);
|
94
|
-
gpr_free(value);
|
93
|
+
bool parse_succeeded = gpr_parse_bool_value(value->c_str(), &parsed_value);
|
95
94
|
return parse_succeeded && parsed_value;
|
96
95
|
}
|
97
96
|
|
@@ -1113,41 +1112,41 @@ void MaybeLogRouteConfiguration(
|
|
1113
1112
|
|
1114
1113
|
} // namespace
|
1115
1114
|
|
1116
|
-
|
1117
|
-
XdsRouteConfigResourceType::Decode(
|
1115
|
+
XdsResourceType::DecodeResult XdsRouteConfigResourceType::Decode(
|
1118
1116
|
const XdsResourceType::DecodeContext& context,
|
1119
1117
|
absl::string_view serialized_resource, bool /*is_v2*/) const {
|
1118
|
+
DecodeResult result;
|
1120
1119
|
// Parse serialized proto.
|
1121
1120
|
auto* resource = envoy_config_route_v3_RouteConfiguration_parse(
|
1122
1121
|
serialized_resource.data(), serialized_resource.size(), context.arena);
|
1123
1122
|
if (resource == nullptr) {
|
1124
|
-
|
1125
|
-
"Can't parse RouteConfiguration resource.");
|
1123
|
+
result.resource =
|
1124
|
+
absl::InvalidArgumentError("Can't parse RouteConfiguration resource.");
|
1125
|
+
return result;
|
1126
1126
|
}
|
1127
1127
|
MaybeLogRouteConfiguration(context, resource);
|
1128
1128
|
// Validate resource.
|
1129
|
-
DecodeResult result;
|
1130
1129
|
result.name = UpbStringToStdString(
|
1131
1130
|
envoy_config_route_v3_RouteConfiguration_name(resource));
|
1132
1131
|
auto rds_update = XdsRouteConfigResource::Parse(context, resource);
|
1133
1132
|
if (!rds_update.ok()) {
|
1134
1133
|
if (GRPC_TRACE_FLAG_ENABLED(*context.tracer)) {
|
1135
1134
|
gpr_log(GPR_ERROR, "[xds_client %p] invalid RouteConfiguration %s: %s",
|
1136
|
-
context.client, result.name
|
1135
|
+
context.client, result.name->c_str(),
|
1137
1136
|
rds_update.status().ToString().c_str());
|
1138
1137
|
}
|
1139
1138
|
result.resource = rds_update.status();
|
1140
1139
|
} else {
|
1141
1140
|
if (GRPC_TRACE_FLAG_ENABLED(*context.tracer)) {
|
1142
1141
|
gpr_log(GPR_INFO, "[xds_client %p] parsed RouteConfiguration %s: %s",
|
1143
|
-
context.client, result.name
|
1142
|
+
context.client, result.name->c_str(),
|
1144
1143
|
rds_update->ToString().c_str());
|
1145
1144
|
}
|
1146
1145
|
auto resource = absl::make_unique<ResourceDataSubclass>();
|
1147
1146
|
resource->resource = std::move(*rds_update);
|
1148
1147
|
result.resource = std::move(resource);
|
1149
1148
|
}
|
1150
|
-
return
|
1149
|
+
return result;
|
1151
1150
|
}
|
1152
1151
|
|
1153
1152
|
} // namespace grpc_core
|
@@ -226,9 +226,9 @@ class XdsRouteConfigResourceType
|
|
226
226
|
return "envoy.api.v2.RouteConfiguration";
|
227
227
|
}
|
228
228
|
|
229
|
-
|
230
|
-
|
231
|
-
|
229
|
+
DecodeResult Decode(const XdsResourceType::DecodeContext& context,
|
230
|
+
absl::string_view serialized_resource,
|
231
|
+
bool /*is_v2*/) const override;
|
232
232
|
|
233
233
|
void InitUpbSymtab(upb_DefPool* symtab) const override {
|
234
234
|
envoy_config_route_v3_RouteConfiguration_getmsgdef(symtab);
|
@@ -51,7 +51,7 @@
|
|
51
51
|
#include "src/core/ext/filters/server_config_selector/server_config_selector.h"
|
52
52
|
#include "src/core/ext/filters/server_config_selector/server_config_selector_filter.h"
|
53
53
|
#include "src/core/ext/xds/certificate_provider_store.h"
|
54
|
-
#include "src/core/ext/xds/
|
54
|
+
#include "src/core/ext/xds/xds_bootstrap_grpc.h"
|
55
55
|
#include "src/core/ext/xds/xds_certificate_provider.h"
|
56
56
|
#include "src/core/ext/xds/xds_channel_stack_modifier.h"
|
57
57
|
#include "src/core/ext/xds/xds_client_grpc.h"
|
@@ -502,7 +502,8 @@ void XdsServerConfigFetcher::StartWatch(
|
|
502
502
|
XdsListenerResourceType::StartWatch(
|
503
503
|
xds_client_.get(),
|
504
504
|
ListenerResourceName(
|
505
|
-
xds_client_->bootstrap()
|
505
|
+
static_cast<const GrpcXdsBootstrap&>(xds_client_->bootstrap())
|
506
|
+
.server_listener_resource_name_template(),
|
506
507
|
listening_address),
|
507
508
|
std::move(listener_watcher));
|
508
509
|
MutexLock lock(&mu_);
|
@@ -518,7 +519,8 @@ void XdsServerConfigFetcher::CancelWatch(
|
|
518
519
|
XdsListenerResourceType::CancelWatch(
|
519
520
|
xds_client_.get(),
|
520
521
|
ListenerResourceName(
|
521
|
-
xds_client_->bootstrap()
|
522
|
+
static_cast<const GrpcXdsBootstrap&>(xds_client_->bootstrap())
|
523
|
+
.server_listener_resource_name_template(),
|
522
524
|
it->second->listening_address()),
|
523
525
|
it->second, false /* delay_unsubscription */);
|
524
526
|
listener_watchers_.erase(it);
|
@@ -1344,8 +1346,8 @@ grpc_server_config_fetcher* grpc_server_config_fetcher_xds_create(
|
|
1344
1346
|
xds_client.status().ToString().c_str());
|
1345
1347
|
return nullptr;
|
1346
1348
|
}
|
1347
|
-
if ((
|
1348
|
-
->bootstrap()
|
1349
|
+
if (static_cast<const grpc_core::GrpcXdsBootstrap&>(
|
1350
|
+
(*xds_client)->bootstrap())
|
1349
1351
|
.server_listener_resource_name_template()
|
1350
1352
|
.empty()) {
|
1351
1353
|
gpr_log(GPR_ERROR,
|
@@ -24,6 +24,8 @@
|
|
24
24
|
#include <memory>
|
25
25
|
#include <utility>
|
26
26
|
|
27
|
+
#include "absl/strings/str_cat.h"
|
28
|
+
|
27
29
|
#include <grpc/byte_buffer.h>
|
28
30
|
#include <grpc/byte_buffer_reader.h>
|
29
31
|
#include <grpc/grpc.h>
|
@@ -34,6 +36,7 @@
|
|
34
36
|
|
35
37
|
#include "src/core/ext/filters/client_channel/client_channel.h"
|
36
38
|
#include "src/core/ext/xds/xds_bootstrap.h"
|
39
|
+
#include "src/core/ext/xds/xds_bootstrap_grpc.h"
|
37
40
|
#include "src/core/lib/channel/channel_args.h"
|
38
41
|
#include "src/core/lib/channel/channel_fwd.h"
|
39
42
|
#include "src/core/lib/channel/channel_stack.h"
|
@@ -51,6 +54,7 @@
|
|
51
54
|
#include "src/core/lib/slice/slice_refcount.h"
|
52
55
|
#include "src/core/lib/surface/call.h"
|
53
56
|
#include "src/core/lib/surface/channel.h"
|
57
|
+
#include "src/core/lib/surface/init_internally.h"
|
54
58
|
#include "src/core/lib/surface/lame_client.h"
|
55
59
|
#include "src/core/lib/transport/connectivity_state.h"
|
56
60
|
|
@@ -233,7 +237,9 @@ class GrpcXdsTransportFactory::GrpcXdsTransport::StateWatcher
|
|
233
237
|
void OnConnectivityStateChange(grpc_connectivity_state new_state,
|
234
238
|
const absl::Status& status) override {
|
235
239
|
if (new_state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
|
236
|
-
on_connectivity_failure_(
|
240
|
+
on_connectivity_failure_(absl::Status(
|
241
|
+
status.code(),
|
242
|
+
absl::StrCat("channel in TRANSIENT_FAILURE: ", status.message())));
|
237
243
|
}
|
238
244
|
}
|
239
245
|
|
@@ -247,11 +253,11 @@ class GrpcXdsTransportFactory::GrpcXdsTransport::StateWatcher
|
|
247
253
|
namespace {
|
248
254
|
|
249
255
|
grpc_channel* CreateXdsChannel(const ChannelArgs& args,
|
250
|
-
const
|
256
|
+
const GrpcXdsBootstrap::GrpcXdsServer& server) {
|
251
257
|
RefCountedPtr<grpc_channel_credentials> channel_creds =
|
252
258
|
CoreConfiguration::Get().channel_creds_registry().CreateChannelCreds(
|
253
|
-
server.channel_creds_type, server.channel_creds_config);
|
254
|
-
return grpc_channel_create(server.server_uri.c_str(), channel_creds.get(),
|
259
|
+
server.channel_creds_type(), server.channel_creds_config());
|
260
|
+
return grpc_channel_create(server.server_uri().c_str(), channel_creds.get(),
|
255
261
|
args.ToC().get());
|
256
262
|
}
|
257
263
|
|
@@ -268,7 +274,9 @@ GrpcXdsTransportFactory::GrpcXdsTransport::GrpcXdsTransport(
|
|
268
274
|
std::function<void(absl::Status)> on_connectivity_failure,
|
269
275
|
absl::Status* status)
|
270
276
|
: factory_(factory) {
|
271
|
-
channel_ = CreateXdsChannel(
|
277
|
+
channel_ = CreateXdsChannel(
|
278
|
+
factory->args_,
|
279
|
+
static_cast<const GrpcXdsBootstrap::GrpcXdsServer&>(server));
|
272
280
|
GPR_ASSERT(channel_ != nullptr);
|
273
281
|
if (IsLameChannel(channel_)) {
|
274
282
|
*status = absl::UnavailableError("xds client has a lame channel");
|
@@ -327,14 +335,14 @@ GrpcXdsTransportFactory::GrpcXdsTransportFactory(const ChannelArgs& args)
|
|
327
335
|
interested_parties_(grpc_pollset_set_create()) {
|
328
336
|
// Calling grpc_init to ensure gRPC does not shut down until the XdsClient is
|
329
337
|
// destroyed.
|
330
|
-
|
338
|
+
InitInternally();
|
331
339
|
}
|
332
340
|
|
333
341
|
GrpcXdsTransportFactory::~GrpcXdsTransportFactory() {
|
334
342
|
grpc_pollset_set_destroy(interested_parties_);
|
335
343
|
// Calling grpc_shutdown to ensure gRPC does not shut down until the XdsClient
|
336
344
|
// is destroyed.
|
337
|
-
|
345
|
+
ShutdownInternally();
|
338
346
|
}
|
339
347
|
|
340
348
|
OrphanablePtr<XdsTransportFactory::XdsTransport>
|
@@ -22,8 +22,6 @@
|
|
22
22
|
|
23
23
|
#include <algorithm>
|
24
24
|
|
25
|
-
#include "src/core/lib/iomgr/exec_ctx.h"
|
26
|
-
|
27
25
|
namespace grpc_core {
|
28
26
|
|
29
27
|
BackOff::BackOff(const Options& options) : options_(options) { Reset(); }
|
@@ -31,14 +29,14 @@ BackOff::BackOff(const Options& options) : options_(options) { Reset(); }
|
|
31
29
|
Timestamp BackOff::NextAttemptTime() {
|
32
30
|
if (initial_) {
|
33
31
|
initial_ = false;
|
34
|
-
return current_backoff_ +
|
32
|
+
return current_backoff_ + Timestamp::Now();
|
35
33
|
}
|
36
34
|
current_backoff_ = std::min(current_backoff_ * options_.multiplier(),
|
37
35
|
options_.max_backoff());
|
38
36
|
const Duration jitter = Duration::FromSecondsAsDouble(
|
39
37
|
absl::Uniform(rand_gen_, -options_.jitter() * current_backoff_.seconds(),
|
40
38
|
options_.jitter() * current_backoff_.seconds()));
|
41
|
-
return
|
39
|
+
return Timestamp::Now() + current_backoff_ + jitter;
|
42
40
|
}
|
43
41
|
|
44
42
|
void BackOff::Reset() {
|
@@ -19,8 +19,6 @@
|
|
19
19
|
|
20
20
|
#include <utility>
|
21
21
|
|
22
|
-
#include "absl/utility/utility.h"
|
23
|
-
|
24
22
|
#include "src/core/lib/channel/channel_stack.h"
|
25
23
|
#include "src/core/lib/promise/context.h"
|
26
24
|
#include "src/core/lib/resource_quota/arena.h"
|
@@ -47,7 +45,7 @@ class CallFinalization {
|
|
47
45
|
}
|
48
46
|
|
49
47
|
void Run(const grpc_call_final_info* final_info) {
|
50
|
-
if (Finalizer* f =
|
48
|
+
if (Finalizer* f = std::exchange(first_, nullptr)) f->Run(final_info);
|
51
49
|
}
|
52
50
|
|
53
51
|
private:
|