grpc 1.78.1 → 1.80.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 +22 -8
- data/include/grpc/credentials.h +47 -37
- data/include/grpc/credentials_cpp.h +39 -0
- data/include/grpc/event_engine/event_engine.h +8 -3
- data/include/grpc/grpc.h +4 -0
- data/include/grpc/impl/call.h +9 -0
- data/include/grpc/impl/channel_arg_names.h +7 -0
- data/include/grpc/module.modulemap +2 -0
- data/include/grpc/private_key_signer.h +104 -0
- data/include/grpc/support/port_platform.h +6 -0
- data/src/core/call/call_filters.h +101 -78
- data/src/core/call/call_spine.h +91 -68
- data/src/core/call/call_state.h +60 -4
- data/src/core/call/client_call.cc +9 -9
- data/src/core/call/client_call.h +1 -1
- data/src/core/call/metadata_batch.cc +2 -0
- data/src/core/call/metadata_batch.h +48 -1
- data/src/core/call/metadata_info.cc +35 -0
- data/src/core/call/metadata_info.h +2 -0
- data/src/core/call/simple_slice_based_metadata.h +2 -1
- data/src/core/channelz/channelz.cc +9 -6
- data/src/core/channelz/channelz.h +7 -4
- data/src/core/channelz/property_list.h +5 -0
- data/src/core/channelz/v2tov1/convert.cc +1 -1
- data/src/core/channelz/v2tov1/legacy_api.cc +164 -307
- data/src/core/client_channel/buffered_call.cc +7 -3
- data/src/core/client_channel/buffered_call.h +11 -5
- data/src/core/client_channel/client_channel.cc +106 -44
- data/src/core/client_channel/client_channel.h +3 -6
- data/src/core/client_channel/client_channel_filter.cc +90 -64
- data/src/core/client_channel/client_channel_filter.h +3 -6
- data/src/core/client_channel/client_channel_internal.h +5 -0
- data/src/core/client_channel/config_selector.h +17 -12
- data/src/core/client_channel/dynamic_filters.cc +8 -7
- data/src/core/client_channel/dynamic_filters.h +7 -5
- data/src/core/client_channel/retry_filter.cc +1 -1
- data/src/core/client_channel/retry_filter.h +2 -2
- data/src/core/client_channel/subchannel.cc +1682 -266
- data/src/core/client_channel/subchannel.h +411 -134
- data/src/core/client_channel/subchannel_stream_client.cc +22 -18
- data/src/core/client_channel/subchannel_stream_client.h +8 -9
- data/src/core/client_channel/subchannel_stream_limiter.cc +76 -0
- data/src/core/client_channel/subchannel_stream_limiter.h +51 -0
- data/src/core/config/config_vars.cc +9 -1
- data/src/core/config/config_vars.h +6 -0
- data/src/core/credentials/call/call_creds_registry.h +51 -22
- data/src/core/credentials/call/call_creds_registry_init.cc +86 -2
- data/src/core/credentials/call/external/aws_external_account_credentials.cc +2 -2
- data/src/core/credentials/call/external/external_account_credentials.cc +11 -4
- data/src/core/credentials/call/external/file_external_account_credentials.cc +2 -2
- data/src/core/credentials/transport/channel_creds_registry.h +71 -20
- data/src/core/credentials/transport/channel_creds_registry_init.cc +338 -29
- data/src/core/credentials/transport/ssl/ssl_credentials.cc +43 -24
- data/src/core/credentials/transport/ssl/ssl_credentials.h +7 -1
- data/src/core/credentials/transport/ssl/ssl_security_connector.cc +2 -8
- data/src/core/credentials/transport/ssl/ssl_security_connector.h +4 -3
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.cc +25 -5
- data/src/core/credentials/transport/tls/grpc_tls_certificate_distributor.h +7 -5
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.cc +181 -109
- data/src/core/credentials/transport/tls/grpc_tls_certificate_provider.h +55 -42
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.cc +28 -23
- data/src/core/credentials/transport/tls/grpc_tls_credentials_options.h +26 -23
- data/src/core/credentials/transport/tls/spiffe_utils.cc +2 -2
- data/src/core/credentials/transport/tls/ssl_utils.cc +18 -18
- data/src/core/credentials/transport/tls/ssl_utils.h +12 -10
- data/src/core/credentials/transport/tls/tls_security_connector.cc +106 -74
- data/src/core/credentials/transport/tls/tls_security_connector.h +12 -8
- data/src/core/credentials/transport/xds/xds_credentials.cc +76 -32
- data/src/core/credentials/transport/xds/xds_credentials.h +4 -2
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +117 -35
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +42 -4
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.cc +58 -29
- data/src/core/ext/filters/gcp_authentication/gcp_authentication_filter.h +19 -11
- data/src/core/ext/filters/stateful_session/stateful_session_filter.cc +82 -25
- data/src/core/ext/filters/stateful_session/stateful_session_filter.h +28 -3
- data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.cc +9 -7
- data/src/core/ext/filters/stateful_session/stateful_session_service_config_parser.h +1 -1
- data/src/core/ext/transport/chttp2/transport/call_tracer_wrapper.h +7 -1
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +117 -67
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +2 -0
- data/src/core/ext/transport/chttp2/transport/flow_control.h +11 -1
- data/src/core/ext/transport/chttp2/transport/frame.cc +2 -15
- data/src/core/ext/transport/chttp2/transport/frame.h +0 -4
- data/src/core/ext/transport/chttp2/transport/goaway.cc +17 -2
- data/src/core/ext/transport/chttp2/transport/goaway.h +27 -6
- data/src/core/ext/transport/chttp2/transport/header_assembler.h +8 -21
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +101 -40
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.h +95 -0
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.cc +923 -772
- data/src/core/ext/transport/chttp2/transport/http2_client_transport.h +406 -423
- data/src/core/ext/transport/chttp2/transport/http2_settings.cc +1 -0
- data/src/core/ext/transport/chttp2/transport/http2_settings.h +8 -1
- data/src/core/ext/transport/chttp2/transport/http2_settings_promises.h +25 -13
- data/src/core/ext/transport/chttp2/transport/http2_transport.cc +71 -24
- data/src/core/ext/transport/chttp2/transport/http2_transport.h +25 -49
- data/src/core/ext/transport/chttp2/transport/http2_ztrace_collector.h +2 -2
- data/src/core/ext/transport/chttp2/transport/incoming_metadata_tracker.h +29 -9
- data/src/core/ext/transport/chttp2/transport/internal.h +6 -2
- data/src/core/ext/transport/chttp2/transport/keepalive.cc +14 -20
- data/src/core/ext/transport/chttp2/transport/keepalive.h +9 -6
- data/src/core/ext/transport/chttp2/transport/parsing.cc +11 -0
- data/src/core/ext/transport/chttp2/transport/ping_promise.cc +34 -74
- data/src/core/ext/transport/chttp2/transport/ping_promise.h +123 -79
- data/src/core/ext/transport/chttp2/transport/security_frame.h +233 -3
- data/src/core/ext/transport/chttp2/transport/stream.h +152 -73
- data/src/core/ext/transport/chttp2/transport/stream_data_queue.h +155 -85
- data/src/core/ext/transport/chttp2/transport/transport_common.h +0 -5
- data/src/core/ext/transport/chttp2/transport/writable_streams.h +8 -7
- data/src/core/ext/transport/chttp2/transport/write_cycle.cc +86 -0
- data/src/core/ext/transport/chttp2/transport/write_cycle.h +355 -0
- data/src/core/ext/transport/chttp2/transport/writing.cc +31 -29
- data/src/core/ext/upb-gen/cel/expr/checked.upb.h +1875 -0
- data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.c +409 -0
- data/src/core/ext/upb-gen/cel/expr/checked.upb_minitable.h +56 -0
- data/src/core/ext/upb-gen/cel/expr/syntax.upb.h +2223 -0
- data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.c +489 -0
- data/src/core/ext/upb-gen/cel/expr/syntax.upb_minitable.h +60 -0
- data/src/core/ext/upb-gen/envoy/config/accesslog/v3/accesslog.upb.h +2 -1
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb.h +130 -18
- data/src/core/ext/upb-gen/envoy/config/bootstrap/v3/bootstrap.upb_minitable.c +18 -13
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb.h +70 -38
- data/src/core/ext/upb-gen/envoy/config/cluster/v3/cluster.upb_minitable.c +20 -17
- data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb.h +26 -10
- data/src/core/ext/upb-gen/envoy/config/common/matcher/v3/matcher.upb_minitable.c +8 -7
- data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb.h +495 -0
- data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.c +114 -0
- data/src/core/ext/upb-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upb_minitable.h +36 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb.h +26 -10
- data/src/core/ext/upb-gen/envoy/config/core/v3/address.upb_minitable.c +8 -7
- data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb.h +121 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.c +54 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/cel.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb.h +143 -9
- data/src/core/ext/upb-gen/envoy/config/core/v3/grpc_service.upb_minitable.c +18 -6
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb.h +112 -11
- data/src/core/ext/upb-gen/envoy/config/core/v3/protocol.upb_minitable.c +22 -9
- data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb.h +276 -0
- data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.c +60 -5
- data/src/core/ext/upb-gen/envoy/config/core/v3/proxy_protocol.upb_minitable.h +4 -0
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb.h +72 -0
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.c +23 -2
- data/src/core/ext/upb-gen/envoy/config/endpoint/v3/endpoint_components.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb.h +129 -13
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.c +36 -10
- data/src/core/ext/upb-gen/envoy/config/listener/v3/listener.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb.h +30 -0
- data/src/core/ext/upb-gen/envoy/config/listener/v3/quic_config.upb_minitable.c +5 -3
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb.h +16 -0
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/metrics_service.upb_minitable.c +4 -3
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb.h +31 -0
- data/src/core/ext/upb-gen/envoy/config/metrics/v3/stats.upb_minitable.c +5 -3
- data/src/core/ext/upb-gen/envoy/config/overload/v3/overload.upb.h +2 -1
- data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb.h +63 -0
- data/src/core/ext/upb-gen/envoy/config/rbac/v3/rbac.upb_minitable.c +12 -7
- data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb.h +97 -81
- data/src/core/ext/upb-gen/envoy/config/route/v3/route.upb_minitable.c +40 -23
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb.h +604 -228
- data/src/core/ext/upb-gen/envoy/config/route/v3/route_components.upb_minitable.c +146 -100
- data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb.h +30 -0
- data/src/core/ext/upb-gen/envoy/config/tap/v3/common.upb_minitable.c +5 -3
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb.h +35 -3
- data/src/core/ext/upb-gen/envoy/config/trace/v3/opentelemetry.upb_minitable.c +7 -4
- data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb.h +66 -14
- data/src/core/ext/upb-gen/envoy/config/trace/v3/zipkin.upb_minitable.c +22 -11
- data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +87 -0
- data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.c +29 -2
- data/src/core/ext/upb-gen/envoy/extensions/clusters/aggregate/v3/cluster.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb.h +0 -1
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/rbac/v3/rbac.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb.h +20 -4
- data/src/core/ext/upb-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upb_minitable.c +5 -4
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +239 -60
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.c +59 -28
- data/src/core/ext/upb-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb.h +89 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.c +50 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb.h +135 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.c +53 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/tls/v3/tls_credentials.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb.h +105 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.c +51 -0
- data/src/core/ext/upb-gen/envoy/extensions/grpc_service/channel_credentials/xds/v3/xds_credentials.upb_minitable.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb.h +32 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/client_side_weighted_round_robin/v3/client_side_weighted_round_robin.upb_minitable.c +6 -3
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb.h +206 -0
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.c +41 -8
- data/src/core/ext/upb-gen/envoy/extensions/load_balancing_policies/common/v3/common.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb.h +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/common.upb_minitable.c +4 -3
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +64 -0
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.c +31 -5
- data/src/core/ext/upb-gen/envoy/extensions/transport_sockets/tls/v3/secret.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb.h +283 -14
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.c +48 -11
- data/src/core/ext/upb-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb.h +144 -6
- data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.c +35 -7
- data/src/core/ext/upb-gen/envoy/type/http/v3/cookie.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb.h +42 -21
- data/src/core/ext/upb-gen/envoy/type/tracing/v3/custom_tag.upb_minitable.c +9 -8
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb.h +164 -1
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.c +37 -6
- data/src/core/ext/upb-gen/src/proto/grpc/channelz/v2/promise.upb_minitable.h +2 -0
- data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb.h +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/cel.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb.h +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/http_inputs.upb_minitable.c +0 -1
- data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb.h +26 -11
- data/src/core/ext/upb-gen/xds/type/matcher/v3/matcher.upb_minitable.c +8 -8
- data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb.h +33 -0
- data/src/core/ext/upb-gen/xds/type/matcher/v3/string.upb_minitable.c +14 -3
- data/src/core/ext/upb-gen/xds/type/v3/cel.upb.h +90 -10
- data/src/core/ext/upb-gen/xds/type/v3/cel.upb_minitable.c +18 -7
- data/src/core/ext/upbdefs-gen/cel/expr/checked.upbdefs.c +248 -0
- data/src/core/ext/upbdefs-gen/cel/expr/checked.upbdefs.h +97 -0
- data/src/core/ext/upbdefs-gen/cel/expr/syntax.upbdefs.c +283 -0
- data/src/core/ext/upbdefs-gen/cel/expr/syntax.upbdefs.h +107 -0
- data/src/core/ext/upbdefs-gen/envoy/config/accesslog/v3/accesslog.upbdefs.c +213 -211
- data/src/core/ext/upbdefs-gen/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +635 -614
- data/src/core/ext/upbdefs-gen/envoy/config/cluster/v3/cluster.upbdefs.c +1012 -1000
- data/src/core/ext/upbdefs-gen/envoy/config/common/matcher/v3/matcher.upbdefs.c +276 -273
- data/src/core/ext/upbdefs-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upbdefs.c +152 -0
- data/src/core/ext/upbdefs-gen/envoy/config/common/mutation_rules/v3/mutation_rules.upbdefs.h +47 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/address.upbdefs.c +149 -144
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/base.upbdefs.c +367 -370
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/cel.upbdefs.c +63 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/cel.upbdefs.h +37 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/grpc_service.upbdefs.c +297 -284
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/protocol.upbdefs.c +492 -469
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.c +74 -43
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/proxy_protocol.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-gen/envoy/config/core/v3/substitution_format_string.upbdefs.c +60 -59
- data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.c +202 -184
- data/src/core/ext/upbdefs-gen/envoy/config/endpoint/v3/endpoint_components.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.c +354 -339
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/listener.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/config/listener/v3/quic_config.upbdefs.c +28 -19
- data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/metrics_service.upbdefs.c +30 -27
- data/src/core/ext/upbdefs-gen/envoy/config/metrics/v3/stats.upbdefs.c +71 -66
- data/src/core/ext/upbdefs-gen/envoy/config/overload/v3/overload.upbdefs.c +94 -91
- data/src/core/ext/upbdefs-gen/envoy/config/rbac/v3/rbac.upbdefs.c +386 -369
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route.upbdefs.c +60 -57
- data/src/core/ext/upbdefs-gen/envoy/config/route/v3/route_components.upbdefs.c +1974 -1884
- data/src/core/ext/upbdefs-gen/envoy/config/tap/v3/common.upbdefs.c +119 -112
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/opentelemetry.upbdefs.c +62 -51
- data/src/core/ext/upbdefs-gen/envoy/config/trace/v3/zipkin.upbdefs.c +109 -88
- data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +54 -36
- data/src/core/ext/upbdefs-gen/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/rbac/v3/rbac.upbdefs.c +78 -84
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/http/stateful_session/v3/stateful_session.upbdefs.c +48 -46
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +1041 -984
- data/src/core/ext/upbdefs-gen/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +304 -290
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +94 -77
- data/src/core/ext/upbdefs-gen/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.c +246 -193
- data/src/core/ext/upbdefs-gen/envoy/extensions/upstreams/http/v3/http_protocol_options.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.c +37 -23
- data/src/core/ext/upbdefs-gen/envoy/type/http/v3/cookie.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/envoy/type/tracing/v3/custom_tag.upbdefs.c +5 -3
- data/src/core/ext/upbdefs-gen/google/api/http.upbdefs.c +4 -4
- data/src/core/ext/upbdefs-gen/google/api/httpbody.upbdefs.c +4 -5
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.c +113 -87
- data/src/core/ext/upbdefs-gen/src/proto/grpc/channelz/v2/promise.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-gen/udpa/annotations/migrate.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/security.upbdefs.c +6 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/sensitive.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/status.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/udpa/annotations/versioning.upbdefs.c +5 -5
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/cel.upbdefs.c +25 -30
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/http_inputs.upbdefs.c +14 -20
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/matcher.upbdefs.c +180 -183
- data/src/core/ext/upbdefs-gen/xds/type/matcher/v3/string.upbdefs.c +56 -47
- data/src/core/ext/upbdefs-gen/xds/type/v3/cel.upbdefs.c +69 -47
- data/src/core/filter/filter_chain.h +95 -0
- data/src/core/handshaker/http_connect/{http_connect_handshaker.cc → http_connect_client_handshaker.cc} +32 -31
- data/src/core/handshaker/http_connect/{http_connect_handshaker.h → http_connect_client_handshaker.h} +4 -4
- data/src/core/handshaker/http_connect/http_proxy_mapper.cc +1 -1
- data/src/core/handshaker/http_connect/xds_http_proxy_mapper.cc +1 -1
- data/src/core/handshaker/security/pipelined_secure_endpoint.cc +14 -13
- data/src/core/handshaker/security/secure_endpoint.cc +282 -68
- data/src/core/handshaker/security/secure_endpoint.h +0 -7
- data/src/core/lib/channel/channel_args.h +1 -1
- data/src/core/lib/channel/promise_based_filter.cc +17 -4
- data/src/core/lib/channel/promise_based_filter.h +3 -2
- data/src/core/lib/debug/trace_flags.cc +2 -0
- data/src/core/lib/debug/trace_flags.h +1 -0
- data/src/core/lib/event_engine/cf_engine/cfstream_endpoint.cc +35 -8
- data/src/core/lib/event_engine/cf_engine/dns_service_resolver.h +1 -2
- data/src/core/lib/event_engine/event_engine.cc +9 -0
- data/src/core/lib/event_engine/extensions/tcp_trace.h +0 -3
- data/src/core/lib/event_engine/posix_engine/ev_poll_posix.cc +2 -2
- data/src/core/lib/event_engine/posix_engine/posix_endpoint.h +1 -1
- data/src/core/lib/event_engine/posix_engine/posix_engine.cc +34 -9
- data/src/core/lib/event_engine/posix_engine/posix_engine.h +24 -2
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener.cc +1 -3
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.cc +141 -14
- data/src/core/lib/event_engine/posix_engine/posix_engine_listener_utils.h +19 -2
- data/src/core/lib/event_engine/posix_engine/posix_interface.h +7 -0
- data/src/core/lib/event_engine/posix_engine/posix_interface_posix.cc +21 -3
- data/src/core/lib/event_engine/posix_engine/posix_interface_windows.cc +16 -0
- data/src/core/lib/experiments/experiments.cc +309 -201
- data/src/core/lib/experiments/experiments.h +141 -80
- data/src/core/lib/iomgr/event_engine_shims/endpoint.cc +2 -2
- data/src/core/lib/iomgr/resolve_address.h +0 -2
- data/src/core/lib/iomgr/resolved_address.h +0 -2
- data/src/core/lib/iomgr/tcp_posix.cc +13 -5
- data/src/core/lib/iomgr/tcp_server.cc +0 -5
- data/src/core/lib/iomgr/tcp_server.h +0 -7
- data/src/core/lib/iomgr/tcp_server_posix.cc +0 -17
- data/src/core/lib/iomgr/tcp_server_utils_posix.h +0 -3
- data/src/core/lib/iomgr/tcp_server_windows.cc +12 -51
- data/src/core/lib/promise/all_ok.h +17 -12
- data/src/core/lib/promise/cancel_callback.h +12 -13
- data/src/core/lib/promise/detail/join_state.h +626 -0
- data/src/core/lib/promise/detail/promise_factory.h +14 -14
- data/src/core/lib/promise/for_each.h +32 -8
- data/src/core/lib/promise/if.h +9 -7
- data/src/core/lib/promise/loop.h +18 -16
- data/src/core/lib/promise/map.h +54 -47
- data/src/core/lib/promise/mpsc.h +11 -10
- data/src/core/lib/promise/observable.h +6 -6
- data/src/core/lib/promise/party.h +25 -19
- data/src/core/lib/promise/poll.h +5 -5
- data/src/core/lib/promise/prioritized_race.h +10 -7
- data/src/core/lib/promise/promise.h +16 -11
- data/src/core/lib/promise/race.h +6 -5
- data/src/core/lib/promise/seq.h +109 -74
- data/src/core/lib/promise/try_join.h +14 -6
- data/src/core/lib/promise/try_seq.h +76 -60
- data/src/core/lib/resource_quota/api.cc +7 -0
- data/src/core/lib/resource_quota/arena.h +1 -1
- data/src/core/lib/resource_quota/memory_quota.cc +4 -1
- data/src/core/lib/resource_quota/resource_quota.cc +2 -1
- data/src/core/lib/resource_quota/resource_quota.h +3 -0
- data/src/core/lib/resource_quota/stream_quota.cc +77 -1
- data/src/core/lib/resource_quota/stream_quota.h +64 -1
- data/src/core/lib/resource_quota/telemetry.h +1 -1
- data/src/core/lib/surface/call.cc +13 -0
- data/src/core/lib/surface/call_utils.h +58 -43
- data/src/core/lib/surface/channel.h +1 -4
- data/src/core/lib/surface/completion_queue.cc +13 -6
- data/src/core/lib/surface/validate_metadata.cc +20 -15
- data/src/core/lib/surface/validate_metadata.h +3 -1
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/promise_endpoint.cc +1 -1
- data/src/core/lib/transport/promise_endpoint.h +1 -1
- data/src/core/lib/transport/transport.h +5 -0
- data/src/core/load_balancing/health_check_client.cc +1 -15
- data/src/core/load_balancing/health_check_client_internal.h +0 -2
- data/src/core/load_balancing/oob_backend_metric.cc +1 -5
- data/src/core/load_balancing/oob_backend_metric_internal.h +0 -1
- data/src/core/load_balancing/xds/xds_cluster_impl.cc +12 -9
- data/src/core/plugin_registry/grpc_plugin_registry.cc +3 -2
- data/src/core/resolver/xds/xds_resolver.cc +162 -116
- data/src/core/server/server.cc +18 -1
- data/src/core/server/server.h +2 -0
- data/src/core/server/xds_server_config_fetcher.cc +4 -4
- data/src/core/telemetry/call_tracer.cc +87 -2
- data/src/core/telemetry/call_tracer.h +46 -8
- data/src/core/telemetry/instrument.cc +102 -40
- data/src/core/telemetry/instrument.h +246 -65
- data/src/core/tsi/fake_transport_security.cc +3 -1
- data/src/core/tsi/ssl_transport_security.cc +516 -137
- data/src/core/tsi/ssl_transport_security.h +28 -22
- data/src/core/tsi/ssl_transport_security_utils.cc +2 -2
- data/src/core/tsi/ssl_transport_security_utils.h +2 -2
- data/src/core/util/bitset.h +6 -0
- data/src/core/util/function_signature.h +3 -1
- data/src/core/util/http_client/httpcli_security_connector.cc +2 -1
- data/src/core/util/json/json_reader.cc +0 -4
- data/src/core/xds/grpc/certificate_provider_store.cc +2 -1
- data/src/core/xds/grpc/certificate_provider_store.h +3 -17
- data/src/core/xds/grpc/certificate_provider_store_interface.h +61 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc.cc +48 -0
- data/src/core/xds/grpc/xds_bootstrap_grpc.h +18 -0
- data/src/core/xds/grpc/xds_certificate_provider.cc +7 -2
- data/src/core/xds/grpc/xds_certificate_provider.h +13 -2
- data/src/core/xds/grpc/xds_client_grpc.cc +13 -6
- data/src/core/xds/grpc/xds_client_grpc.h +10 -7
- data/src/core/xds/grpc/xds_cluster.cc +18 -4
- data/src/core/xds/grpc/xds_cluster.h +17 -2
- data/src/core/xds/grpc/xds_cluster_parser.cc +36 -11
- data/src/core/xds/grpc/xds_common_types.cc +45 -0
- data/src/core/xds/grpc/xds_common_types.h +31 -0
- data/src/core/xds/grpc/xds_common_types_parser.cc +274 -16
- data/src/core/xds/grpc/xds_common_types_parser.h +12 -0
- data/src/core/xds/grpc/xds_http_fault_filter.cc +128 -24
- data/src/core/xds/grpc/xds_http_fault_filter.h +19 -10
- data/src/core/xds/grpc/xds_http_filter.cc +38 -0
- data/src/core/xds/grpc/xds_http_filter.h +70 -47
- data/src/core/xds/grpc/xds_http_filter_registry.cc +48 -14
- data/src/core/xds/grpc/xds_http_filter_registry.h +29 -15
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.cc +88 -22
- data/src/core/xds/grpc/xds_http_gcp_authn_filter.h +22 -11
- data/src/core/xds/grpc/xds_http_rbac_filter.cc +36 -20
- data/src/core/xds/grpc/xds_http_rbac_filter.h +19 -10
- data/src/core/xds/grpc/xds_http_stateful_session_filter.cc +143 -26
- data/src/core/xds/grpc/xds_http_stateful_session_filter.h +19 -10
- data/src/core/xds/grpc/xds_listener.cc +4 -1
- data/src/core/xds/grpc/xds_listener.h +10 -2
- data/src/core/xds/grpc/xds_listener_parser.cc +23 -18
- data/src/core/xds/grpc/xds_matcher.cc +40 -5
- data/src/core/xds/grpc/xds_matcher.h +13 -0
- data/src/core/xds/grpc/xds_matcher_action.h +1 -1
- data/src/core/xds/grpc/xds_matcher_parse.cc +60 -40
- data/src/core/xds/grpc/xds_matcher_parse.h +2 -1
- data/src/core/xds/grpc/xds_route_config.cc +12 -1
- data/src/core/xds/grpc/xds_route_config.h +15 -2
- data/src/core/xds/grpc/xds_route_config_parser.cc +11 -5
- data/src/core/xds/grpc/xds_routing.cc +181 -6
- data/src/core/xds/grpc/xds_routing.h +57 -0
- data/src/core/xds/grpc/xds_server_grpc.cc +55 -43
- data/src/core/xds/grpc/xds_server_grpc.h +13 -6
- data/src/core/xds/grpc/xds_server_grpc_interface.h +3 -2
- data/src/core/xds/grpc/xds_transport_grpc.cc +12 -6
- data/src/core/xds/grpc/xds_transport_grpc.h +5 -1
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +12 -8
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +18 -12
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/generate_proto_ruby.sh +1 -1
- metadata +42 -6
- data/src/core/ext/transport/chttp2/transport/security_frame.cc +0 -31
- data/src/core/handshaker/security/legacy_secure_endpoint.cc +0 -597
|
@@ -49,15 +49,13 @@ using ::grpc_event_engine::experimental::EventEngine;
|
|
|
49
49
|
//
|
|
50
50
|
|
|
51
51
|
SubchannelStreamClient::SubchannelStreamClient(
|
|
52
|
-
|
|
53
|
-
grpc_pollset_set* interested_parties,
|
|
52
|
+
WeakRefCountedPtr<Subchannel> subchannel,
|
|
54
53
|
std::unique_ptr<CallEventHandler> event_handler, const char* tracer)
|
|
55
54
|
: InternallyRefCounted<SubchannelStreamClient>(tracer),
|
|
56
|
-
|
|
57
|
-
interested_parties_(interested_parties),
|
|
55
|
+
subchannel_(std::move(subchannel)),
|
|
58
56
|
tracer_(tracer),
|
|
59
57
|
call_allocator_(MakeRefCounted<CallArenaAllocator>(
|
|
60
|
-
|
|
58
|
+
subchannel_->args()
|
|
61
59
|
.GetObject<ResourceQuota>()
|
|
62
60
|
->memory_quota()
|
|
63
61
|
->CreateMemoryAllocator(
|
|
@@ -72,7 +70,7 @@ SubchannelStreamClient::SubchannelStreamClient(
|
|
|
72
70
|
.set_jitter(SUBCHANNEL_STREAM_RECONNECT_JITTER)
|
|
73
71
|
.set_max_backoff(Duration::Seconds(
|
|
74
72
|
SUBCHANNEL_STREAM_RECONNECT_MAX_BACKOFF_SECONDS))),
|
|
75
|
-
event_engine_(
|
|
73
|
+
event_engine_(subchannel_->args().GetObject<EventEngine>()) {
|
|
76
74
|
if (GPR_UNLIKELY(tracer_ != nullptr)) {
|
|
77
75
|
LOG(INFO) << tracer_ << " " << this << ": created SubchannelStreamClient";
|
|
78
76
|
}
|
|
@@ -114,13 +112,18 @@ void SubchannelStreamClient::StartCallLocked() {
|
|
|
114
112
|
if (event_handler_ != nullptr) {
|
|
115
113
|
event_handler_->OnCallStartLocked(this);
|
|
116
114
|
}
|
|
117
|
-
call_state_ = MakeOrphanable<CallState>(Ref(),
|
|
115
|
+
call_state_ = MakeOrphanable<CallState>(Ref(), subchannel_->pollset_set());
|
|
118
116
|
if (GPR_UNLIKELY(tracer_ != nullptr)) {
|
|
119
117
|
LOG(INFO) << tracer_ << " " << this
|
|
120
118
|
<< ": SubchannelStreamClient created CallState "
|
|
121
119
|
<< call_state_.get();
|
|
122
120
|
}
|
|
123
|
-
call_state_->StartCallLocked();
|
|
121
|
+
bool call_started = call_state_->StartCallLocked();
|
|
122
|
+
// If we could not create the call due to the subchannel loosing its
|
|
123
|
+
// connection, then manually destroy the CallState object, and don't
|
|
124
|
+
// do any retry. The caller will recreate the SubchannelStreamClient
|
|
125
|
+
// when the connection is reestablished.
|
|
126
|
+
if (!call_started) delete call_state_.release();
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
void SubchannelStreamClient::StartRetryTimerLocked() {
|
|
@@ -188,9 +191,8 @@ void SubchannelStreamClient::CallState::Orphan() {
|
|
|
188
191
|
Cancel();
|
|
189
192
|
}
|
|
190
193
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
subchannel_stream_client_->connected_subchannel_,
|
|
194
|
+
bool SubchannelStreamClient::CallState::StartCallLocked() {
|
|
195
|
+
Subchannel::CreateCallArgs args = {
|
|
194
196
|
&pollent_,
|
|
195
197
|
gpr_get_cycle_counter(), // start_time
|
|
196
198
|
Timestamp::InfFuture(), // deadline
|
|
@@ -198,19 +200,21 @@ void SubchannelStreamClient::CallState::StartCallLocked() {
|
|
|
198
200
|
&call_combiner_,
|
|
199
201
|
};
|
|
200
202
|
grpc_error_handle error;
|
|
201
|
-
call_ =
|
|
203
|
+
call_ = subchannel_stream_client_->subchannel_->CreateCall(args, &error)
|
|
204
|
+
.release();
|
|
205
|
+
// If there was no connection to start a call on, signal the caller
|
|
206
|
+
// that we didn't create the call.
|
|
207
|
+
if (call_ == nullptr) return false;
|
|
202
208
|
// Register after-destruction callback.
|
|
203
209
|
GRPC_CLOSURE_INIT(&after_call_stack_destruction_, AfterCallStackDestruction,
|
|
204
210
|
this, grpc_schedule_on_exec_ctx);
|
|
205
211
|
call_->SetAfterCallStackDestroy(&after_call_stack_destruction_);
|
|
206
|
-
// Check if creation failed.
|
|
207
212
|
if (!error.ok() || subchannel_stream_client_->event_handler_ == nullptr) {
|
|
208
213
|
LOG(ERROR) << "SubchannelStreamClient " << subchannel_stream_client_.get()
|
|
209
214
|
<< " CallState " << this << ": error creating "
|
|
210
|
-
<< "stream on subchannel (" <<
|
|
211
|
-
<< "); will retry";
|
|
215
|
+
<< "stream on subchannel (" << error << "); will retry";
|
|
212
216
|
CallEndedLocked(/*retry=*/true);
|
|
213
|
-
return;
|
|
217
|
+
return true;
|
|
214
218
|
}
|
|
215
219
|
// Initialize payload and batch.
|
|
216
220
|
batch_.payload = &payload_;
|
|
@@ -222,7 +226,6 @@ void SubchannelStreamClient::CallState::StartCallLocked() {
|
|
|
222
226
|
send_initial_metadata_.Set(
|
|
223
227
|
HttpPathMetadata(),
|
|
224
228
|
subchannel_stream_client_->event_handler_->GetPathLocked());
|
|
225
|
-
GRPC_CHECK(error.ok());
|
|
226
229
|
payload_.send_initial_metadata.send_initial_metadata =
|
|
227
230
|
&send_initial_metadata_;
|
|
228
231
|
batch_.send_initial_metadata = true;
|
|
@@ -271,12 +274,13 @@ void SubchannelStreamClient::CallState::StartCallLocked() {
|
|
|
271
274
|
recv_trailing_metadata_batch_.recv_trailing_metadata = true;
|
|
272
275
|
// Start recv_trailing_metadata batch.
|
|
273
276
|
StartBatch(&recv_trailing_metadata_batch_);
|
|
277
|
+
return true;
|
|
274
278
|
}
|
|
275
279
|
|
|
276
280
|
void SubchannelStreamClient::CallState::StartBatchInCallCombiner(
|
|
277
281
|
void* arg, grpc_error_handle /*error*/) {
|
|
278
282
|
auto* batch = static_cast<grpc_transport_stream_op_batch*>(arg);
|
|
279
|
-
auto* call = static_cast<
|
|
283
|
+
auto* call = static_cast<Subchannel::Call*>(batch->handler_private.extra_arg);
|
|
280
284
|
call->StartTransportStreamOpBatch(batch);
|
|
281
285
|
}
|
|
282
286
|
|
|
@@ -98,10 +98,9 @@ class SubchannelStreamClient final
|
|
|
98
98
|
// string being the first part of the log message.
|
|
99
99
|
// Does not take ownership of interested_parties; the caller is responsible
|
|
100
100
|
// for ensuring that it will outlive the SubchannelStreamClient.
|
|
101
|
-
SubchannelStreamClient(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
std::unique_ptr<CallEventHandler> event_handler, const char* tracer);
|
|
101
|
+
SubchannelStreamClient(WeakRefCountedPtr<Subchannel> subchannel,
|
|
102
|
+
std::unique_ptr<CallEventHandler> event_handler,
|
|
103
|
+
const char* tracer);
|
|
105
104
|
|
|
106
105
|
~SubchannelStreamClient() override;
|
|
107
106
|
|
|
@@ -117,7 +116,8 @@ class SubchannelStreamClient final
|
|
|
117
116
|
|
|
118
117
|
void Orphan() override;
|
|
119
118
|
|
|
120
|
-
|
|
119
|
+
// Returns false if there was no connection to start a call on.
|
|
120
|
+
GRPC_MUST_USE_RESULT bool StartCallLocked()
|
|
121
121
|
ABSL_EXCLUSIVE_LOCKS_REQUIRED(&SubchannelStreamClient::mu_);
|
|
122
122
|
|
|
123
123
|
private:
|
|
@@ -149,7 +149,7 @@ class SubchannelStreamClient final
|
|
|
149
149
|
// The streaming call to the backend. Always non-null.
|
|
150
150
|
// Refs are tracked manually; when the last ref is released, the
|
|
151
151
|
// CallState object will be automatically destroyed.
|
|
152
|
-
|
|
152
|
+
Subchannel::Call* call_;
|
|
153
153
|
|
|
154
154
|
grpc_transport_stream_op_batch_payload payload_;
|
|
155
155
|
grpc_transport_stream_op_batch batch_;
|
|
@@ -194,8 +194,7 @@ class SubchannelStreamClient final
|
|
|
194
194
|
void StartRetryTimerLocked() ABSL_EXCLUSIVE_LOCKS_REQUIRED(&mu_);
|
|
195
195
|
void OnRetryTimer() ABSL_LOCKS_EXCLUDED(mu_);
|
|
196
196
|
|
|
197
|
-
|
|
198
|
-
grpc_pollset_set* interested_parties_; // Do not own.
|
|
197
|
+
WeakRefCountedPtr<Subchannel> subchannel_;
|
|
199
198
|
const char* tracer_;
|
|
200
199
|
RefCountedPtr<CallArenaAllocator> call_allocator_;
|
|
201
200
|
|
|
@@ -210,7 +209,7 @@ class SubchannelStreamClient final
|
|
|
210
209
|
BackOff retry_backoff_ ABSL_GUARDED_BY(mu_);
|
|
211
210
|
std::optional<grpc_event_engine::experimental::EventEngine::TaskHandle>
|
|
212
211
|
retry_timer_handle_ ABSL_GUARDED_BY(mu_);
|
|
213
|
-
// A raw pointer will suffice since
|
|
212
|
+
// A raw pointer will suffice since subchannel_ holds a copy of the
|
|
214
213
|
// ChannelArgs which holds an std::shared_ptr of the EventEngine.
|
|
215
214
|
grpc_event_engine::experimental::EventEngine* event_engine_
|
|
216
215
|
ABSL_GUARDED_BY(mu_);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 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/client_channel/subchannel_stream_limiter.h"
|
|
18
|
+
|
|
19
|
+
namespace grpc_core {
|
|
20
|
+
|
|
21
|
+
namespace {
|
|
22
|
+
|
|
23
|
+
uint64_t MakeStreamCounts(uint32_t max_concurrent_streams,
|
|
24
|
+
uint32_t rpcs_in_flight) {
|
|
25
|
+
return (static_cast<uint64_t>(max_concurrent_streams) << 32) +
|
|
26
|
+
static_cast<int64_t>(rpcs_in_flight);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
uint32_t GetMaxConcurrentStreams(uint64_t stream_counts) {
|
|
30
|
+
return static_cast<uint32_t>(stream_counts >> 32);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
uint32_t GetRpcsInFlight(uint64_t stream_counts) {
|
|
34
|
+
return static_cast<uint32_t>(stream_counts & 0xffffffffu);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
} // namespace
|
|
38
|
+
|
|
39
|
+
SubchannelStreamLimiter::SubchannelStreamLimiter(
|
|
40
|
+
uint32_t max_concurrent_streams)
|
|
41
|
+
: stream_counts_(MakeStreamCounts(max_concurrent_streams, 0)) {}
|
|
42
|
+
|
|
43
|
+
bool SubchannelStreamLimiter::SetMaxConcurrentStreams(
|
|
44
|
+
uint32_t max_concurrent_streams) {
|
|
45
|
+
uint64_t prev_stream_counts = stream_counts_.load(std::memory_order_acquire);
|
|
46
|
+
uint32_t rpcs_in_flight;
|
|
47
|
+
do {
|
|
48
|
+
rpcs_in_flight = GetRpcsInFlight(prev_stream_counts);
|
|
49
|
+
} while (!stream_counts_.compare_exchange_weak(
|
|
50
|
+
prev_stream_counts,
|
|
51
|
+
MakeStreamCounts(max_concurrent_streams, rpcs_in_flight),
|
|
52
|
+
std::memory_order_acq_rel, std::memory_order_acquire));
|
|
53
|
+
return rpcs_in_flight < max_concurrent_streams;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
bool SubchannelStreamLimiter::GetQuotaForRpc() {
|
|
57
|
+
uint64_t prev_stream_counts = stream_counts_.load(std::memory_order_acquire);
|
|
58
|
+
do {
|
|
59
|
+
const uint32_t rpcs_in_flight = GetRpcsInFlight(prev_stream_counts);
|
|
60
|
+
const uint32_t max_concurrent_streams =
|
|
61
|
+
GetMaxConcurrentStreams(prev_stream_counts);
|
|
62
|
+
if (rpcs_in_flight == max_concurrent_streams) return false;
|
|
63
|
+
} while (!stream_counts_.compare_exchange_weak(
|
|
64
|
+
prev_stream_counts, prev_stream_counts + MakeStreamCounts(0, 1),
|
|
65
|
+
std::memory_order_acq_rel, std::memory_order_acquire));
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
bool SubchannelStreamLimiter::ReturnQuotaForRpc() {
|
|
70
|
+
const uint64_t prev_stream_counts =
|
|
71
|
+
stream_counts_.fetch_sub(MakeStreamCounts(0, 1));
|
|
72
|
+
return GetRpcsInFlight(prev_stream_counts) ==
|
|
73
|
+
GetMaxConcurrentStreams(prev_stream_counts);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
} // namespace grpc_core
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 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_CLIENT_CHANNEL_SUBCHANNEL_STREAM_LIMITER_H
|
|
18
|
+
#define GRPC_SRC_CORE_CLIENT_CHANNEL_SUBCHANNEL_STREAM_LIMITER_H
|
|
19
|
+
|
|
20
|
+
#include <atomic>
|
|
21
|
+
#include <cstdint>
|
|
22
|
+
|
|
23
|
+
namespace grpc_core {
|
|
24
|
+
|
|
25
|
+
class SubchannelStreamLimiter {
|
|
26
|
+
public:
|
|
27
|
+
explicit SubchannelStreamLimiter(uint32_t max_concurrent_streams);
|
|
28
|
+
|
|
29
|
+
// Sets the maximum number of concurrent streams.
|
|
30
|
+
// Returns true if the current number of RPCs in flight is less than the new
|
|
31
|
+
// maximum.
|
|
32
|
+
bool SetMaxConcurrentStreams(uint32_t max_concurrent_streams);
|
|
33
|
+
|
|
34
|
+
// Attempts to get quota for a new RPC.
|
|
35
|
+
// Returns true if quota was acquired, false otherwise.
|
|
36
|
+
bool GetQuotaForRpc();
|
|
37
|
+
|
|
38
|
+
// Returns quota for a completed RPC.
|
|
39
|
+
// Returns true if the connection is no longer above its quota.
|
|
40
|
+
bool ReturnQuotaForRpc();
|
|
41
|
+
|
|
42
|
+
private:
|
|
43
|
+
// First 32 bits are the MAX_CONCURRENT_STREAMS value reported by
|
|
44
|
+
// the transport.
|
|
45
|
+
// Last 32 bits are the current number of RPCs in flight on the connection.
|
|
46
|
+
std::atomic<uint64_t> stream_counts_{0};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace grpc_core
|
|
50
|
+
|
|
51
|
+
#endif // GRPC_SRC_CORE_CLIENT_CHANNEL_SUBCHANNEL_STREAM_LIMITER_H
|
|
@@ -97,6 +97,8 @@ ABSL_FLAG(absl::optional<double>, grpc_experimental_memory_pressure_threshold,
|
|
|
97
97
|
"EXPERIMENTAL: The threshold for the memory quota pressure "
|
|
98
98
|
"controller. This is a value between 0 and 1, and must always be "
|
|
99
99
|
"greater than the target pressure.");
|
|
100
|
+
ABSL_FLAG(absl::optional<int32_t>, grpc_chaotic_good_metrics_update_interval_ms,
|
|
101
|
+
{}, "Interval in milliseconds for updating metrics in chaotic good.");
|
|
100
102
|
|
|
101
103
|
namespace grpc_core {
|
|
102
104
|
|
|
@@ -109,6 +111,10 @@ ConfigVars::ConfigVars(const Overrides& overrides)
|
|
|
109
111
|
LoadConfig(FLAGS_grpc_channelz_max_orphaned_nodes,
|
|
110
112
|
"GRPC_CHANNELZ_MAX_ORPHANED_NODES",
|
|
111
113
|
overrides.channelz_max_orphaned_nodes, 0)),
|
|
114
|
+
chaotic_good_metrics_update_interval_ms_(
|
|
115
|
+
LoadConfig(FLAGS_grpc_chaotic_good_metrics_update_interval_ms,
|
|
116
|
+
"GRPC_CHAOTIC_GOOD_METRICS_UPDATE_INTERVAL_MS",
|
|
117
|
+
overrides.chaotic_good_metrics_update_interval_ms, 100)),
|
|
112
118
|
experimental_target_memory_pressure_(
|
|
113
119
|
LoadConfig(FLAGS_grpc_experimental_target_memory_pressure,
|
|
114
120
|
"GRPC_EXPERIMENTAL_TARGET_MEMORY_PRESSURE",
|
|
@@ -194,6 +200,8 @@ std::string ConfigVars::ToString() const {
|
|
|
194
200
|
", experimental_target_memory_pressure: ",
|
|
195
201
|
ExperimentalTargetMemoryPressure(),
|
|
196
202
|
", experimental_memory_pressure_threshold: ",
|
|
197
|
-
ExperimentalMemoryPressureThreshold()
|
|
203
|
+
ExperimentalMemoryPressureThreshold(),
|
|
204
|
+
", chaotic_good_metrics_update_interval_ms: ",
|
|
205
|
+
ChaoticGoodMetricsUpdateIntervalMs());
|
|
198
206
|
}
|
|
199
207
|
} // namespace grpc_core
|
|
@@ -36,6 +36,7 @@ class GPR_DLL ConfigVars {
|
|
|
36
36
|
struct Overrides {
|
|
37
37
|
absl::optional<int32_t> client_channel_backup_poll_interval_ms;
|
|
38
38
|
absl::optional<int32_t> channelz_max_orphaned_nodes;
|
|
39
|
+
absl::optional<int32_t> chaotic_good_metrics_update_interval_ms;
|
|
39
40
|
absl::optional<double> experimental_target_memory_pressure;
|
|
40
41
|
absl::optional<double> experimental_memory_pressure_threshold;
|
|
41
42
|
absl::optional<bool> enable_fork_support;
|
|
@@ -133,6 +134,10 @@ class GPR_DLL ConfigVars {
|
|
|
133
134
|
double ExperimentalMemoryPressureThreshold() const {
|
|
134
135
|
return experimental_memory_pressure_threshold_;
|
|
135
136
|
}
|
|
137
|
+
// Interval in milliseconds for updating metrics in chaotic good.
|
|
138
|
+
int32_t ChaoticGoodMetricsUpdateIntervalMs() const {
|
|
139
|
+
return chaotic_good_metrics_update_interval_ms_;
|
|
140
|
+
}
|
|
136
141
|
|
|
137
142
|
private:
|
|
138
143
|
explicit ConfigVars(const Overrides& overrides);
|
|
@@ -140,6 +145,7 @@ class GPR_DLL ConfigVars {
|
|
|
140
145
|
static std::atomic<ConfigVars*> config_vars_;
|
|
141
146
|
int32_t client_channel_backup_poll_interval_ms_;
|
|
142
147
|
int32_t channelz_max_orphaned_nodes_;
|
|
148
|
+
int32_t chaotic_good_metrics_update_interval_ms_;
|
|
143
149
|
double experimental_target_memory_pressure_;
|
|
144
150
|
double experimental_memory_pressure_threshold_;
|
|
145
151
|
bool enable_fork_support_;
|
|
@@ -37,6 +37,8 @@ class CallCredsConfig : public RefCounted<CallCredsConfig> {
|
|
|
37
37
|
public:
|
|
38
38
|
virtual absl::string_view type() const = 0;
|
|
39
39
|
|
|
40
|
+
virtual absl::string_view proto_type() const = 0;
|
|
41
|
+
|
|
40
42
|
virtual bool Equals(const CallCredsConfig& other) const = 0;
|
|
41
43
|
|
|
42
44
|
virtual std::string ToString() const = 0;
|
|
@@ -47,11 +49,15 @@ class CallCredsFactory final {
|
|
|
47
49
|
public:
|
|
48
50
|
virtual ~CallCredsFactory() {}
|
|
49
51
|
virtual absl::string_view type() const = delete;
|
|
50
|
-
virtual RefCountedPtr<CallCredsConfig> ParseConfig(
|
|
52
|
+
virtual RefCountedPtr<const CallCredsConfig> ParseConfig(
|
|
51
53
|
const Json& config, const JsonArgs& args,
|
|
52
54
|
ValidationErrors* errors) const = delete;
|
|
55
|
+
virtual absl::string_view proto_type() const = delete;
|
|
56
|
+
virtual RefCountedPtr<const CallCredsConfig> ParseProto(
|
|
57
|
+
absl::string_view serialized_proto,
|
|
58
|
+
ValidationErrors* errors) const = delete;
|
|
53
59
|
virtual RefCountedPtr<T> CreateCallCreds(
|
|
54
|
-
RefCountedPtr<CallCredsConfig> config) const = delete;
|
|
60
|
+
RefCountedPtr<const CallCredsConfig> config) const = delete;
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
template <>
|
|
@@ -59,18 +65,21 @@ class CallCredsFactory<grpc_call_credentials> {
|
|
|
59
65
|
public:
|
|
60
66
|
virtual ~CallCredsFactory() {}
|
|
61
67
|
virtual absl::string_view type() const = 0;
|
|
62
|
-
virtual RefCountedPtr<CallCredsConfig> ParseConfig(
|
|
68
|
+
virtual RefCountedPtr<const CallCredsConfig> ParseConfig(
|
|
63
69
|
const Json& config, const JsonArgs& args,
|
|
64
70
|
ValidationErrors* errors) const = 0;
|
|
71
|
+
virtual absl::string_view proto_type() const = 0;
|
|
72
|
+
virtual RefCountedPtr<const CallCredsConfig> ParseProto(
|
|
73
|
+
absl::string_view serialized_proto, ValidationErrors* errors) const = 0;
|
|
65
74
|
virtual RefCountedPtr<grpc_call_credentials> CreateCallCreds(
|
|
66
|
-
RefCountedPtr<CallCredsConfig> config) const = 0;
|
|
75
|
+
RefCountedPtr<const CallCredsConfig> config) const = 0;
|
|
67
76
|
};
|
|
68
77
|
|
|
69
78
|
template <typename T = grpc_call_credentials>
|
|
70
79
|
class CallCredsRegistry {
|
|
71
80
|
private:
|
|
72
81
|
using FactoryMap =
|
|
73
|
-
std::map<absl::string_view, std::
|
|
82
|
+
std::map<absl::string_view, std::shared_ptr<CallCredsFactory<T>>>;
|
|
74
83
|
|
|
75
84
|
public:
|
|
76
85
|
static_assert(std::is_base_of<grpc_call_credentials, T>::value,
|
|
@@ -81,43 +90,63 @@ class CallCredsRegistry {
|
|
|
81
90
|
public:
|
|
82
91
|
void RegisterCallCredsFactory(
|
|
83
92
|
std::unique_ptr<CallCredsFactory<T>> factory) {
|
|
84
|
-
|
|
85
|
-
|
|
93
|
+
std::shared_ptr<CallCredsFactory<T>> shared_factory(std::move(factory));
|
|
94
|
+
absl::string_view type = shared_factory->type();
|
|
95
|
+
if (!type.empty()) name_map_[type] = shared_factory;
|
|
96
|
+
absl::string_view proto_type = shared_factory->proto_type();
|
|
97
|
+
if (!proto_type.empty()) proto_map_[proto_type] = shared_factory;
|
|
86
98
|
}
|
|
99
|
+
|
|
87
100
|
CallCredsRegistry Build() {
|
|
88
|
-
return CallCredsRegistry<T>(std::move(
|
|
101
|
+
return CallCredsRegistry<T>(std::move(name_map_), std::move(proto_map_));
|
|
89
102
|
}
|
|
90
103
|
|
|
91
104
|
private:
|
|
92
|
-
FactoryMap
|
|
105
|
+
FactoryMap name_map_;
|
|
106
|
+
FactoryMap proto_map_;
|
|
93
107
|
};
|
|
94
108
|
|
|
95
109
|
bool IsSupported(absl::string_view type) const {
|
|
96
|
-
return
|
|
110
|
+
return name_map_.find(type) != name_map_.end();
|
|
97
111
|
}
|
|
98
112
|
|
|
99
|
-
RefCountedPtr<CallCredsConfig> ParseConfig(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (it == factories_.cend()) return nullptr;
|
|
113
|
+
RefCountedPtr<const CallCredsConfig> ParseConfig(
|
|
114
|
+
absl::string_view type, const Json& config, const JsonArgs& args,
|
|
115
|
+
ValidationErrors* errors) const {
|
|
116
|
+
const auto it = name_map_.find(type);
|
|
117
|
+
if (it == name_map_.cend()) return nullptr;
|
|
105
118
|
return it->second->ParseConfig(config, args, errors);
|
|
106
119
|
}
|
|
107
120
|
|
|
121
|
+
bool IsProtoSupported(absl::string_view type) const {
|
|
122
|
+
return proto_map_.find(type) != proto_map_.end();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
RefCountedPtr<const CallCredsConfig> ParseProto(
|
|
126
|
+
absl::string_view proto_type, absl::string_view serialized_proto,
|
|
127
|
+
ValidationErrors* errors) const {
|
|
128
|
+
const auto it = proto_map_.find(proto_type);
|
|
129
|
+
if (it == proto_map_.cend()) return nullptr;
|
|
130
|
+
return it->second->ParseProto(serialized_proto, errors);
|
|
131
|
+
}
|
|
132
|
+
|
|
108
133
|
RefCountedPtr<T> CreateCallCreds(
|
|
109
|
-
RefCountedPtr<CallCredsConfig> config) const {
|
|
134
|
+
RefCountedPtr<const CallCredsConfig> config) const {
|
|
110
135
|
if (config == nullptr) return nullptr;
|
|
111
|
-
|
|
112
|
-
if (it ==
|
|
136
|
+
auto it = name_map_.find(config->type());
|
|
137
|
+
if (it == name_map_.cend()) {
|
|
138
|
+
it = proto_map_.find(config->proto_type());
|
|
139
|
+
if (it == proto_map_.cend()) return nullptr;
|
|
140
|
+
}
|
|
113
141
|
return it->second->CreateCallCreds(std::move(config));
|
|
114
142
|
}
|
|
115
143
|
|
|
116
144
|
private:
|
|
117
|
-
|
|
118
|
-
:
|
|
145
|
+
CallCredsRegistry(FactoryMap name_map, FactoryMap proto_map)
|
|
146
|
+
: name_map_(std::move(name_map)), proto_map_(std::move(proto_map)) {}
|
|
119
147
|
|
|
120
|
-
FactoryMap
|
|
148
|
+
FactoryMap name_map_;
|
|
149
|
+
FactoryMap proto_map_;
|
|
121
150
|
};
|
|
122
151
|
|
|
123
152
|
} // namespace grpc_core
|
|
@@ -22,10 +22,12 @@
|
|
|
22
22
|
#include <memory>
|
|
23
23
|
#include <string>
|
|
24
24
|
|
|
25
|
+
#include "envoy/extensions/grpc_service/call_credentials/access_token/v3/access_token_credentials.upb.h"
|
|
25
26
|
#include "src/core/config/core_configuration.h"
|
|
26
27
|
#include "src/core/credentials/call/call_credentials.h"
|
|
27
28
|
#include "src/core/credentials/call/call_creds_registry.h"
|
|
28
29
|
#include "src/core/credentials/call/jwt_token_file/jwt_token_file_call_credentials.h"
|
|
30
|
+
#include "src/core/credentials/call/oauth2/oauth2_credentials.h"
|
|
29
31
|
#include "src/core/util/down_cast.h"
|
|
30
32
|
#include "src/core/util/json/json.h"
|
|
31
33
|
#include "src/core/util/json/json_args.h"
|
|
@@ -41,14 +43,22 @@ class JwtTokenFileCallCredsFactory : public CallCredsFactory<> {
|
|
|
41
43
|
public:
|
|
42
44
|
absl::string_view type() const override { return Type(); }
|
|
43
45
|
|
|
44
|
-
RefCountedPtr<CallCredsConfig> ParseConfig(
|
|
46
|
+
RefCountedPtr<const CallCredsConfig> ParseConfig(
|
|
45
47
|
const Json& config, const JsonArgs& args,
|
|
46
48
|
ValidationErrors* errors) const override {
|
|
47
49
|
return LoadFromJson<RefCountedPtr<Config>>(config, args, errors);
|
|
48
50
|
}
|
|
49
51
|
|
|
52
|
+
absl::string_view proto_type() const override { return ""; }
|
|
53
|
+
|
|
54
|
+
RefCountedPtr<const CallCredsConfig> ParseProto(
|
|
55
|
+
absl::string_view /*serialized_proto*/,
|
|
56
|
+
ValidationErrors* /*errors*/) const override {
|
|
57
|
+
return nullptr;
|
|
58
|
+
}
|
|
59
|
+
|
|
50
60
|
RefCountedPtr<grpc_call_credentials> CreateCallCreds(
|
|
51
|
-
RefCountedPtr<CallCredsConfig> base_config) const override {
|
|
61
|
+
RefCountedPtr<const CallCredsConfig> base_config) const override {
|
|
52
62
|
auto* config = DownCast<const Config*>(base_config.get());
|
|
53
63
|
return MakeRefCounted<JwtTokenFileCallCredentials>(config->path());
|
|
54
64
|
}
|
|
@@ -58,6 +68,8 @@ class JwtTokenFileCallCredsFactory : public CallCredsFactory<> {
|
|
|
58
68
|
public:
|
|
59
69
|
absl::string_view type() const override { return Type(); }
|
|
60
70
|
|
|
71
|
+
absl::string_view proto_type() const override { return ""; }
|
|
72
|
+
|
|
61
73
|
bool Equals(const CallCredsConfig& other) const override {
|
|
62
74
|
auto& o = DownCast<const Config&>(other);
|
|
63
75
|
return path_ == o.path_;
|
|
@@ -83,9 +95,81 @@ class JwtTokenFileCallCredsFactory : public CallCredsFactory<> {
|
|
|
83
95
|
static absl::string_view Type() { return "jwt_token_file"; }
|
|
84
96
|
};
|
|
85
97
|
|
|
98
|
+
class AccessTokenCallCredsFactory : public CallCredsFactory<> {
|
|
99
|
+
public:
|
|
100
|
+
absl::string_view type() const override { return ""; }
|
|
101
|
+
|
|
102
|
+
RefCountedPtr<const CallCredsConfig> ParseConfig(
|
|
103
|
+
const Json& /*config*/, const JsonArgs& /*args*/,
|
|
104
|
+
ValidationErrors* /*errors*/) const override {
|
|
105
|
+
return nullptr;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
absl::string_view proto_type() const override { return ProtoType(); }
|
|
109
|
+
|
|
110
|
+
RefCountedPtr<const CallCredsConfig> ParseProto(
|
|
111
|
+
absl::string_view serialized_proto,
|
|
112
|
+
ValidationErrors* errors) const override {
|
|
113
|
+
upb::Arena arena;
|
|
114
|
+
const auto* proto =
|
|
115
|
+
envoy_extensions_grpc_service_call_credentials_access_token_v3_AccessTokenCredentials_parse(
|
|
116
|
+
serialized_proto.data(), serialized_proto.size(), arena.ptr());
|
|
117
|
+
if (proto == nullptr) {
|
|
118
|
+
errors->AddError("could not parse call credentials config");
|
|
119
|
+
return nullptr;
|
|
120
|
+
}
|
|
121
|
+
absl::string_view token = UpbStringToAbsl(
|
|
122
|
+
envoy_extensions_grpc_service_call_credentials_access_token_v3_AccessTokenCredentials_token(
|
|
123
|
+
proto));
|
|
124
|
+
if (token.empty()) {
|
|
125
|
+
ValidationErrors::ScopedField field(errors, ".token");
|
|
126
|
+
errors->AddError("field not present");
|
|
127
|
+
}
|
|
128
|
+
return MakeRefCounted<Config>(token);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
RefCountedPtr<grpc_call_credentials> CreateCallCreds(
|
|
132
|
+
RefCountedPtr<const CallCredsConfig> base_config) const override {
|
|
133
|
+
auto* config = DownCast<const Config*>(base_config.get());
|
|
134
|
+
return MakeRefCounted<grpc_access_token_credentials>(
|
|
135
|
+
config->token().c_str());
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private:
|
|
139
|
+
class Config : public CallCredsConfig {
|
|
140
|
+
public:
|
|
141
|
+
explicit Config(absl::string_view token) : token_(token) {}
|
|
142
|
+
|
|
143
|
+
absl::string_view type() const override { return ""; }
|
|
144
|
+
|
|
145
|
+
absl::string_view proto_type() const override { return ProtoType(); }
|
|
146
|
+
|
|
147
|
+
bool Equals(const CallCredsConfig& other) const override {
|
|
148
|
+
auto& o = DownCast<const Config&>(other);
|
|
149
|
+
return token_ == o.token_;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
std::string ToString() const override {
|
|
153
|
+
return absl::StrCat("{token=\"", token_, "\"}");
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const std::string& token() const { return token_; }
|
|
157
|
+
|
|
158
|
+
private:
|
|
159
|
+
std::string token_;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
static absl::string_view ProtoType() {
|
|
163
|
+
return "envoy.extensions.grpc_service.call_credentials.access_token"
|
|
164
|
+
".v3.AccessTokenCredentials";
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
86
168
|
void RegisterDefaultCallCreds(CoreConfiguration::Builder* builder) {
|
|
87
169
|
builder->call_creds_registry()->RegisterCallCredsFactory(
|
|
88
170
|
std::make_unique<JwtTokenFileCallCredsFactory>());
|
|
171
|
+
builder->call_creds_registry()->RegisterCallCredsFactory(
|
|
172
|
+
std::make_unique<AccessTokenCallCredsFactory>());
|
|
89
173
|
}
|
|
90
174
|
|
|
91
175
|
} // namespace grpc_core
|
|
@@ -292,8 +292,8 @@ void AwsExternalAccountCredentials::AwsFetchBody::RetrieveSigningKeys() {
|
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
294
294
|
if (role_name_.empty()) {
|
|
295
|
-
AsyncFinish(
|
|
296
|
-
|
|
295
|
+
AsyncFinish(absl::UnauthenticatedError(
|
|
296
|
+
"Missing role name when retrieving signing keys."));
|
|
297
297
|
return;
|
|
298
298
|
}
|
|
299
299
|
std::string url_with_role_name = absl::StrCat(creds_->url_, "/", role_name_);
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
#include "src/core/credentials/call/external/url_external_account_credentials.h"
|
|
35
35
|
#include "src/core/credentials/call/json_util.h"
|
|
36
36
|
#include "src/core/credentials/transport/transport_credentials.h"
|
|
37
|
+
#include "src/core/lib/transport/status_conversion.h"
|
|
37
38
|
#include "src/core/util/grpc_check.h"
|
|
38
39
|
#include "src/core/util/http_client/httpcli_ssl_credentials.h"
|
|
39
40
|
#include "src/core/util/http_client/parser.h"
|
|
@@ -108,7 +109,13 @@ void ExternalAccountCredentials::HttpFetchBody::OnHttpResponse(
|
|
|
108
109
|
absl::string_view response_body(self->response_.body,
|
|
109
110
|
self->response_.body_length);
|
|
110
111
|
if (self->response_.status != 200) {
|
|
111
|
-
|
|
112
|
+
grpc_status_code status_code =
|
|
113
|
+
grpc_http2_status_to_grpc_status(self->response_.status);
|
|
114
|
+
if (status_code != GRPC_STATUS_UNAVAILABLE) {
|
|
115
|
+
status_code = GRPC_STATUS_UNAUTHENTICATED;
|
|
116
|
+
}
|
|
117
|
+
self->Finish(absl::Status(
|
|
118
|
+
static_cast<absl::StatusCode>(status_code),
|
|
112
119
|
absl::StrCat("Call to HTTP server ended with status ",
|
|
113
120
|
self->response_.status, " [", response_body, "]")));
|
|
114
121
|
return;
|
|
@@ -180,7 +187,7 @@ void ExternalAccountCredentials::ExternalFetchRequest::ExchangeToken(
|
|
|
180
187
|
// Parse URI.
|
|
181
188
|
absl::StatusOr<URI> uri = URI::Parse(options().token_url);
|
|
182
189
|
if (!uri.ok()) {
|
|
183
|
-
return FinishTokenFetch(
|
|
190
|
+
return FinishTokenFetch(absl::UnauthenticatedError(
|
|
184
191
|
absl::StrFormat("Invalid token url: %s. Error: %s", options().token_url,
|
|
185
192
|
uri.status().ToString())));
|
|
186
193
|
}
|
|
@@ -284,7 +291,7 @@ void ExternalAccountCredentials::ExternalFetchRequest::
|
|
|
284
291
|
}
|
|
285
292
|
auto it = json->object().find("access_token");
|
|
286
293
|
if (it == json->object().end() || it->second.type() != Json::Type::kString) {
|
|
287
|
-
FinishTokenFetch(
|
|
294
|
+
FinishTokenFetch(absl::UnauthenticatedError(absl::StrFormat(
|
|
288
295
|
"Missing or invalid access_token in %s.", *response_body)));
|
|
289
296
|
return;
|
|
290
297
|
}
|
|
@@ -292,7 +299,7 @@ void ExternalAccountCredentials::ExternalFetchRequest::
|
|
|
292
299
|
absl::StatusOr<URI> uri =
|
|
293
300
|
URI::Parse(options().service_account_impersonation_url);
|
|
294
301
|
if (!uri.ok()) {
|
|
295
|
-
FinishTokenFetch(
|
|
302
|
+
FinishTokenFetch(absl::UnauthenticatedError(absl::StrFormat(
|
|
296
303
|
"Invalid service account impersonation url: %s. Error: %s",
|
|
297
304
|
options().service_account_impersonation_url, uri.status().ToString())));
|
|
298
305
|
return;
|