grpc 1.83.1 → 1.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Makefile +21 -17
- data/include/grpc/credentials.h +10 -0
- data/include/grpc/grpc_security_constants.h +2 -0
- data/include/grpc/impl/channel_arg_names.h +9 -0
- data/src/core/call/call_filters.h +4 -2
- data/src/core/call/client_call.cc +20 -8
- data/src/core/call/client_call.h +4 -0
- data/src/core/call/interception_chain.cc +2 -0
- data/src/core/call/interception_chain.h +14 -1
- data/src/core/call/metadata.cc +1 -3
- data/src/core/call/metadata_batch.h +13 -5
- data/src/core/call/server_call.cc +31 -14
- data/src/core/call/server_call.h +4 -0
- data/src/core/channelz/text_encode.cc +9 -4
- data/src/core/channelz/v2tov1/convert.cc +2 -2
- data/src/core/client_channel/backup_poller.cc +1 -2
- data/src/core/client_channel/client_channel.cc +6 -33
- data/src/core/client_channel/client_channel_filter.cc +22 -55
- data/src/core/client_channel/client_channel_filter.h +2 -2
- data/src/core/client_channel/client_channel_service_config.cc +3 -19
- data/src/core/client_channel/direct_channel.cc +7 -1
- data/src/core/client_channel/direct_channel.h +2 -2
- data/src/core/client_channel/load_balanced_call_destination.cc +5 -3
- data/src/core/client_channel/retry_filter_legacy_call_data.cc +5 -12
- data/src/core/client_channel/subchannel.cc +310 -1058
- data/src/core/client_channel/subchannel.h +44 -329
- data/src/core/client_channel/subchannel_metrics.cc +48 -0
- data/src/core/client_channel/subchannel_metrics.h +60 -0
- data/src/core/credentials/call/external/file_external_account_credentials.cc +1 -1
- data/src/core/credentials/call/external/url_external_account_credentials.cc +2 -3
- data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.cc +8 -24
- data/src/core/credentials/call/gcp_service_account_identity/gcp_service_account_identity_credentials.h +3 -6
- data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.cc +525 -0
- data/src/core/credentials/call/gdch_service_account/gdch_service_account_credentials.h +138 -0
- data/src/core/credentials/call/json_util.h +1 -0
- data/src/core/credentials/call/jwt/json_token.cc +10 -2
- data/src/core/credentials/call/jwt/jwt_verifier.cc +15 -1
- data/src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.cc +1 -1
- data/src/core/credentials/call/oauth2/oauth2_credentials.cc +42 -79
- data/src/core/credentials/call/oauth2/oauth2_credentials.h +2 -5
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.cc +52 -31
- data/src/core/credentials/call/token_fetcher/token_fetcher_credentials.h +21 -8
- data/src/core/credentials/transport/google_default/google_default_credentials.cc +3 -4
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +59 -72
- data/src/core/credentials/transport/ssl/ssl_credentials.h +9 -8
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +12 -6
- data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -4
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +29 -18
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +9 -6
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +45 -56
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +5 -4
- data/src/core/credentials/transport/tls/grpc_tls_certificate_selector.h +26 -0
- data/src/core/credentials/transport/tls/grpc_tls_crl_provider.cc +1 -1
- data/src/core/credentials/transport/tls/load_system_roots.h +2 -6
- data/src/core/credentials/transport/tls/load_system_roots_fallback.cc +2 -4
- data/src/core/credentials/transport/tls/load_system_roots_supported.cc +13 -15
- data/src/core/credentials/transport/tls/load_system_roots_supported.h +3 -2
- data/src/core/credentials/transport/tls/load_system_roots_windows.cc +5 -8
- data/src/core/credentials/transport/tls/spiffe_utils.cc +1 -1
- data/src/core/credentials/transport/tls/ssl_utils.cc +39 -28
- data/src/core/credentials/transport/tls/ssl_utils.h +12 -49
- data/src/core/credentials/transport/tls/tls_security_connector.cc +48 -33
- data/src/core/credentials/transport/tls/tls_security_connector.h +31 -10
- data/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +15 -11
- data/src/core/ext/filters/http/http_filters_plugin.cc +20 -9
- data/src/core/ext/filters/rbac/rbac_filter.cc +43 -21
- data/src/core/ext/filters/rbac/rbac_filter.h +21 -3
- data/src/core/ext/filters/rbac/rbac_service_config_parser.cc +2 -2
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +6 -20
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +32 -67
- data/src/core/ext/transport/chttp2/transport/flow_control.cc +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +78 -4
- data/src/core/ext/transport/chttp2/transport/frame.h +2 -0
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/goaway.h +7 -0
- data/src/core/ext/transport/chttp2/transport/hpack_parser.cc +5 -3
- data/src/core/ext/transport/chttp2/transport/hpack_parser.h +3 -1
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +141 -130
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +22 -22
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.cc +402 -269
- data/src/core/ext/transport/chttp2/transport/http2_server_transport.h +80 -49
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +1 -2
- data/src/core/ext/transport/chttp2/transport/http2_status.h +38 -37
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +178 -5
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +345 -5
- data/src/core/ext/transport/chttp2/transport/parsing.cc +5 -5
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +3 -2
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +25 -5
- data/src/core/ext/transport/chttp2/transport/ping_rate_policy.cc +3 -4
- data/src/core/ext/transport/chttp2/transport/read_context.h +30 -3
- data/src/core/ext/transport/chttp2/transport/stream.h +65 -23
- data/src/core/ext/transport/chttp2/transport/writing.cc +0 -3
- data/src/core/ext/transport/inproc/inproc_transport.cc +1 -5
- data/src/core/ext/transport/inproc/legacy_inproc_transport.cc +4 -17
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb.h +1912 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.c +300 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upb_minitable.h +37 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb.h +187 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.c +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upb_minitable.h +31 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb.h +2362 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.c +556 -0
- data/src/core/ext/upb-gen/envoy/service/ext_proc/v3/external_processor.upb_minitable.h +47 -0
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb.h +5 -5
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.c +3 -3
- data/src/core/ext/upb-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upb_minitable.h +5 -5
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.c +453 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/ext_proc.upbdefs.h +67 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.c +142 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/ext_proc/v3/processing_mode.upbdefs.h +37 -0
- data/src/core/ext/upbdefs-gen/grpc/channelz/v1/channelz.upbdefs.c +715 -0
- data/src/core/ext/upbdefs-gen/{src/proto/grpc/channelz → grpc/channelz/v1}/channelz.upbdefs.h +44 -44
- data/src/core/filter/auth/server_auth_filter.cc +2 -3
- data/src/core/filter/composite/composite_filter.cc +45 -33
- data/src/core/filter/composite/composite_filter.h +5 -4
- data/src/core/filter/ext_proc/ext_proc_filter.cc +224 -0
- data/src/core/filter/ext_proc/ext_proc_filter.h +155 -0
- data/src/core/filter/ext_proc/ext_proc_messages.cc +701 -0
- data/src/core/filter/ext_proc/ext_proc_messages.h +297 -0
- data/src/core/filter/filter_args.h +13 -2
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +30 -3
- data/src/core/handshaker/security/security_handshaker.cc +9 -6
- data/src/core/lib/channel/channel_stack.cc +3 -0
- data/src/core/lib/channel/channel_stack.h +2 -0
- data/src/core/lib/channel/channel_stack_builder_impl.cc +1 -2
- data/src/core/lib/channel/promise_based_filter.cc +132 -20
- data/src/core/lib/channel/promise_based_filter.h +42 -12
- data/src/core/lib/compression/compression_internal.cc +4 -5
- data/src/core/lib/debug/trace_flags.cc +8 -0
- data/src/core/lib/debug/trace_flags.h +3 -0
- data/src/core/lib/event_engine/ares_resolver.cc +54 -50
- data/src/core/lib/event_engine/ares_resolver.h +3 -2
- data/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +3 -3
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +4 -10
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.cc +74 -33
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +4 -4
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +6 -2
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.cc +3 -0
- data/src/core/lib/event_engine/posix_engine/tcp_socket_utils.h +3 -0
- data/src/core/lib/event_engine/windows/windows_endpoint.cc +1 -3
- data/src/core/lib/experiments/experiments.cc +60 -96
- data/src/core/lib/experiments/experiments.h +34 -50
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -6
- data/src/core/lib/iomgr/endpoint_cfstream.cc +3 -10
- data/src/core/lib/iomgr/error.cc +2 -6
- data/src/core/lib/iomgr/error_cfstream.cc +1 -1
- data/src/core/lib/iomgr/ev_poll_posix.cc +5 -9
- data/src/core/lib/iomgr/event_engine_shims/closure.cc +1 -1
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +1 -2
- data/src/core/lib/iomgr/event_engine_shims/tcp_client.cc +1 -2
- data/src/core/lib/iomgr/iomgr_posix.cc +0 -4
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -4
- data/src/core/lib/iomgr/iomgr_windows.cc +0 -4
- data/src/core/lib/iomgr/socket_factory_posix.h +1 -1
- data/src/core/lib/iomgr/socket_utils_posix.cc +3 -0
- data/src/core/lib/iomgr/socket_utils_posix.h +3 -0
- data/src/core/lib/iomgr/systemd_utils.cc +0 -1
- data/src/core/lib/iomgr/tcp_client.h +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +23 -15
- data/src/core/lib/iomgr/tcp_server.h +1 -1
- data/src/core/lib/iomgr/tcp_server_posix.cc +2 -3
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -1
- data/src/core/lib/iomgr/tcp_server_windows.cc +0 -1
- data/src/core/lib/iomgr/tcp_windows.cc +5 -10
- data/src/core/lib/iomgr/unix_sockets_posix.cc +2 -4
- data/src/core/lib/iomgr/unix_sockets_posix.h +3 -1
- data/src/core/lib/iomgr/vsock.h +3 -1
- data/src/core/lib/resource_quota/memory_quota.cc +1 -1
- data/src/core/lib/security/authorization/rbac_policy.cc +139 -56
- data/src/core/lib/security/authorization/rbac_policy.h +21 -3
- data/src/core/lib/surface/call.cc +3 -9
- data/src/core/lib/surface/call_utils.h +113 -0
- data/src/core/lib/surface/channel_create.cc +1 -1
- data/src/core/lib/surface/channel_create.h +0 -2
- data/src/core/lib/surface/channel_init.cc +77 -38
- data/src/core/lib/surface/channel_init.h +30 -16
- data/src/core/lib/surface/filter_stack_call.cc +5 -10
- data/src/core/lib/surface/init.cc +13 -27
- data/src/core/lib/surface/version.cc +1 -1
- data/src/core/lib/transport/error_utils.cc +0 -27
- data/src/core/lib/transport/error_utils.h +0 -16
- data/src/core/lib/transport/transport.h +7 -5
- data/src/core/load_balancing/pick_first/pick_first.cc +2 -0
- data/src/core/load_balancing/rls/rls.cc +28 -11
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.cc +33 -42
- data/src/core/load_balancing/weighted_round_robin/weighted_round_robin.h +0 -2
- data/src/core/load_balancing/xds/cds.cc +3 -1
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +0 -1
- data/src/core/mitigation_engine/mitigation.h +14 -5
- data/src/core/mitigation_engine/mitigation_engine.h +7 -3
- data/src/core/mitigation_engine/mitigation_provider.h +2 -1
- data/src/core/plugin_registry/grpc_plugin_registry.cc +39 -8
- data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.cc → dns_resolver.cc} +42 -41
- data/src/core/resolver/dns/{event_engine/event_engine_client_channel_resolver.h → dns_resolver.h} +8 -5
- data/src/core/resolver/dns/{event_engine/service_config_helper.cc → service_config_helper.cc} +1 -1
- data/src/core/resolver/dns/{event_engine/service_config_helper.h → service_config_helper.h} +3 -3
- data/src/core/resolver/endpoint_addresses.h +3 -0
- data/src/core/resolver/google_c2p/google_c2p_resolver.cc +2 -1
- data/src/core/resolver/xds/xds_resolver.cc +35 -9
- data/src/core/server/server.cc +2 -6
- data/src/core/server/server_config_selector.h +18 -3
- data/src/core/server/server_config_selector_filter.cc +178 -91
- data/src/core/server/server_config_selector_filter.h +58 -3
- data/src/core/server/xds_server_config_fetcher.cc +196 -129
- data/src/core/server/xds_server_config_fetcher.h +49 -0
- data/src/core/server/xds_server_config_fetcher_legacy.cc +41 -37
- data/src/core/telemetry/histogram.h +94 -14
- data/src/core/telemetry/instrument.cc +179 -74
- data/src/core/telemetry/instrument.h +78 -30
- data/src/core/telemetry/metrics.h +5 -0
- data/src/core/{resolver/dns/dns_resolver_plugin.h → telemetry/telemetry_label.h} +12 -8
- data/src/core/tsi/alts/crypt/aes_gcm.cc +10 -13
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +2 -2
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +3 -1
- data/src/core/tsi/ssl_telemetry_utils.cc +216 -259
- data/src/core/tsi/ssl_telemetry_utils.h +12 -2
- data/src/core/tsi/ssl_transport_security.cc +238 -80
- data/src/core/tsi/ssl_transport_security.h +63 -33
- data/src/core/tsi/tls_telemetry.cc +31 -0
- data/src/core/tsi/tls_telemetry.h +47 -0
- data/src/core/tsi/transport_security.cc +2 -2
- data/src/core/tsi/transport_security.h +1 -1
- data/src/core/tsi/transport_security_interface.h +1 -1
- data/src/core/{resolver/dns/native/dns_resolver.h → util/address_sorting_init.cc} +21 -8
- data/src/core/{resolver/dns/c_ares/grpc_ares_wrapper_posix.cc → util/address_sorting_init.h} +7 -8
- data/src/core/util/http_client/httpcli.cc +16 -53
- data/src/core/util/http_client/httpcli.h +0 -7
- data/src/core/util/http_client/httpcli_security_connector.cc +13 -8
- data/src/core/util/linux/cpu.cc +1 -1
- data/src/core/util/load_file.cc +3 -9
- data/src/core/util/load_file.h +3 -4
- data/src/core/util/matchers.h +8 -0
- data/src/core/util/posix/cpu.cc +1 -1
- data/src/core/util/status_helper.cc +0 -20
- data/src/core/util/status_helper.h +3 -14
- data/src/core/xds/grpc/xds_audit_logger_registry.cc +51 -31
- data/src/core/xds/grpc/xds_audit_logger_registry.h +17 -3
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +2 -10
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +8 -6
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.cc +488 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc_builder.h +97 -0
- data/src/core/xds/grpc/xds_certificate_provider.cc +7 -7
- data/src/core/xds/grpc/xds_client_grpc.cc +4 -8
- data/src/core/xds/grpc/xds_client_grpc.h +0 -4
- data/src/core/xds/grpc/xds_cluster.h +1 -0
- data/src/core/xds/grpc/xds_cluster_parser.cc +1 -5
- data/src/core/xds/grpc/xds_cluster_parser.h +0 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.cc +0 -2
- data/src/core/xds/grpc/xds_cluster_specifier_plugin.h +0 -2
- data/src/core/xds/grpc/xds_common_types.cc +0 -91
- data/src/core/xds/grpc/xds_common_types.h +1 -47
- data/src/core/xds/grpc/xds_common_types_parser.cc +84 -378
- data/src/core/xds/grpc/xds_common_types_parser.h +9 -11
- data/src/core/xds/grpc/xds_endpoint_parser.cc +0 -2
- data/src/core/xds/grpc/xds_grpc_service_parser.cc +177 -0
- data/src/core/{resolver/dns/c_ares/dns_resolver_ares.h → xds/grpc/xds_grpc_service_parser.h} +14 -9
- data/src/core/xds/grpc/xds_http_composite_filter.cc +26 -21
- data/src/core/xds/grpc/xds_http_composite_filter.h +4 -3
- data/src/core/xds/grpc/xds_http_ext_proc_filter.cc +418 -0
- data/src/core/xds/grpc/xds_http_ext_proc_filter.h +89 -0
- data/src/core/xds/grpc/xds_http_fault_filter.cc +9 -12
- data/src/core/xds/grpc/xds_http_fault_filter.h +1 -4
- data/src/core/xds/grpc/xds_http_filter.cc +2 -1
- data/src/core/xds/grpc/xds_http_filter.h +6 -5
- data/src/core/xds/grpc/xds_http_filter_registry.cc +10 -127
- data/src/core/xds/grpc/xds_http_filter_registry.h +7 -59
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +13 -14
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +3 -2
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +403 -25
- data/src/core/xds/grpc/xds_http_rbac_filter.h +1 -3
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +8 -13
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +1 -4
- data/src/core/xds/grpc/xds_lb_policy_registry.cc +0 -292
- data/src/core/xds/grpc/xds_lb_policy_registry.h +7 -3
- data/src/core/xds/grpc/xds_listener.cc +2 -0
- data/src/core/xds/grpc/xds_listener.h +5 -0
- data/src/core/xds/grpc/xds_listener_parser.cc +16 -11
- data/src/core/xds/grpc/xds_matcher_parse.h +3 -1
- data/src/core/xds/grpc/xds_metadata_parser.cc +6 -1
- data/src/core/xds/grpc/xds_metadata_parser.h +2 -0
- data/src/core/xds/grpc/xds_route_config.cc +2 -0
- data/src/core/xds/grpc/xds_route_config.h +3 -1
- data/src/core/xds/grpc/xds_route_config_parser.cc +13 -79
- data/src/core/xds/grpc/xds_route_config_parser.h +0 -3
- data/src/core/xds/grpc/xds_routing.cc +116 -69
- data/src/core/xds/grpc/xds_routing.h +19 -8
- data/src/core/xds/grpc/xds_tls_context.cc +117 -0
- data/src/core/xds/grpc/xds_tls_context.h +76 -0
- data/src/core/xds/grpc/xds_tls_context_parser.cc +275 -0
- data/src/core/xds/grpc/xds_tls_context_parser.h +35 -0
- data/src/core/xds/grpc/xds_transport_grpc.cc +41 -38
- data/src/core/xds/grpc/xds_transport_grpc.h +4 -2
- data/src/ruby/ext/grpc/rb_call.c +26 -15
- data/src/ruby/ext/grpc/rb_completion_queue.c +6 -5
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +3 -0
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/test/client.rb +5 -4
- data/src/ruby/spec/call_spec.rb +14 -0
- data/src/ruby/spec/generic/server_interceptors_spec.rb +3 -6
- metadata +50 -35
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/channelz.upbdefs.c +0 -716
- data/src/core/lib/iomgr/resolve_address.cc +0 -59
- data/src/core/lib/iomgr/resolve_address.h +0 -125
- data/src/core/lib/iomgr/resolve_address_impl.h +0 -58
- data/src/core/lib/iomgr/resolve_address_posix.cc +0 -184
- data/src/core/lib/iomgr/resolve_address_posix.h +0 -78
- data/src/core/lib/iomgr/resolve_address_windows.cc +0 -169
- data/src/core/lib/iomgr/resolve_address_windows.h +0 -76
- data/src/core/resolver/dns/c_ares/dns_resolver_ares.cc +0 -781
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver.h +0 -93
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +0 -203
- data/src/core/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +0 -838
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.cc +0 -1237
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper.h +0 -130
- data/src/core/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc +0 -35
- data/src/core/resolver/dns/dns_resolver_plugin.cc +0 -64
- data/src/core/resolver/dns/native/dns_resolver.cc +0 -173
- data/src/core/util/json/json_util.cc +0 -101
- data/src/core/util/json/json_util.h +0 -163
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2021 gRPC authors.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
16
|
+
|
|
17
|
+
#include "src/core/xds/grpc/xds_bootstrap_grpc_builder.h"
|
|
18
|
+
|
|
19
|
+
#include <stddef.h>
|
|
20
|
+
#include <stdint.h>
|
|
21
|
+
|
|
22
|
+
#include <map>
|
|
23
|
+
#include <optional>
|
|
24
|
+
#include <string>
|
|
25
|
+
#include <utility>
|
|
26
|
+
#include <variant>
|
|
27
|
+
#include <vector>
|
|
28
|
+
|
|
29
|
+
#include "envoy/config/core/v3/extension.upb.h"
|
|
30
|
+
#include "envoy/extensions/filters/http/router/v3/router.upb.h"
|
|
31
|
+
#include "envoy/extensions/filters/http/router/v3/router.upbdefs.h"
|
|
32
|
+
#include "envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h"
|
|
33
|
+
#include "envoy/extensions/load_balancing_policies/pick_first/v3/pick_first.upb.h"
|
|
34
|
+
#include "envoy/extensions/load_balancing_policies/ring_hash/v3/ring_hash.upb.h"
|
|
35
|
+
#include "envoy/extensions/load_balancing_policies/wrr_locality/v3/wrr_locality.upb.h"
|
|
36
|
+
#include "google/protobuf/wrappers.upb.h"
|
|
37
|
+
#include "src/core/config/experiment_env_var.h"
|
|
38
|
+
#include "src/core/load_balancing/weighted_round_robin/weighted_round_robin.h"
|
|
39
|
+
#include "src/core/util/grpc_check.h"
|
|
40
|
+
#include "src/core/util/json/json.h"
|
|
41
|
+
#include "src/core/util/sync.h"
|
|
42
|
+
#include "src/core/util/time.h"
|
|
43
|
+
#include "src/core/util/validation_errors.h"
|
|
44
|
+
#include "src/core/xds/grpc/xds_common_types.h"
|
|
45
|
+
#include "src/core/xds/grpc/xds_common_types_parser.h"
|
|
46
|
+
#include "src/core/xds/grpc/xds_http_composite_filter.h"
|
|
47
|
+
#include "src/core/xds/grpc/xds_http_ext_proc_filter.h"
|
|
48
|
+
#include "src/core/xds/grpc/xds_http_fault_filter.h"
|
|
49
|
+
#include "src/core/xds/grpc/xds_http_gcp_authn_filter.h"
|
|
50
|
+
#include "src/core/xds/grpc/xds_http_rbac_filter.h"
|
|
51
|
+
#include "src/core/xds/grpc/xds_http_stateful_session_filter.h"
|
|
52
|
+
#include "src/core/xds/grpc/xds_lb_policy_registry.h"
|
|
53
|
+
#include "absl/strings/str_cat.h"
|
|
54
|
+
|
|
55
|
+
namespace grpc_core {
|
|
56
|
+
|
|
57
|
+
absl::StatusOr<std::unique_ptr<GrpcXdsBootstrap>>
|
|
58
|
+
GrpcXdsBootstrapBuilder::Build(absl::string_view json_string) {
|
|
59
|
+
auto bootstrap = GrpcXdsBootstrap::Create(json_string);
|
|
60
|
+
if (bootstrap.ok()) {
|
|
61
|
+
(*bootstrap)->http_filter_registry_ = CreateXdsHttpFilterRegistry();
|
|
62
|
+
(*bootstrap)->lb_policy_registry_ = CreateXdsLbPolicyRegistry();
|
|
63
|
+
(*bootstrap)->audit_logger_registry_ = CreateXdsAuditLoggerRegistry();
|
|
64
|
+
}
|
|
65
|
+
return bootstrap;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//
|
|
69
|
+
// HTTP filter registry
|
|
70
|
+
//
|
|
71
|
+
|
|
72
|
+
namespace {
|
|
73
|
+
|
|
74
|
+
Mutex* g_mu = new Mutex;
|
|
75
|
+
NoDestruct<absl::AnyInvocable<void(XdsHttpFilterRegistry&)>>
|
|
76
|
+
g_http_filter_factory_test_init ABSL_GUARDED_BY(*g_mu);
|
|
77
|
+
|
|
78
|
+
} // namespace
|
|
79
|
+
|
|
80
|
+
void GrpcXdsBootstrapBuilder::SetXdsHttpFilterFactoryInitForTest(
|
|
81
|
+
absl::AnyInvocable<void(XdsHttpFilterRegistry&)> init) {
|
|
82
|
+
MutexLock lock(g_mu);
|
|
83
|
+
*g_http_filter_factory_test_init = std::move(init);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
XdsHttpFilterRegistry GrpcXdsBootstrapBuilder::CreateXdsHttpFilterRegistry(
|
|
87
|
+
bool register_builtins) {
|
|
88
|
+
XdsHttpFilterRegistry registry;
|
|
89
|
+
if (register_builtins) {
|
|
90
|
+
registry.RegisterFilter(std::make_unique<XdsHttpRouterFilterFactory>());
|
|
91
|
+
registry.RegisterFilter(std::make_unique<XdsHttpFaultFilterFactory>());
|
|
92
|
+
registry.RegisterFilter(std::make_unique<XdsHttpRbacFilterFactory>());
|
|
93
|
+
registry.RegisterFilter(
|
|
94
|
+
std::make_unique<XdsHttpStatefulSessionFilterFactory>());
|
|
95
|
+
registry.RegisterFilter(std::make_unique<XdsHttpGcpAuthnFilterFactory>());
|
|
96
|
+
if (IsExperimentEnvVarEnabled("GRPC_EXPERIMENTAL_XDS_COMPOSITE_FILTER")) {
|
|
97
|
+
registry.RegisterFilter(
|
|
98
|
+
std::make_unique<XdsHttpCompositeFilterFactory>());
|
|
99
|
+
}
|
|
100
|
+
if (IsExperimentEnvVarEnabled("GRPC_EXPERIMENTAL_XDS_EXT_PROC_ON_CLIENT")) {
|
|
101
|
+
registry.RegisterFilter(std::make_unique<XdsHttpExtProcFilterFactory>());
|
|
102
|
+
}
|
|
103
|
+
MutexLock lock(g_mu);
|
|
104
|
+
if (*g_http_filter_factory_test_init != nullptr) {
|
|
105
|
+
(*g_http_filter_factory_test_init)(registry);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return registry;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
//
|
|
112
|
+
// LB policy registry
|
|
113
|
+
//
|
|
114
|
+
|
|
115
|
+
namespace {
|
|
116
|
+
|
|
117
|
+
class RoundRobinLbPolicyConfigFactory final
|
|
118
|
+
: public XdsLbPolicyRegistry::ConfigFactory {
|
|
119
|
+
public:
|
|
120
|
+
Json::Object ConvertXdsLbPolicyConfig(
|
|
121
|
+
const XdsLbPolicyRegistry* /*registry*/,
|
|
122
|
+
const XdsResourceType::DecodeContext& /*context*/,
|
|
123
|
+
absl::string_view /*configuration*/, ValidationErrors* /*errors*/,
|
|
124
|
+
int /*recursion_depth*/) override {
|
|
125
|
+
return Json::Object{{"round_robin", Json::FromObject({})}};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
absl::string_view type() override { return Type(); }
|
|
129
|
+
|
|
130
|
+
static absl::string_view Type() {
|
|
131
|
+
return "envoy.extensions.load_balancing_policies.round_robin.v3.RoundRobin";
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
class ClientSideWeightedRoundRobinLbPolicyConfigFactory final
|
|
136
|
+
: public XdsLbPolicyRegistry::ConfigFactory {
|
|
137
|
+
public:
|
|
138
|
+
Json::Object ConvertXdsLbPolicyConfig(
|
|
139
|
+
const XdsLbPolicyRegistry* /*registry*/,
|
|
140
|
+
const XdsResourceType::DecodeContext& context,
|
|
141
|
+
absl::string_view configuration, ValidationErrors* errors,
|
|
142
|
+
int /*recursion_depth*/) override {
|
|
143
|
+
const auto* resource =
|
|
144
|
+
envoy_extensions_load_balancing_policies_client_side_weighted_round_robin_v3_ClientSideWeightedRoundRobin_parse(
|
|
145
|
+
configuration.data(), configuration.size(), context.arena);
|
|
146
|
+
if (resource == nullptr) {
|
|
147
|
+
errors->AddError(
|
|
148
|
+
"can't decode ClientSideWeightedRoundRobin LB policy config");
|
|
149
|
+
return {};
|
|
150
|
+
}
|
|
151
|
+
Json::Object config;
|
|
152
|
+
// enable_oob_load_report
|
|
153
|
+
if (ParseBoolValue(
|
|
154
|
+
envoy_extensions_load_balancing_policies_client_side_weighted_round_robin_v3_ClientSideWeightedRoundRobin_enable_oob_load_report(
|
|
155
|
+
resource))) {
|
|
156
|
+
config["enableOobLoadReport"] = Json::FromBool(true);
|
|
157
|
+
}
|
|
158
|
+
// oob_reporting_period
|
|
159
|
+
auto* duration_proto =
|
|
160
|
+
envoy_extensions_load_balancing_policies_client_side_weighted_round_robin_v3_ClientSideWeightedRoundRobin_oob_reporting_period(
|
|
161
|
+
resource);
|
|
162
|
+
if (duration_proto != nullptr) {
|
|
163
|
+
ValidationErrors::ScopedField field(errors, ".oob_reporting_period");
|
|
164
|
+
Duration duration = ParseDuration(duration_proto, errors);
|
|
165
|
+
config["oobReportingPeriod"] = Json::FromString(duration.ToJsonString());
|
|
166
|
+
}
|
|
167
|
+
// blackout_period
|
|
168
|
+
duration_proto =
|
|
169
|
+
envoy_extensions_load_balancing_policies_client_side_weighted_round_robin_v3_ClientSideWeightedRoundRobin_blackout_period(
|
|
170
|
+
resource);
|
|
171
|
+
if (duration_proto != nullptr) {
|
|
172
|
+
ValidationErrors::ScopedField field(errors, ".blackout_period");
|
|
173
|
+
Duration duration = ParseDuration(duration_proto, errors);
|
|
174
|
+
config["blackoutPeriod"] = Json::FromString(duration.ToJsonString());
|
|
175
|
+
}
|
|
176
|
+
// weight_update_period
|
|
177
|
+
duration_proto =
|
|
178
|
+
envoy_extensions_load_balancing_policies_client_side_weighted_round_robin_v3_ClientSideWeightedRoundRobin_weight_update_period(
|
|
179
|
+
resource);
|
|
180
|
+
if (duration_proto != nullptr) {
|
|
181
|
+
ValidationErrors::ScopedField field(errors, ".weight_update_period");
|
|
182
|
+
Duration duration = ParseDuration(duration_proto, errors);
|
|
183
|
+
config["weightUpdatePeriod"] = Json::FromString(duration.ToJsonString());
|
|
184
|
+
}
|
|
185
|
+
// weight_expiration_period
|
|
186
|
+
duration_proto =
|
|
187
|
+
envoy_extensions_load_balancing_policies_client_side_weighted_round_robin_v3_ClientSideWeightedRoundRobin_weight_expiration_period(
|
|
188
|
+
resource);
|
|
189
|
+
if (duration_proto != nullptr) {
|
|
190
|
+
ValidationErrors::ScopedField field(errors, ".weight_expiration_period");
|
|
191
|
+
Duration duration = ParseDuration(duration_proto, errors);
|
|
192
|
+
config["weightExpirationPeriod"] =
|
|
193
|
+
Json::FromString(duration.ToJsonString());
|
|
194
|
+
}
|
|
195
|
+
// error_utilization_penalty
|
|
196
|
+
auto* error_utilization_penalty =
|
|
197
|
+
envoy_extensions_load_balancing_policies_client_side_weighted_round_robin_v3_ClientSideWeightedRoundRobin_error_utilization_penalty(
|
|
198
|
+
resource);
|
|
199
|
+
if (error_utilization_penalty != nullptr) {
|
|
200
|
+
ValidationErrors::ScopedField field(errors, ".error_utilization_penalty");
|
|
201
|
+
const float value =
|
|
202
|
+
google_protobuf_FloatValue_value(error_utilization_penalty);
|
|
203
|
+
if (value < 0.0) {
|
|
204
|
+
errors->AddError("value must be non-negative");
|
|
205
|
+
}
|
|
206
|
+
config["errorUtilizationPenalty"] = Json::FromNumber(value);
|
|
207
|
+
}
|
|
208
|
+
// metric_names_for_computing_utilization
|
|
209
|
+
size_t size;
|
|
210
|
+
auto metric_names_for_computing_utilization =
|
|
211
|
+
envoy_extensions_load_balancing_policies_client_side_weighted_round_robin_v3_ClientSideWeightedRoundRobin_metric_names_for_computing_utilization(
|
|
212
|
+
resource, &size);
|
|
213
|
+
if (metric_names_for_computing_utilization != nullptr && size != 0) {
|
|
214
|
+
Json::Array metric_names;
|
|
215
|
+
for (size_t i = 0; i < size; ++i) {
|
|
216
|
+
metric_names.emplace_back(Json::FromString(
|
|
217
|
+
UpbStringToStdString(metric_names_for_computing_utilization[i])));
|
|
218
|
+
}
|
|
219
|
+
config["metricNamesForComputingUtilization"] =
|
|
220
|
+
Json::FromArray(std::move(metric_names));
|
|
221
|
+
}
|
|
222
|
+
return Json::Object{
|
|
223
|
+
{"weighted_round_robin", Json::FromObject(std::move(config))}};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
absl::string_view type() override { return Type(); }
|
|
227
|
+
|
|
228
|
+
static absl::string_view Type() {
|
|
229
|
+
return "envoy.extensions.load_balancing_policies.client_side_weighted_"
|
|
230
|
+
"round_robin.v3.ClientSideWeightedRoundRobin";
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
class RingHashLbPolicyConfigFactory final
|
|
235
|
+
: public XdsLbPolicyRegistry::ConfigFactory {
|
|
236
|
+
public:
|
|
237
|
+
Json::Object ConvertXdsLbPolicyConfig(
|
|
238
|
+
const XdsLbPolicyRegistry* /*registry*/,
|
|
239
|
+
const XdsResourceType::DecodeContext& context,
|
|
240
|
+
absl::string_view configuration, ValidationErrors* errors,
|
|
241
|
+
int /*recursion_depth*/) override {
|
|
242
|
+
const auto* resource =
|
|
243
|
+
envoy_extensions_load_balancing_policies_ring_hash_v3_RingHash_parse(
|
|
244
|
+
configuration.data(), configuration.size(), context.arena);
|
|
245
|
+
if (resource == nullptr) {
|
|
246
|
+
errors->AddError("can't decode RingHash LB policy config");
|
|
247
|
+
return {};
|
|
248
|
+
}
|
|
249
|
+
if (envoy_extensions_load_balancing_policies_ring_hash_v3_RingHash_hash_function(
|
|
250
|
+
resource) !=
|
|
251
|
+
envoy_extensions_load_balancing_policies_ring_hash_v3_RingHash_XX_HASH &&
|
|
252
|
+
envoy_extensions_load_balancing_policies_ring_hash_v3_RingHash_hash_function(
|
|
253
|
+
resource) !=
|
|
254
|
+
envoy_extensions_load_balancing_policies_ring_hash_v3_RingHash_DEFAULT_HASH) {
|
|
255
|
+
ValidationErrors::ScopedField field(errors, ".hash_function");
|
|
256
|
+
errors->AddError("unsupported value (must be XX_HASH)");
|
|
257
|
+
}
|
|
258
|
+
uint64_t max_ring_size =
|
|
259
|
+
ParseUInt64Value(
|
|
260
|
+
envoy_extensions_load_balancing_policies_ring_hash_v3_RingHash_maximum_ring_size(
|
|
261
|
+
resource))
|
|
262
|
+
.value_or(8388608);
|
|
263
|
+
if (max_ring_size == 0 || max_ring_size > 8388608) {
|
|
264
|
+
ValidationErrors::ScopedField field(errors, ".maximum_ring_size");
|
|
265
|
+
errors->AddError("value must be in the range [1, 8388608]");
|
|
266
|
+
}
|
|
267
|
+
uint64_t min_ring_size =
|
|
268
|
+
ParseUInt64Value(
|
|
269
|
+
envoy_extensions_load_balancing_policies_ring_hash_v3_RingHash_minimum_ring_size(
|
|
270
|
+
resource))
|
|
271
|
+
.value_or(1024);
|
|
272
|
+
{
|
|
273
|
+
ValidationErrors::ScopedField field(errors, ".minimum_ring_size");
|
|
274
|
+
if (min_ring_size == 0 || min_ring_size > 8388608) {
|
|
275
|
+
errors->AddError("value must be in the range [1, 8388608]");
|
|
276
|
+
}
|
|
277
|
+
if (min_ring_size > max_ring_size) {
|
|
278
|
+
errors->AddError("cannot be greater than maximum_ring_size");
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
return Json::Object{
|
|
282
|
+
{"ring_hash_experimental",
|
|
283
|
+
Json::FromObject({
|
|
284
|
+
{"minRingSize", Json::FromNumber(min_ring_size)},
|
|
285
|
+
{"maxRingSize", Json::FromNumber(max_ring_size)},
|
|
286
|
+
})},
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
absl::string_view type() override { return Type(); }
|
|
291
|
+
|
|
292
|
+
static absl::string_view Type() {
|
|
293
|
+
return "envoy.extensions.load_balancing_policies.ring_hash.v3.RingHash";
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
class WrrLocalityLbPolicyConfigFactory final
|
|
298
|
+
: public XdsLbPolicyRegistry::ConfigFactory {
|
|
299
|
+
public:
|
|
300
|
+
Json::Object ConvertXdsLbPolicyConfig(
|
|
301
|
+
const XdsLbPolicyRegistry* registry,
|
|
302
|
+
const XdsResourceType::DecodeContext& context,
|
|
303
|
+
absl::string_view configuration, ValidationErrors* errors,
|
|
304
|
+
int recursion_depth) override {
|
|
305
|
+
const auto* resource =
|
|
306
|
+
envoy_extensions_load_balancing_policies_wrr_locality_v3_WrrLocality_parse(
|
|
307
|
+
configuration.data(), configuration.size(), context.arena);
|
|
308
|
+
if (resource == nullptr) {
|
|
309
|
+
errors->AddError("can't decode WrrLocality LB policy config");
|
|
310
|
+
return {};
|
|
311
|
+
}
|
|
312
|
+
ValidationErrors::ScopedField field(errors, ".endpoint_picking_policy");
|
|
313
|
+
const auto* endpoint_picking_policy =
|
|
314
|
+
envoy_extensions_load_balancing_policies_wrr_locality_v3_WrrLocality_endpoint_picking_policy(
|
|
315
|
+
resource);
|
|
316
|
+
if (endpoint_picking_policy == nullptr) {
|
|
317
|
+
errors->AddError("field not present");
|
|
318
|
+
return {};
|
|
319
|
+
}
|
|
320
|
+
auto child_policy = registry->ConvertXdsLbPolicyConfig(
|
|
321
|
+
context, endpoint_picking_policy, errors, recursion_depth + 1);
|
|
322
|
+
return Json::Object{
|
|
323
|
+
{"xds_wrr_locality_experimental",
|
|
324
|
+
Json::FromObject(
|
|
325
|
+
{{"childPolicy", Json::FromArray(std::move(child_policy))}})}};
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
absl::string_view type() override { return Type(); }
|
|
329
|
+
|
|
330
|
+
static absl::string_view Type() {
|
|
331
|
+
return "envoy.extensions.load_balancing_policies.wrr_locality.v3."
|
|
332
|
+
"WrrLocality";
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
class PickFirstLbPolicyConfigFactory final
|
|
337
|
+
: public XdsLbPolicyRegistry::ConfigFactory {
|
|
338
|
+
public:
|
|
339
|
+
Json::Object ConvertXdsLbPolicyConfig(
|
|
340
|
+
const XdsLbPolicyRegistry* /*registry*/,
|
|
341
|
+
const XdsResourceType::DecodeContext& context,
|
|
342
|
+
absl::string_view configuration, ValidationErrors* errors,
|
|
343
|
+
int /*recursion_depth*/) override {
|
|
344
|
+
const auto* resource =
|
|
345
|
+
envoy_extensions_load_balancing_policies_pick_first_v3_PickFirst_parse(
|
|
346
|
+
configuration.data(), configuration.size(), context.arena);
|
|
347
|
+
if (resource == nullptr) {
|
|
348
|
+
errors->AddError("can't decode PickFirst LB policy config");
|
|
349
|
+
return {};
|
|
350
|
+
}
|
|
351
|
+
bool shuffle_address_list =
|
|
352
|
+
envoy_extensions_load_balancing_policies_pick_first_v3_PickFirst_shuffle_address_list(
|
|
353
|
+
resource);
|
|
354
|
+
return Json::Object{
|
|
355
|
+
{"pick_first",
|
|
356
|
+
Json::FromObject({
|
|
357
|
+
{"shuffleAddressList", Json::FromBool(shuffle_address_list)},
|
|
358
|
+
})}};
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
absl::string_view type() override { return Type(); }
|
|
362
|
+
|
|
363
|
+
static absl::string_view Type() {
|
|
364
|
+
return "envoy.extensions.load_balancing_policies.pick_first.v3.PickFirst";
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
} // namespace
|
|
369
|
+
|
|
370
|
+
XdsLbPolicyRegistry GrpcXdsBootstrapBuilder::CreateXdsLbPolicyRegistry() {
|
|
371
|
+
XdsLbPolicyRegistry registry;
|
|
372
|
+
registry.RegisterFactory(std::make_unique<RingHashLbPolicyConfigFactory>());
|
|
373
|
+
registry.RegisterFactory(std::make_unique<RoundRobinLbPolicyConfigFactory>());
|
|
374
|
+
registry.RegisterFactory(
|
|
375
|
+
std::make_unique<ClientSideWeightedRoundRobinLbPolicyConfigFactory>());
|
|
376
|
+
registry.RegisterFactory(
|
|
377
|
+
std::make_unique<WrrLocalityLbPolicyConfigFactory>());
|
|
378
|
+
registry.RegisterFactory(std::make_unique<PickFirstLbPolicyConfigFactory>());
|
|
379
|
+
return registry;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
//
|
|
383
|
+
// Audit logger registry
|
|
384
|
+
//
|
|
385
|
+
|
|
386
|
+
namespace {
|
|
387
|
+
|
|
388
|
+
class StdoutLoggerConfigFactory final
|
|
389
|
+
: public XdsAuditLoggerRegistry::ConfigFactory {
|
|
390
|
+
public:
|
|
391
|
+
Json::Object ConvertXdsAuditLoggerConfig(
|
|
392
|
+
const XdsResourceType::DecodeContext& /*context*/,
|
|
393
|
+
absl::string_view /*configuration*/,
|
|
394
|
+
ValidationErrors* /*errors*/) override {
|
|
395
|
+
// Stdout logger has no configuration right now. So we don't process the
|
|
396
|
+
// config protobuf.
|
|
397
|
+
return {};
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
absl::string_view type() override { return Type(); }
|
|
401
|
+
absl::string_view name() override { return "stdout_logger"; }
|
|
402
|
+
|
|
403
|
+
static absl::string_view Type() {
|
|
404
|
+
return "envoy.extensions.rbac.audit_loggers.stream.v3.StdoutAuditLog";
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
} // namespace
|
|
409
|
+
|
|
410
|
+
XdsAuditLoggerRegistry GrpcXdsBootstrapBuilder::CreateXdsAuditLoggerRegistry() {
|
|
411
|
+
XdsAuditLoggerRegistry registry;
|
|
412
|
+
registry.RegisterFactory(std::make_unique<StdoutLoggerConfigFactory>());
|
|
413
|
+
return registry;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
//
|
|
417
|
+
// XdsHttpRouterFilterFactory
|
|
418
|
+
//
|
|
419
|
+
|
|
420
|
+
absl::string_view XdsHttpRouterFilterFactory::ConfigProtoName() const {
|
|
421
|
+
return "envoy.extensions.filters.http.router.v3.Router";
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
absl::string_view XdsHttpRouterFilterFactory::OverrideConfigProtoName() const {
|
|
425
|
+
return "";
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
void XdsHttpRouterFilterFactory::PopulateSymtab(upb_DefPool* symtab) const {
|
|
429
|
+
envoy_extensions_filters_http_router_v3_Router_getmsgdef(symtab);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
std::optional<Json> XdsHttpRouterFilterFactory::GenerateFilterConfig(
|
|
433
|
+
absl::string_view /*instance_name*/,
|
|
434
|
+
const XdsResourceType::DecodeContext& context,
|
|
435
|
+
const XdsExtension& extension, ValidationErrors* errors) const {
|
|
436
|
+
const absl::string_view* serialized_filter_config =
|
|
437
|
+
std::get_if<absl::string_view>(&extension.value);
|
|
438
|
+
if (serialized_filter_config == nullptr) {
|
|
439
|
+
errors->AddError("could not parse router filter config");
|
|
440
|
+
return std::nullopt;
|
|
441
|
+
}
|
|
442
|
+
if (envoy_extensions_filters_http_router_v3_Router_parse(
|
|
443
|
+
serialized_filter_config->data(), serialized_filter_config->size(),
|
|
444
|
+
context.arena) == nullptr) {
|
|
445
|
+
errors->AddError("could not parse router filter config");
|
|
446
|
+
return std::nullopt;
|
|
447
|
+
}
|
|
448
|
+
return Json();
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
std::optional<Json> XdsHttpRouterFilterFactory::GenerateFilterConfigOverride(
|
|
452
|
+
absl::string_view /*instance_name*/,
|
|
453
|
+
const XdsResourceType::DecodeContext& /*context*/,
|
|
454
|
+
const XdsExtension& /*extension*/, ValidationErrors* errors) const {
|
|
455
|
+
errors->AddError("router filter does not support config override");
|
|
456
|
+
return std::nullopt;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
RefCountedPtr<const FilterConfig>
|
|
460
|
+
XdsHttpRouterFilterFactory::ParseTopLevelConfig(
|
|
461
|
+
absl::string_view /*instance_name*/,
|
|
462
|
+
const XdsResourceType::DecodeContext& context,
|
|
463
|
+
const XdsExtension& extension, ValidationErrors* errors) const {
|
|
464
|
+
const absl::string_view* serialized_filter_config =
|
|
465
|
+
std::get_if<absl::string_view>(&extension.value);
|
|
466
|
+
if (serialized_filter_config == nullptr) {
|
|
467
|
+
errors->AddError("could not parse router filter config");
|
|
468
|
+
return nullptr;
|
|
469
|
+
}
|
|
470
|
+
if (envoy_extensions_filters_http_router_v3_Router_parse(
|
|
471
|
+
serialized_filter_config->data(), serialized_filter_config->size(),
|
|
472
|
+
context.arena) == nullptr) {
|
|
473
|
+
errors->AddError("could not parse router filter config");
|
|
474
|
+
return nullptr;
|
|
475
|
+
}
|
|
476
|
+
return nullptr;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
RefCountedPtr<const FilterConfig>
|
|
480
|
+
XdsHttpRouterFilterFactory::ParseOverrideConfig(
|
|
481
|
+
absl::string_view /*instance_name*/,
|
|
482
|
+
const XdsResourceType::DecodeContext& /*context*/,
|
|
483
|
+
const XdsExtension& /*extension*/, ValidationErrors* errors) const {
|
|
484
|
+
errors->AddError("router filter does not support config override");
|
|
485
|
+
return nullptr;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
} // namespace grpc_core
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2021 gRPC authors.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
//
|
|
16
|
+
|
|
17
|
+
#ifndef GRPC_SRC_CORE_XDS_GRPC_XDS_BOOTSTRAP_GRPC_BUILDER_H
|
|
18
|
+
#define GRPC_SRC_CORE_XDS_GRPC_XDS_BOOTSTRAP_GRPC_BUILDER_H
|
|
19
|
+
|
|
20
|
+
#include <memory>
|
|
21
|
+
#include <optional>
|
|
22
|
+
|
|
23
|
+
#include "src/core/util/validation_errors.h"
|
|
24
|
+
#include "src/core/xds/grpc/xds_audit_logger_registry.h"
|
|
25
|
+
#include "src/core/xds/grpc/xds_bootstrap_grpc.h"
|
|
26
|
+
#include "src/core/xds/grpc/xds_common_types.h"
|
|
27
|
+
#include "src/core/xds/grpc/xds_http_filter.h"
|
|
28
|
+
#include "src/core/xds/grpc/xds_http_filter_registry.h"
|
|
29
|
+
#include "src/core/xds/grpc/xds_lb_policy_registry.h"
|
|
30
|
+
#include "src/core/xds/xds_client/xds_resource_type.h"
|
|
31
|
+
#include "upb/reflection/def.h"
|
|
32
|
+
#include "absl/functional/any_invocable.h"
|
|
33
|
+
#include "absl/status/statusor.h"
|
|
34
|
+
#include "absl/strings/string_view.h"
|
|
35
|
+
|
|
36
|
+
namespace grpc_core {
|
|
37
|
+
|
|
38
|
+
class GrpcXdsBootstrapBuilder final {
|
|
39
|
+
public:
|
|
40
|
+
static absl::StatusOr<std::unique_ptr<GrpcXdsBootstrap>> Build(
|
|
41
|
+
absl::string_view json_string);
|
|
42
|
+
|
|
43
|
+
static void SetXdsHttpFilterFactoryInitForTest(
|
|
44
|
+
absl::AnyInvocable<void(XdsHttpFilterRegistry&)> init);
|
|
45
|
+
|
|
46
|
+
static XdsHttpFilterRegistry CreateXdsHttpFilterRegistry(
|
|
47
|
+
bool register_builtins = true);
|
|
48
|
+
|
|
49
|
+
static XdsLbPolicyRegistry CreateXdsLbPolicyRegistry();
|
|
50
|
+
|
|
51
|
+
static XdsAuditLoggerRegistry CreateXdsAuditLoggerRegistry();
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Exposed for testing purposes only.
|
|
55
|
+
class XdsHttpRouterFilterFactory final : public XdsHttpFilterFactory {
|
|
56
|
+
public:
|
|
57
|
+
absl::string_view ConfigProtoName() const override;
|
|
58
|
+
absl::string_view OverrideConfigProtoName() const override;
|
|
59
|
+
void PopulateSymtab(upb_DefPool* symtab) const override;
|
|
60
|
+
std::optional<Json> GenerateFilterConfig(
|
|
61
|
+
absl::string_view /*instance_name*/,
|
|
62
|
+
const XdsResourceType::DecodeContext& context,
|
|
63
|
+
const XdsExtension& extension, ValidationErrors* errors) const override;
|
|
64
|
+
std::optional<Json> GenerateFilterConfigOverride(
|
|
65
|
+
absl::string_view /*instance_name*/,
|
|
66
|
+
const XdsResourceType::DecodeContext& context,
|
|
67
|
+
const XdsExtension& extension, ValidationErrors* errors) const override;
|
|
68
|
+
const grpc_channel_filter* channel_filter() const override { return nullptr; }
|
|
69
|
+
absl::StatusOr<ServiceConfigJsonEntry> GenerateMethodConfig(
|
|
70
|
+
const Json& /*hcm_filter_config*/,
|
|
71
|
+
const Json* /*filter_config_override*/) const override {
|
|
72
|
+
// This will never be called, since channel_filter() returns null.
|
|
73
|
+
return absl::UnimplementedError("router filter should never be called");
|
|
74
|
+
}
|
|
75
|
+
absl::StatusOr<ServiceConfigJsonEntry> GenerateServiceConfig(
|
|
76
|
+
const Json& /*hcm_filter_config*/) const override {
|
|
77
|
+
// This will never be called, since channel_filter() returns null.
|
|
78
|
+
return absl::UnimplementedError("router filter should never be called");
|
|
79
|
+
}
|
|
80
|
+
void AddFilter(FilterChainBuilder& /*builder*/,
|
|
81
|
+
RefCountedPtr<const FilterConfig> /*config*/) const override {}
|
|
82
|
+
RefCountedPtr<const FilterConfig> ParseTopLevelConfig(
|
|
83
|
+
absl::string_view instance_name,
|
|
84
|
+
const XdsResourceType::DecodeContext& context,
|
|
85
|
+
const XdsExtension& extension, ValidationErrors* errors) const override;
|
|
86
|
+
RefCountedPtr<const FilterConfig> ParseOverrideConfig(
|
|
87
|
+
absl::string_view instance_name,
|
|
88
|
+
const XdsResourceType::DecodeContext& context,
|
|
89
|
+
const XdsExtension& extension, ValidationErrors* errors) const override;
|
|
90
|
+
bool IsSupportedOnClients() const override { return true; }
|
|
91
|
+
bool IsSupportedOnServers() const override { return true; }
|
|
92
|
+
bool IsTerminalFilter() const override { return true; }
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
} // namespace grpc_core
|
|
96
|
+
|
|
97
|
+
#endif // GRPC_SRC_CORE_XDS_GRPC_XDS_BOOTSTRAP_GRPC_BUILDER_H
|
|
@@ -48,8 +48,8 @@ class RootCertificatesWatcher final
|
|
|
48
48
|
: parent_(std::move(parent)) {}
|
|
49
49
|
|
|
50
50
|
void OnCertificatesChanged(std::shared_ptr<RootCertInfo> roots,
|
|
51
|
-
std::optional<
|
|
52
|
-
/*
|
|
51
|
+
std::optional<KeyCertPairsOrSelector>
|
|
52
|
+
/* key_cert_pairs_or_selector */) override {
|
|
53
53
|
if (roots != nullptr) {
|
|
54
54
|
parent_->SetKeyMaterials("", roots, std::nullopt);
|
|
55
55
|
}
|
|
@@ -79,11 +79,11 @@ class IdentityCertificatesWatcher final
|
|
|
79
79
|
RefCountedPtr<grpc_tls_certificate_distributor> parent)
|
|
80
80
|
: parent_(std::move(parent)) {}
|
|
81
81
|
|
|
82
|
-
void OnCertificatesChanged(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
if (
|
|
86
|
-
parent_->SetKeyMaterials("", nullptr,
|
|
82
|
+
void OnCertificatesChanged(std::shared_ptr<RootCertInfo> /* root_certs */,
|
|
83
|
+
std::optional<KeyCertPairsOrSelector>
|
|
84
|
+
key_cert_pairs_or_selector) override {
|
|
85
|
+
if (key_cert_pairs_or_selector.has_value()) {
|
|
86
|
+
parent_->SetKeyMaterials("", nullptr, key_cert_pairs_or_selector);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
#include "src/core/xds/grpc/xds_client_grpc.h"
|
|
18
18
|
|
|
19
|
-
#include <grpc/grpc.h>
|
|
20
19
|
#include <grpc/impl/channel_arg_names.h>
|
|
21
20
|
#include <grpc/slice.h>
|
|
22
21
|
#include <grpc/support/alloc.h>
|
|
@@ -35,22 +34,19 @@
|
|
|
35
34
|
#include "src/core/lib/channel/channel_args.h"
|
|
36
35
|
#include "src/core/lib/debug/trace.h"
|
|
37
36
|
#include "src/core/lib/event_engine/channel_args_endpoint_config.h"
|
|
38
|
-
#include "src/core/lib/iomgr/error.h"
|
|
39
37
|
#include "src/core/lib/iomgr/exec_ctx.h"
|
|
40
38
|
#include "src/core/lib/slice/slice.h"
|
|
41
39
|
#include "src/core/lib/slice/slice_internal.h"
|
|
42
|
-
#include "src/core/lib/transport/error_utils.h"
|
|
43
40
|
#include "src/core/telemetry/metrics.h"
|
|
44
41
|
#include "src/core/util/debug_location.h"
|
|
45
|
-
#include "src/core/util/down_cast.h"
|
|
46
42
|
#include "src/core/util/env.h"
|
|
47
43
|
#include "src/core/util/load_file.h"
|
|
48
|
-
#include "src/core/util/orphanable.h"
|
|
49
44
|
#include "src/core/util/ref_counted_ptr.h"
|
|
50
45
|
#include "src/core/util/sync.h"
|
|
51
46
|
#include "src/core/util/time.h"
|
|
52
47
|
#include "src/core/util/upb_utils.h"
|
|
53
48
|
#include "src/core/xds/grpc/xds_bootstrap_grpc.h"
|
|
49
|
+
#include "src/core/xds/grpc/xds_bootstrap_grpc_builder.h"
|
|
54
50
|
#include "src/core/xds/grpc/xds_transport_grpc.h"
|
|
55
51
|
#include "src/core/xds/xds_client/xds_api.h"
|
|
56
52
|
#include "src/core/xds/xds_client/xds_bootstrap.h"
|
|
@@ -205,7 +201,7 @@ absl::StatusOr<std::string> FindBootstrapContents()
|
|
|
205
201
|
<< "Got bootstrap file location from GRPC_XDS_BOOTSTRAP "
|
|
206
202
|
"environment variable: "
|
|
207
203
|
<< *path;
|
|
208
|
-
auto contents = LoadFile(*path
|
|
204
|
+
auto contents = LoadFile(*path);
|
|
209
205
|
if (!contents.ok()) return contents.status();
|
|
210
206
|
return std::string(contents->as_string_view());
|
|
211
207
|
}
|
|
@@ -238,7 +234,7 @@ absl::StatusOr<std::shared_ptr<GrpcXdsBootstrap>> GetOrCreateGlobalBootstrap()
|
|
|
238
234
|
GRPC_TRACE_LOG(xds_client, INFO)
|
|
239
235
|
<< "xDS bootstrap contents: " << *bootstrap_contents;
|
|
240
236
|
// Parse bootstrap.
|
|
241
|
-
auto bootstrap =
|
|
237
|
+
auto bootstrap = GrpcXdsBootstrapBuilder::Build(*bootstrap_contents);
|
|
242
238
|
if (!bootstrap.ok()) return bootstrap.status();
|
|
243
239
|
*g_parsed_bootstrap = std::move(*bootstrap);
|
|
244
240
|
}
|
|
@@ -274,7 +270,7 @@ absl::StatusOr<RefCountedPtr<GrpcXdsClient>> GrpcXdsClient::GetOrCreate(
|
|
|
274
270
|
if (bootstrap_config.has_value()) {
|
|
275
271
|
GRPC_TRACE_LOG(xds_client, INFO)
|
|
276
272
|
<< "xDS bootstrap contents: " << *bootstrap_config;
|
|
277
|
-
auto bootstrap =
|
|
273
|
+
auto bootstrap = GrpcXdsBootstrapBuilder::Build(*bootstrap_config);
|
|
278
274
|
if (!bootstrap.ok()) return bootstrap.status();
|
|
279
275
|
grpc_channel_args* xds_channel_args = args.GetPointer<grpc_channel_args>(
|
|
280
276
|
GRPC_ARG_TEST_ONLY_DO_NOT_USE_IN_PROD_XDS_CLIENT_CHANNEL_ARGS);
|