grpc 1.35.0.pre1 → 1.37.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of grpc might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Makefile +121 -89
- data/include/grpc/grpc.h +15 -1
- data/include/grpc/grpc_security.h +16 -11
- data/include/grpc/impl/codegen/port_platform.h +2 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +359 -331
- data/src/core/ext/filters/client_channel/client_channel.h +0 -2
- data/src/core/ext/filters/client_channel/client_channel_factory.h +2 -1
- data/src/core/ext/filters/client_channel/config_selector.h +9 -1
- data/src/core/ext/filters/client_channel/dynamic_filters.cc +9 -4
- data/src/core/ext/filters/client_channel/global_subchannel_pool.cc +24 -142
- data/src/core/ext/filters/client_channel/global_subchannel_pool.h +15 -10
- data/src/core/ext/filters/client_channel/http_connect_handshaker.cc +2 -2
- data/src/core/ext/filters/client_channel/lb_policy.cc +3 -0
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +3 -5
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h +1 -2
- data/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc +1 -2
- data/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/priority/priority.cc +8 -6
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.cc +23 -0
- data/src/core/ext/filters/client_channel/lb_policy/ring_hash/ring_hash.h +27 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/cds.cc +289 -170
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_args.h +5 -0
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_impl.cc +8 -25
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_manager.cc +1 -1
- data/src/core/ext/filters/client_channel/lb_policy/xds/xds_cluster_resolver.cc +232 -110
- data/src/core/ext/filters/client_channel/local_subchannel_pool.cc +27 -67
- data/src/core/ext/filters/client_channel/local_subchannel_pool.h +10 -9
- data/src/core/ext/filters/client_channel/resolver.cc +5 -5
- data/src/core/ext/filters/client_channel/resolver.h +1 -12
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc +36 -45
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +2 -2
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc +3 -1
- data/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +34 -50
- data/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc +16 -14
- data/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc +18 -15
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +377 -0
- data/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc +4 -4
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +307 -155
- data/src/core/ext/filters/client_channel/server_address.cc +9 -0
- data/src/core/ext/filters/client_channel/server_address.h +31 -0
- data/src/core/ext/filters/client_channel/subchannel.cc +69 -146
- data/src/core/ext/filters/client_channel/subchannel.h +63 -95
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.cc +16 -2
- data/src/core/ext/filters/client_channel/subchannel_pool_interface.h +10 -8
- data/src/core/ext/filters/client_idle/client_idle_filter.cc +1 -1
- data/src/core/ext/filters/fault_injection/fault_injection_filter.cc +500 -0
- data/src/core/ext/filters/fault_injection/fault_injection_filter.h +39 -0
- data/src/core/ext/filters/fault_injection/service_config_parser.cc +189 -0
- data/src/core/ext/filters/fault_injection/service_config_parser.h +85 -0
- data/src/core/ext/filters/max_age/max_age_filter.cc +35 -32
- data/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +2 -2
- data/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +3 -2
- data/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +3 -2
- data/src/core/ext/transport/chttp2/server/chttp2_server.cc +490 -178
- data/src/core/ext/transport/chttp2/server/chttp2_server.h +11 -2
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2.cc +11 -1
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +1 -1
- data/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc +62 -18
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +39 -7
- data/src/core/ext/transport/chttp2/transport/chttp2_transport.h +12 -1
- data/src/core/ext/transport/chttp2/transport/frame_data.cc +5 -1
- data/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +1 -1
- data/src/core/ext/transport/chttp2/transport/internal.h +1 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.c +406 -0
- data/src/core/ext/upb-generated/envoy/admin/v3/config_dump.upb.h +1459 -0
- data/src/core/ext/upb-generated/envoy/config/accesslog/v3/accesslog.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.c +350 -0
- data/src/core/ext/upb-generated/envoy/config/bootstrap/v3/bootstrap.upb.h +1348 -0
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.c +11 -16
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/cluster.upb.h +42 -59
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.c +3 -2
- data/src/core/ext/upb-generated/envoy/config/cluster/v3/outlier_detection.upb.h +15 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.c +25 -1
- data/src/core/ext/upb-generated/envoy/config/core/v3/base.upb.h +75 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.c +2 -2
- data/src/core/ext/upb-generated/envoy/config/core/v3/config_source.upb.h +9 -9
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.c +7 -7
- data/src/core/ext/upb-generated/envoy/config/core/v3/health_check.upb.h +28 -13
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.c +6 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/protocol.upb.h +25 -0
- data/src/core/ext/upb-generated/envoy/config/core/v3/proxy_protocol.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.c +11 -5
- data/src/core/ext/upb-generated/envoy/config/core/v3/substitution_format_string.upb.h +41 -7
- data/src/core/ext/upb-generated/envoy/config/endpoint/v3/endpoint.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.c +23 -21
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener.upb.h +122 -77
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.c +13 -9
- data/src/core/ext/upb-generated/envoy/config/listener/v3/listener_components.upb.h +37 -5
- data/src/core/ext/upb-generated/envoy/config/listener/v3/udp_listener_config.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.c +144 -0
- data/src/core/ext/upb-generated/envoy/config/metrics/v3/stats.upb.h +488 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.c +141 -0
- data/src/core/ext/upb-generated/envoy/config/overload/v3/overload.upb.h +452 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.c +11 -9
- data/src/core/ext/upb-generated/envoy/config/route/v3/route.upb.h +44 -27
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.c +57 -16
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +150 -0
- data/src/core/ext/upb-generated/envoy/config/trace/v3/http_tracer.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.c +29 -0
- data/src/core/ext/upb-generated/envoy/extensions/clusters/aggregate/v3/cluster.upb.h +67 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.c +79 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/common/fault/v3/fault.upb.h +268 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.c +78 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/fault/v3/fault.upb.h +281 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.c +41 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/http/router/v3/router.upb.h +113 -0
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.c +19 -21
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +64 -51
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/cert.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.c +16 -13
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/common.upb.h +50 -18
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.c +4 -7
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/secret.upb.h +0 -17
- data/src/core/ext/upb-generated/envoy/extensions/transport_sockets/tls/v3/tls.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.c +30 -23
- data/src/core/ext/upb-generated/envoy/service/discovery/v3/discovery.upb.h +85 -73
- data/src/core/ext/upb-generated/envoy/service/endpoint/v3/eds.upb.c +0 -3
- data/src/core/ext/upb-generated/envoy/service/listener/v3/lds.upb.c +0 -3
- data/src/core/ext/upb-generated/envoy/service/load_stats/v3/lrs.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/service/route/v3/rds.upb.c +0 -2
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.c +93 -0
- data/src/core/ext/upb-generated/envoy/service/status/v3/csds.upb.h +323 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.c +36 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/node.upb.h +90 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/string.upb.c +0 -1
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.c +46 -0
- data/src/core/ext/upb-generated/envoy/type/matcher/v3/struct.upb.h +124 -0
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.c +21 -4
- data/src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h +29 -0
- data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.c +33 -0
- data/src/core/ext/upb-generated/udpa/type/v1/typed_struct.upb.h +77 -0
- data/src/core/ext/upb-generated/{udpa/core/v1 → xds/core/v3}/authority.upb.c +5 -5
- data/src/core/ext/upb-generated/xds/core/v3/authority.upb.h +60 -0
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.c +52 -0
- data/src/core/ext/upb-generated/xds/core/v3/collection_entry.upb.h +143 -0
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.c +42 -0
- data/src/core/ext/upb-generated/xds/core/v3/context_params.upb.h +84 -0
- data/src/core/ext/upb-generated/{udpa/core/v1 → xds/core/v3}/resource.upb.c +9 -9
- data/src/core/ext/upb-generated/xds/core/v3/resource.upb.h +94 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.c +54 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_locator.upb.h +166 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.c +36 -0
- data/src/core/ext/upb-generated/xds/core/v3/resource_name.upb.h +85 -0
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.c +354 -0
- data/src/core/ext/upbdefs-generated/envoy/admin/v3/config_dump.upbdefs.h +140 -0
- data/src/core/ext/upbdefs-generated/envoy/config/accesslog/v3/accesslog.upbdefs.c +168 -171
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.c +383 -0
- data/src/core/ext/upbdefs-generated/envoy/config/bootstrap/v3/bootstrap.upbdefs.h +115 -0
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.c +405 -420
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/cluster.upbdefs.h +2 -2
- data/src/core/ext/upbdefs-generated/envoy/config/cluster/v3/outlier_detection.upbdefs.c +12 -9
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.c +177 -171
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/base.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/config_source.upbdefs.c +88 -88
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/health_check.upbdefs.c +153 -153
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.c +10 -7
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/protocol.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/proxy_protocol.upbdefs.c +4 -7
- data/src/core/ext/upbdefs-generated/envoy/config/core/v3/substitution_format_string.upbdefs.c +33 -20
- data/src/core/ext/upbdefs-generated/envoy/config/endpoint/v3/endpoint.upbdefs.c +56 -59
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener.upbdefs.c +116 -111
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/listener_components.upbdefs.c +129 -121
- data/src/core/ext/upbdefs-generated/envoy/config/listener/v3/udp_listener_config.upbdefs.c +21 -24
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.c +141 -0
- data/src/core/ext/upbdefs-generated/envoy/config/metrics/v3/stats.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.c +141 -0
- data/src/core/ext/upbdefs-generated/envoy/config/overload/v3/overload.upbdefs.h +70 -0
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route.upbdefs.c +17 -13
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.c +753 -724
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +10 -0
- data/src/core/ext/upbdefs-generated/envoy/config/trace/v3/http_tracer.upbdefs.c +22 -25
- data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.c +51 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/clusters/aggregate/v3/cluster.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.c +102 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/common/fault/v3/fault.upbdefs.h +55 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.c +120 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/fault/v3/fault.upbdefs.h +45 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.c +76 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/http/router/v3/router.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upbdefs.c +371 -377
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/cert.upbdefs.c +12 -16
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/common.upbdefs.c +112 -108
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/secret.upbdefs.c +45 -53
- data/src/core/ext/upbdefs-generated/envoy/extensions/transport_sockets/tls/v3/tls.upbdefs.c +177 -180
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.c +92 -102
- data/src/core/ext/upbdefs-generated/envoy/service/discovery/v3/discovery.upbdefs.h +5 -0
- data/src/core/ext/upbdefs-generated/envoy/service/endpoint/v3/eds.upbdefs.c +32 -42
- data/src/core/ext/upbdefs-generated/envoy/service/listener/v3/lds.upbdefs.c +30 -40
- data/src/core/ext/upbdefs-generated/envoy/service/load_stats/v3/lrs.upbdefs.c +4 -7
- data/src/core/ext/upbdefs-generated/envoy/service/route/v3/rds.upbdefs.c +38 -44
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.c +130 -0
- data/src/core/ext/upbdefs-generated/envoy/service/status/v3/csds.upbdefs.h +50 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.c +56 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/node.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/string.upbdefs.c +30 -33
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.c +63 -0
- data/src/core/ext/upbdefs-generated/envoy/type/matcher/v3/struct.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/google/protobuf/any.upbdefs.c +8 -7
- data/src/core/ext/upbdefs-generated/google/protobuf/descriptor.upbdefs.c +9 -9
- data/src/core/ext/upbdefs-generated/google/protobuf/duration.upbdefs.c +9 -8
- data/src/core/ext/upbdefs-generated/google/protobuf/empty.upbdefs.c +8 -8
- data/src/core/ext/upbdefs-generated/google/protobuf/struct.upbdefs.c +8 -8
- data/src/core/ext/upbdefs-generated/google/protobuf/timestamp.upbdefs.c +9 -8
- data/src/core/ext/upbdefs-generated/google/protobuf/wrappers.upbdefs.c +8 -8
- data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.c +44 -0
- data/src/core/ext/upbdefs-generated/udpa/type/v1/typed_struct.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/validate/validate.upbdefs.c +14 -11
- data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.c +42 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/authority.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.c +62 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/collection_entry.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.c +45 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/context_params.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.c +49 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource.upbdefs.h +35 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.c +67 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_locator.upbdefs.h +40 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.c +50 -0
- data/src/core/ext/upbdefs-generated/xds/core/v3/resource_name.upbdefs.h +35 -0
- data/src/core/ext/xds/xds_api.cc +2149 -666
- data/src/core/ext/xds/xds_api.h +321 -119
- data/src/core/ext/xds/xds_bootstrap.cc +80 -45
- data/src/core/ext/xds/xds_bootstrap.h +17 -5
- data/src/core/ext/xds/xds_certificate_provider.cc +180 -74
- data/src/core/ext/xds/xds_certificate_provider.h +83 -44
- data/src/core/ext/xds/xds_client.cc +181 -34
- data/src/core/ext/xds/xds_client.h +29 -0
- data/src/core/ext/xds/xds_client_stats.cc +2 -1
- data/src/core/ext/xds/xds_client_stats.h +2 -2
- data/src/core/ext/xds/xds_http_fault_filter.cc +226 -0
- data/src/core/ext/xds/xds_http_fault_filter.h +63 -0
- data/src/core/ext/xds/xds_http_filters.cc +114 -0
- data/src/core/ext/xds/xds_http_filters.h +130 -0
- data/src/core/ext/xds/xds_server_config_fetcher.cc +425 -24
- data/src/core/lib/channel/channel_stack.cc +12 -0
- data/src/core/lib/channel/channel_stack.h +7 -0
- data/src/core/lib/channel/channelz.cc +92 -4
- data/src/core/lib/channel/channelz.h +30 -1
- data/src/core/lib/channel/channelz_registry.cc +14 -0
- data/src/core/lib/channel/handshaker.cc +2 -44
- data/src/core/lib/channel/handshaker.h +1 -18
- data/src/core/lib/channel/status_util.cc +12 -2
- data/src/core/lib/channel/status_util.h +5 -0
- data/src/core/lib/gpr/log.cc +6 -1
- data/src/core/lib/gpr/sync_abseil.cc +3 -6
- data/src/core/lib/gpr/sync_windows.cc +2 -2
- data/src/core/lib/gprpp/atomic.h +3 -3
- data/src/core/lib/gprpp/dual_ref_counted.h +3 -3
- data/src/core/lib/gprpp/mpscq.cc +2 -2
- data/src/core/lib/gprpp/ref_counted.h +1 -1
- data/src/core/lib/gprpp/ref_counted_ptr.h +2 -0
- data/src/core/lib/gprpp/sync.h +129 -40
- data/src/core/lib/gprpp/thd.h +1 -1
- data/src/core/lib/gprpp/time_util.cc +77 -0
- data/src/core/lib/gprpp/time_util.h +42 -0
- data/src/core/lib/http/httpcli_security_connector.cc +2 -2
- data/src/core/lib/iomgr/buffer_list.h +1 -1
- data/src/core/lib/iomgr/cfstream_handle.cc +2 -2
- data/src/core/lib/iomgr/error.h +1 -1
- data/src/core/lib/iomgr/ev_apple.cc +11 -8
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -3
- data/src/core/lib/iomgr/ev_epollex_linux.cc +4 -4
- data/src/core/lib/iomgr/ev_posix.cc +3 -3
- data/src/core/lib/iomgr/exec_ctx.cc +6 -2
- data/src/core/lib/iomgr/iomgr_posix.cc +0 -1
- data/src/core/lib/iomgr/iomgr_posix_cfstream.cc +0 -1
- data/src/core/lib/iomgr/resource_quota.cc +1 -1
- data/src/core/lib/iomgr/sockaddr_utils.cc +121 -1
- data/src/core/lib/iomgr/sockaddr_utils.h +25 -0
- data/src/core/lib/iomgr/socket_utils_common_posix.cc +1 -0
- data/src/core/lib/iomgr/tcp_client_posix.cc +1 -1
- data/src/core/lib/iomgr/tcp_posix.cc +5 -8
- data/src/core/lib/iomgr/tcp_uv.cc +2 -2
- data/src/core/lib/iomgr/timer_generic.cc +2 -2
- data/src/core/lib/iomgr/timer_manager.cc +1 -1
- data/src/core/lib/iomgr/wakeup_fd_nospecial.cc +1 -1
- data/src/core/lib/matchers/matchers.cc +339 -0
- data/src/core/lib/matchers/matchers.h +160 -0
- data/src/core/lib/security/credentials/alts/alts_credentials.cc +2 -1
- data/src/core/lib/security/credentials/alts/alts_credentials.h +1 -1
- data/src/core/lib/security/credentials/credentials.h +2 -1
- data/src/core/lib/security/credentials/external/aws_external_account_credentials.cc +1 -1
- data/src/core/lib/security/credentials/external/external_account_credentials.cc +2 -2
- data/src/core/lib/security/credentials/external/file_external_account_credentials.cc +1 -1
- data/src/core/lib/security/credentials/external/url_external_account_credentials.cc +1 -1
- data/src/core/lib/security/credentials/fake/fake_credentials.cc +1 -1
- data/src/core/lib/security/credentials/google_default/google_default_credentials.cc +7 -6
- data/src/core/lib/security/credentials/insecure/insecure_credentials.cc +2 -2
- data/src/core/lib/security/credentials/jwt/json_token.cc +0 -3
- data/src/core/lib/security/credentials/jwt/jwt_verifier.cc +0 -3
- data/src/core/lib/security/credentials/local/local_credentials.cc +2 -1
- data/src/core/lib/security/credentials/local/local_credentials.h +1 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.cc +2 -1
- data/src/core/lib/security/credentials/ssl/ssl_credentials.h +1 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.cc +2 -1
- data/src/core/lib/security/credentials/tls/tls_credentials.h +1 -1
- data/src/core/lib/security/credentials/xds/xds_credentials.cc +128 -59
- data/src/core/lib/security/credentials/xds/xds_credentials.h +3 -3
- data/src/core/lib/security/security_connector/insecure/insecure_security_connector.cc +5 -5
- data/src/core/lib/security/security_connector/ssl_utils.cc +9 -4
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +32 -14
- data/src/core/lib/security/transport/security_handshaker.cc +33 -5
- data/src/core/lib/security/transport/server_auth_filter.cc +7 -0
- data/src/core/lib/slice/slice_intern.cc +5 -6
- data/src/core/lib/surface/channel.h +3 -3
- data/src/core/lib/surface/completion_queue.cc +1 -1
- data/src/core/lib/surface/init.cc +13 -15
- data/src/core/lib/surface/lame_client.cc +38 -19
- data/src/core/lib/surface/lame_client.h +4 -3
- data/src/core/lib/surface/server.cc +43 -36
- data/src/core/lib/surface/server.h +76 -14
- data/src/core/lib/surface/version.cc +2 -2
- data/src/core/lib/transport/metadata.cc +6 -2
- data/src/core/lib/transport/metadata_batch.cc +27 -0
- data/src/core/lib/transport/metadata_batch.h +14 -0
- data/src/core/plugin_registry/grpc_plugin_registry.cc +12 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +18 -24
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc +16 -21
- data/src/core/tsi/alts/handshaker/alts_tsi_handshaker.h +1 -1
- data/src/core/tsi/alts/handshaker/transport_security_common_api.cc +1 -3
- data/src/core/tsi/fake_transport_security.cc +11 -2
- data/src/core/tsi/ssl/session_cache/ssl_session.h +0 -3
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.cc +0 -2
- data/src/core/tsi/ssl/session_cache/ssl_session_cache.h +2 -4
- data/src/core/tsi/ssl_transport_security.cc +0 -3
- data/src/core/tsi/ssl_transport_security.h +0 -3
- data/src/ruby/ext/grpc/extconf.rb +9 -1
- data/src/ruby/ext/grpc/rb_channel.c +10 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.c +11 -1
- data/src/ruby/ext/grpc/rb_channel_credentials.h +4 -0
- data/src/ruby/ext/grpc/rb_compression_options.c +1 -1
- data/src/ruby/ext/grpc/rb_enable_cpp.cc +1 -1
- data/src/ruby/ext/grpc/rb_grpc.c +4 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.c +2 -0
- data/src/ruby/ext/grpc/rb_grpc_imports.generated.h +4 -1
- data/src/ruby/ext/grpc/rb_server.c +13 -1
- data/src/ruby/ext/grpc/rb_server_credentials.c +19 -3
- data/src/ruby/ext/grpc/rb_server_credentials.h +4 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.c +215 -0
- data/src/ruby/ext/grpc/rb_xds_channel_credentials.h +35 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.c +169 -0
- data/src/ruby/ext/grpc/rb_xds_server_credentials.h +35 -0
- data/src/ruby/lib/grpc/generic/client_stub.rb +4 -2
- data/src/ruby/lib/grpc/version.rb +1 -1
- data/src/ruby/pb/src/proto/grpc/testing/messages_pb.rb +7 -0
- data/src/ruby/spec/call_spec.rb +1 -1
- data/src/ruby/spec/channel_credentials_spec.rb +32 -0
- data/src/ruby/spec/channel_spec.rb +17 -6
- data/src/ruby/spec/client_auth_spec.rb +27 -1
- data/src/ruby/spec/errors_spec.rb +1 -1
- data/src/ruby/spec/generic/active_call_spec.rb +2 -2
- data/src/ruby/spec/generic/client_stub_spec.rb +4 -4
- data/src/ruby/spec/generic/rpc_server_spec.rb +1 -1
- data/src/ruby/spec/server_credentials_spec.rb +25 -0
- data/src/ruby/spec/server_spec.rb +22 -0
- data/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc +1 -0
- data/third_party/boringssl-with-bazel/err_data.c +715 -713
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_bitstr.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_enum.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_int.c +5 -5
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_object.c +3 -10
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_octet.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_type.c +4 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/a_utctm.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_lib.c +15 -14
- data/third_party/boringssl-with-bazel/src/crypto/asn1/asn1_locl.h +30 -0
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_dec.c +28 -79
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_enc.c +39 -85
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_fre.c +5 -16
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_new.c +10 -61
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_typ.c +0 -2
- data/third_party/boringssl-with-bazel/src/crypto/asn1/tasn_utl.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/bio/socket_helper.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/blake2/blake2.c +158 -0
- data/third_party/boringssl-with-bazel/src/crypto/bn_extra/bn_asn1.c +3 -10
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/ber.c +8 -9
- data/third_party/boringssl-with-bazel/src/crypto/bytestring/cbs.c +60 -45
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/e_chacha20poly1305.c +6 -81
- data/third_party/boringssl-with-bazel/src/crypto/cipher_extra/internal.h +87 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu-aarch64-win.c +41 -0
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm-linux.c +11 -2
- data/third_party/boringssl-with-bazel/src/crypto/cpu-arm.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/dh_asn1.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/{dh → dh_extra}/params.c +179 -0
- data/third_party/boringssl-with-bazel/src/crypto/digest_extra/digest_extra.c +25 -0
- data/third_party/boringssl-with-bazel/src/crypto/ec_extra/ec_asn1.c +2 -17
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bcm.c +3 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/bn.c +13 -20
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/div.c +2 -3
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/bn/internal.h +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/cipher/cipher.c +21 -13
- data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/check.c +0 -0
- data/third_party/boringssl-with-bazel/src/crypto/{dh → fipsmodule/dh}/dh.c +136 -213
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec.c +12 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/ec/ec_key.c +9 -1
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/internal.h +28 -0
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +135 -43
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/urandom.c +0 -7
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rsa/rsa_impl.c +51 -32
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/self_check/self_check.c +147 -0
- data/third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c +18 -29
- data/third_party/boringssl-with-bazel/src/crypto/hpke/internal.h +13 -4
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305.c +10 -7
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_arm.c +13 -11
- data/third_party/boringssl-with-bazel/src/crypto/poly1305/poly1305_vec.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/passive.c +34 -0
- data/third_party/boringssl-with-bazel/src/crypto/rand_extra/rand_extra.c +4 -0
- data/third_party/boringssl-with-bazel/src/crypto/stack/stack.c +7 -13
- data/third_party/boringssl-with-bazel/src/crypto/x509/rsa_pss.c +5 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +1 -29
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_ext.c +10 -7
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_r2x.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_set.c +8 -8
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_v3.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509cset.c +29 -23
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.c +22 -17
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_crl.c +1 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_pkey.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +39 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509a.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_akey.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_alt.c +11 -10
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_bitst.c +3 -3
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_conf.c +25 -25
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_cpols.c +2 -2
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_enum.c +2 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_genn.c +40 -20
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_ia5.c +3 -4
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_lib.c +25 -36
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_prn.c +1 -1
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_skey.c +6 -6
- data/third_party/boringssl-with-bazel/src/crypto/x509v3/v3_utl.c +6 -6
- data/third_party/boringssl-with-bazel/src/include/openssl/arm_arch.h +3 -3
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1.h +652 -545
- data/third_party/boringssl-with-bazel/src/include/openssl/asn1t.h +0 -167
- data/third_party/boringssl-with-bazel/src/include/openssl/base.h +10 -5
- data/third_party/boringssl-with-bazel/src/include/openssl/blake2.h +62 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/bytestring.h +22 -7
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +19 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +22 -32
- data/third_party/boringssl-with-bazel/src/include/openssl/dh.h +56 -26
- data/third_party/boringssl-with-bazel/src/include/openssl/digest.h +1 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/ec.h +15 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/evp.h +12 -2
- data/third_party/boringssl-with-bazel/src/include/openssl/rand.h +3 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/span.h +2 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +67 -33
- data/third_party/boringssl-with-bazel/src/include/openssl/tls1.h +27 -8
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +287 -99
- data/third_party/boringssl-with-bazel/src/include/openssl/x509v3.h +139 -36
- data/third_party/boringssl-with-bazel/src/ssl/handshake.cc +4 -3
- data/third_party/boringssl-with-bazel/src/ssl/handshake_client.cc +11 -20
- data/third_party/boringssl-with-bazel/src/ssl/handshake_server.cc +10 -5
- data/third_party/boringssl-with-bazel/src/ssl/internal.h +37 -16
- data/third_party/boringssl-with-bazel/src/ssl/s3_lib.cc +0 -1
- data/third_party/boringssl-with-bazel/src/ssl/ssl_asn1.cc +7 -8
- data/third_party/boringssl-with-bazel/src/ssl/ssl_lib.cc +20 -14
- data/third_party/boringssl-with-bazel/src/ssl/ssl_session.cc +7 -8
- data/third_party/boringssl-with-bazel/src/ssl/ssl_transcript.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/t1_enc.cc +5 -7
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +362 -50
- data/third_party/boringssl-with-bazel/src/ssl/tls13_client.cc +2 -2
- data/third_party/boringssl-with-bazel/src/ssl/tls13_enc.cc +48 -15
- data/third_party/boringssl-with-bazel/src/ssl/tls13_server.cc +66 -24
- data/third_party/xxhash/xxhash.h +5443 -0
- metadata +140 -84
- data/src/core/ext/upb-generated/udpa/core/v1/authority.upb.h +0 -60
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.c +0 -52
- data/src/core/ext/upb-generated/udpa/core/v1/collection_entry.upb.h +0 -143
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.c +0 -42
- data/src/core/ext/upb-generated/udpa/core/v1/context_params.upb.h +0 -84
- data/src/core/ext/upb-generated/udpa/core/v1/resource.upb.h +0 -94
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.c +0 -54
- data/src/core/ext/upb-generated/udpa/core/v1/resource_locator.upb.h +0 -173
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.c +0 -36
- data/src/core/ext/upb-generated/udpa/core/v1/resource_name.upb.h +0 -92
- data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.c +0 -42
- data/src/core/ext/upbdefs-generated/udpa/core/v1/authority.upbdefs.h +0 -35
- data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.c +0 -62
- data/src/core/ext/upbdefs-generated/udpa/core/v1/collection_entry.upbdefs.h +0 -40
- data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.c +0 -45
- data/src/core/ext/upbdefs-generated/udpa/core/v1/context_params.upbdefs.h +0 -40
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.c +0 -49
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource.upbdefs.h +0 -35
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.c +0 -68
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_locator.upbdefs.h +0 -40
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.c +0 -51
- data/src/core/ext/upbdefs-generated/udpa/core/v1/resource_name.upbdefs.h +0 -35
- data/src/core/lib/iomgr/iomgr_posix.h +0 -26
- data/src/core/lib/security/authorization/authorization_engine.cc +0 -177
- data/src/core/lib/security/authorization/authorization_engine.h +0 -84
- data/src/core/lib/security/authorization/evaluate_args.cc +0 -148
- data/src/core/lib/security/authorization/evaluate_args.h +0 -59
- data/src/core/lib/security/authorization/mock_cel/activation.h +0 -57
- data/src/core/lib/security/authorization/mock_cel/cel_expr_builder_factory.h +0 -44
- data/src/core/lib/security/authorization/mock_cel/cel_expression.h +0 -69
- data/src/core/lib/security/authorization/mock_cel/cel_value.h +0 -97
- data/src/core/lib/security/authorization/mock_cel/evaluator_core.h +0 -67
- data/src/core/lib/security/authorization/mock_cel/flat_expr_builder.h +0 -57
- data/third_party/abseil-cpp/absl/container/flat_hash_set.h +0 -504
- data/third_party/upb/upb/json_decode.c +0 -1443
- data/third_party/upb/upb/json_decode.h +0 -23
- data/third_party/upb/upb/json_encode.c +0 -713
- data/third_party/upb/upb/json_encode.h +0 -36
@@ -0,0 +1,23 @@
|
|
1
|
+
//
|
2
|
+
// Copyright 2018 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 <grpc/support/port_platform.h>
|
18
|
+
|
19
|
+
namespace grpc_core {
|
20
|
+
|
21
|
+
const char* kRequestRingHashAttribute = "request_ring_hash";
|
22
|
+
|
23
|
+
} // namespace grpc_core
|
@@ -0,0 +1,27 @@
|
|
1
|
+
//
|
2
|
+
// Copyright 2018 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_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_RING_HASH_RING_HASH_H
|
18
|
+
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_RING_HASH_RING_HASH_H
|
19
|
+
|
20
|
+
#include <grpc/support/port_platform.h>
|
21
|
+
|
22
|
+
namespace grpc_core {
|
23
|
+
extern const char* kRequestRingHashAttribute;
|
24
|
+
|
25
|
+
} // namespace grpc_core
|
26
|
+
|
27
|
+
#endif // GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_RING_HASH_RING_HASH_H
|
@@ -63,26 +63,31 @@ class CdsLb : public LoadBalancingPolicy {
|
|
63
63
|
|
64
64
|
void UpdateLocked(UpdateArgs args) override;
|
65
65
|
void ResetBackoffLocked() override;
|
66
|
+
void ExitIdleLocked() override;
|
66
67
|
|
67
68
|
private:
|
68
69
|
// Watcher for getting cluster data from XdsClient.
|
69
70
|
class ClusterWatcher : public XdsClient::ClusterWatcherInterface {
|
70
71
|
public:
|
71
|
-
|
72
|
-
: parent_(std::move(parent)) {}
|
72
|
+
ClusterWatcher(RefCountedPtr<CdsLb> parent, std::string name)
|
73
|
+
: parent_(std::move(parent)), name_(std::move(name)) {}
|
73
74
|
|
74
75
|
void OnClusterChanged(XdsApi::CdsUpdate cluster_data) override {
|
75
|
-
new Notifier(parent_, std::move(cluster_data));
|
76
|
+
new Notifier(parent_, name_, std::move(cluster_data));
|
76
77
|
}
|
77
|
-
void OnError(grpc_error* error) override {
|
78
|
-
|
78
|
+
void OnError(grpc_error* error) override {
|
79
|
+
new Notifier(parent_, name_, error);
|
80
|
+
}
|
81
|
+
void OnResourceDoesNotExist() override { new Notifier(parent_, name_); }
|
79
82
|
|
80
83
|
private:
|
81
84
|
class Notifier {
|
82
85
|
public:
|
83
|
-
Notifier(RefCountedPtr<CdsLb> parent,
|
84
|
-
|
85
|
-
|
86
|
+
Notifier(RefCountedPtr<CdsLb> parent, std::string name,
|
87
|
+
XdsApi::CdsUpdate update);
|
88
|
+
Notifier(RefCountedPtr<CdsLb> parent, std::string name,
|
89
|
+
grpc_error* error);
|
90
|
+
explicit Notifier(RefCountedPtr<CdsLb> parent, std::string name);
|
86
91
|
|
87
92
|
private:
|
88
93
|
enum Type { kUpdate, kError, kDoesNotExist };
|
@@ -91,12 +96,22 @@ class CdsLb : public LoadBalancingPolicy {
|
|
91
96
|
void RunInWorkSerializer(grpc_error* error);
|
92
97
|
|
93
98
|
RefCountedPtr<CdsLb> parent_;
|
99
|
+
std::string name_;
|
94
100
|
grpc_closure closure_;
|
95
101
|
XdsApi::CdsUpdate update_;
|
96
102
|
Type type_;
|
97
103
|
};
|
98
104
|
|
99
105
|
RefCountedPtr<CdsLb> parent_;
|
106
|
+
std::string name_;
|
107
|
+
};
|
108
|
+
|
109
|
+
struct WatcherState {
|
110
|
+
// Pointer to watcher, to be used when cancelling.
|
111
|
+
// Not owned, so do not dereference.
|
112
|
+
ClusterWatcher* watcher = nullptr;
|
113
|
+
// Most recent update obtained from this watcher.
|
114
|
+
absl::optional<XdsApi::CdsUpdate> update;
|
100
115
|
};
|
101
116
|
|
102
117
|
// Delegating helper to be passed to child policy.
|
@@ -119,12 +134,20 @@ class CdsLb : public LoadBalancingPolicy {
|
|
119
134
|
|
120
135
|
void ShutdownLocked() override;
|
121
136
|
|
122
|
-
|
123
|
-
|
124
|
-
|
137
|
+
bool GenerateDiscoveryMechanismForCluster(
|
138
|
+
const std::string& name, Json::Array* discovery_mechanisms,
|
139
|
+
std::set<std::string>* clusters_needed);
|
140
|
+
void OnClusterChanged(const std::string& name,
|
141
|
+
XdsApi::CdsUpdate cluster_data);
|
142
|
+
void OnError(const std::string& name, grpc_error* error);
|
143
|
+
void OnResourceDoesNotExist(const std::string& name);
|
125
144
|
|
126
145
|
grpc_error* UpdateXdsCertificateProvider(
|
127
|
-
const XdsApi::CdsUpdate& cluster_data);
|
146
|
+
const std::string& cluster_name, const XdsApi::CdsUpdate& cluster_data);
|
147
|
+
|
148
|
+
void CancelClusterDataWatch(absl::string_view cluster_name,
|
149
|
+
XdsClient::ClusterWatcherInterface* watcher,
|
150
|
+
bool delay_unsubscription = false);
|
128
151
|
|
129
152
|
void MaybeDestroyChildPolicyLocked();
|
130
153
|
|
@@ -135,9 +158,10 @@ class CdsLb : public LoadBalancingPolicy {
|
|
135
158
|
|
136
159
|
// The xds client.
|
137
160
|
RefCountedPtr<XdsClient> xds_client_;
|
138
|
-
|
139
|
-
//
|
140
|
-
|
161
|
+
|
162
|
+
// Maps from cluster name to the state for that cluster.
|
163
|
+
// The root of the tree is config_->cluster().
|
164
|
+
std::map<std::string, WatcherState> watchers_;
|
141
165
|
|
142
166
|
RefCountedPtr<grpc_tls_certificate_provider> root_certificate_provider_;
|
143
167
|
RefCountedPtr<grpc_tls_certificate_provider> identity_certificate_provider_;
|
@@ -155,21 +179,26 @@ class CdsLb : public LoadBalancingPolicy {
|
|
155
179
|
//
|
156
180
|
|
157
181
|
CdsLb::ClusterWatcher::Notifier::Notifier(RefCountedPtr<CdsLb> parent,
|
182
|
+
std::string name,
|
158
183
|
XdsApi::CdsUpdate update)
|
159
|
-
: parent_(std::move(parent)),
|
184
|
+
: parent_(std::move(parent)),
|
185
|
+
name_(std::move(name)),
|
186
|
+
update_(std::move(update)),
|
187
|
+
type_(kUpdate) {
|
160
188
|
GRPC_CLOSURE_INIT(&closure_, &RunInExecCtx, this, nullptr);
|
161
189
|
ExecCtx::Run(DEBUG_LOCATION, &closure_, GRPC_ERROR_NONE);
|
162
190
|
}
|
163
191
|
|
164
192
|
CdsLb::ClusterWatcher::Notifier::Notifier(RefCountedPtr<CdsLb> parent,
|
165
|
-
grpc_error* error)
|
166
|
-
: parent_(std::move(parent)), type_(kError) {
|
193
|
+
std::string name, grpc_error* error)
|
194
|
+
: parent_(std::move(parent)), name_(std::move(name)), type_(kError) {
|
167
195
|
GRPC_CLOSURE_INIT(&closure_, &RunInExecCtx, this, nullptr);
|
168
196
|
ExecCtx::Run(DEBUG_LOCATION, &closure_, error);
|
169
197
|
}
|
170
198
|
|
171
|
-
CdsLb::ClusterWatcher::Notifier::Notifier(RefCountedPtr<CdsLb> parent
|
172
|
-
|
199
|
+
CdsLb::ClusterWatcher::Notifier::Notifier(RefCountedPtr<CdsLb> parent,
|
200
|
+
std::string name)
|
201
|
+
: parent_(std::move(parent)), name_(std::move(name)), type_(kDoesNotExist) {
|
173
202
|
GRPC_CLOSURE_INIT(&closure_, &RunInExecCtx, this, nullptr);
|
174
203
|
ExecCtx::Run(DEBUG_LOCATION, &closure_, GRPC_ERROR_NONE);
|
175
204
|
}
|
@@ -185,13 +214,13 @@ void CdsLb::ClusterWatcher::Notifier::RunInExecCtx(void* arg,
|
|
185
214
|
void CdsLb::ClusterWatcher::Notifier::RunInWorkSerializer(grpc_error* error) {
|
186
215
|
switch (type_) {
|
187
216
|
case kUpdate:
|
188
|
-
parent_->OnClusterChanged(std::move(update_));
|
217
|
+
parent_->OnClusterChanged(name_, std::move(update_));
|
189
218
|
break;
|
190
219
|
case kError:
|
191
|
-
parent_->OnError(error);
|
220
|
+
parent_->OnError(name_, error);
|
192
221
|
break;
|
193
222
|
case kDoesNotExist:
|
194
|
-
parent_->OnResourceDoesNotExist();
|
223
|
+
parent_->OnResourceDoesNotExist(name_);
|
195
224
|
break;
|
196
225
|
};
|
197
226
|
delete this;
|
@@ -261,13 +290,15 @@ void CdsLb::ShutdownLocked() {
|
|
261
290
|
shutting_down_ = true;
|
262
291
|
MaybeDestroyChildPolicyLocked();
|
263
292
|
if (xds_client_ != nullptr) {
|
264
|
-
|
293
|
+
for (auto& watcher : watchers_) {
|
265
294
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
|
266
295
|
gpr_log(GPR_INFO, "[cdslb %p] cancelling watch for cluster %s", this,
|
267
|
-
|
296
|
+
watcher.first.c_str());
|
268
297
|
}
|
269
|
-
|
298
|
+
CancelClusterDataWatch(watcher.first, watcher.second.watcher,
|
299
|
+
/*delay_unsubscription=*/false);
|
270
300
|
}
|
301
|
+
watchers_.clear();
|
271
302
|
xds_client_.reset(DEBUG_LOCATION, "CdsLb");
|
272
303
|
}
|
273
304
|
grpc_channel_args_destroy(args_);
|
@@ -286,6 +317,10 @@ void CdsLb::ResetBackoffLocked() {
|
|
286
317
|
if (child_policy_ != nullptr) child_policy_->ResetBackoffLocked();
|
287
318
|
}
|
288
319
|
|
320
|
+
void CdsLb::ExitIdleLocked() {
|
321
|
+
if (child_policy_ != nullptr) child_policy_->ExitIdleLocked();
|
322
|
+
}
|
323
|
+
|
289
324
|
void CdsLb::UpdateLocked(UpdateArgs args) {
|
290
325
|
// Update config.
|
291
326
|
auto old_config = std::move(config_);
|
@@ -301,119 +336,214 @@ void CdsLb::UpdateLocked(UpdateArgs args) {
|
|
301
336
|
// If cluster name changed, cancel watcher and restart.
|
302
337
|
if (old_config == nullptr || old_config->cluster() != config_->cluster()) {
|
303
338
|
if (old_config != nullptr) {
|
304
|
-
|
305
|
-
|
306
|
-
|
339
|
+
for (auto& watcher : watchers_) {
|
340
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
|
341
|
+
gpr_log(GPR_INFO, "[cdslb %p] cancelling watch for cluster %s", this,
|
342
|
+
watcher.first.c_str());
|
343
|
+
}
|
344
|
+
CancelClusterDataWatch(watcher.first, watcher.second.watcher,
|
345
|
+
/*delay_unsubscription=*/true);
|
307
346
|
}
|
308
|
-
|
309
|
-
cluster_watcher_,
|
310
|
-
/*delay_unsubscription=*/true);
|
347
|
+
watchers_.clear();
|
311
348
|
}
|
312
|
-
|
313
|
-
|
314
|
-
config_->cluster().c_str());
|
315
|
-
}
|
316
|
-
auto watcher = absl::make_unique<ClusterWatcher>(Ref());
|
317
|
-
cluster_watcher_ = watcher.get();
|
349
|
+
auto watcher = absl::make_unique<ClusterWatcher>(Ref(), config_->cluster());
|
350
|
+
watchers_[config_->cluster()].watcher = watcher.get();
|
318
351
|
xds_client_->WatchClusterData(config_->cluster(), std::move(watcher));
|
319
352
|
}
|
320
353
|
}
|
321
354
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
355
|
+
// This method will attempt to generate one or multiple entries of discovery
|
356
|
+
// mechanism recursively:
|
357
|
+
// For cluster types EDS or LOGICAL_DNS, one discovery mechanism entry may be
|
358
|
+
// generated cluster name, type and other data from the CdsUpdate inserted into
|
359
|
+
// the entry and the entry appended to the array of entries.
|
360
|
+
// Note, discovery mechanism entry can be generated if an CdsUpdate is
|
361
|
+
// available; otherwise, just return false. For cluster type AGGREGATE,
|
362
|
+
// recursively call the method for each child cluster.
|
363
|
+
bool CdsLb::GenerateDiscoveryMechanismForCluster(
|
364
|
+
const std::string& name, Json::Array* discovery_mechanisms,
|
365
|
+
std::set<std::string>* clusters_needed) {
|
366
|
+
clusters_needed->insert(name);
|
367
|
+
auto& state = watchers_[name];
|
368
|
+
// Create a new watcher if needed.
|
369
|
+
if (state.watcher == nullptr) {
|
370
|
+
auto watcher = absl::make_unique<ClusterWatcher>(Ref(), name);
|
371
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
|
372
|
+
gpr_log(GPR_INFO, "[cdslb %p] starting watch for cluster %s", this,
|
373
|
+
name.c_str());
|
374
|
+
}
|
375
|
+
state.watcher = watcher.get();
|
376
|
+
xds_client_->WatchClusterData(name, std::move(watcher));
|
377
|
+
return false;
|
326
378
|
}
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
379
|
+
// Don't have the update we need yet.
|
380
|
+
if (!state.update.has_value()) return false;
|
381
|
+
// For AGGREGATE clusters, recursively expand to child clusters.
|
382
|
+
if (state.update->cluster_type == XdsApi::CdsUpdate::ClusterType::AGGREGATE) {
|
383
|
+
bool missing_cluster = false;
|
384
|
+
for (const std::string& child_name :
|
385
|
+
state.update->prioritized_cluster_names) {
|
386
|
+
if (!GenerateDiscoveryMechanismForCluster(
|
387
|
+
child_name, discovery_mechanisms, clusters_needed)) {
|
388
|
+
missing_cluster = true;
|
389
|
+
}
|
390
|
+
}
|
391
|
+
return !missing_cluster;
|
392
|
+
}
|
393
|
+
std::string type;
|
394
|
+
switch (state.update->cluster_type) {
|
395
|
+
case XdsApi::CdsUpdate::ClusterType::EDS:
|
396
|
+
type = "EDS";
|
397
|
+
break;
|
398
|
+
case XdsApi::CdsUpdate::ClusterType::LOGICAL_DNS:
|
399
|
+
type = "LOGICAL_DNS";
|
400
|
+
break;
|
401
|
+
default:
|
402
|
+
GPR_ASSERT(0);
|
403
|
+
break;
|
331
404
|
}
|
332
|
-
|
333
|
-
|
334
|
-
{"
|
335
|
-
{"
|
336
|
-
{"type", "EDS"},
|
405
|
+
Json::Object mechanism = {
|
406
|
+
{"clusterName", name},
|
407
|
+
{"max_concurrent_requests", state.update->max_concurrent_requests},
|
408
|
+
{"type", std::move(type)},
|
337
409
|
};
|
338
|
-
if (!
|
339
|
-
|
410
|
+
if (!state.update->eds_service_name.empty()) {
|
411
|
+
mechanism["edsServiceName"] = state.update->eds_service_name;
|
340
412
|
}
|
341
|
-
if (
|
342
|
-
|
343
|
-
|
413
|
+
if (state.update->lrs_load_reporting_server_name.has_value()) {
|
414
|
+
mechanism["lrsLoadReportingServerName"] =
|
415
|
+
state.update->lrs_load_reporting_server_name.value();
|
344
416
|
}
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
Json::Array{
|
352
|
-
Json::Object{
|
353
|
-
{"weighted_target_experimental",
|
354
|
-
Json::Object{
|
355
|
-
{"targets", Json::Object()},
|
356
|
-
}},
|
357
|
-
},
|
358
|
-
}},
|
359
|
-
{"endpointPickingPolicy",
|
360
|
-
Json::Array{
|
361
|
-
Json::Object{
|
362
|
-
{"round_robin", Json::Object()},
|
363
|
-
},
|
364
|
-
}},
|
365
|
-
};
|
366
|
-
Json json = Json::Array{
|
367
|
-
Json::Object{
|
368
|
-
{"xds_cluster_resolver_experimental", std::move(child_config)},
|
369
|
-
},
|
370
|
-
};
|
417
|
+
discovery_mechanisms->emplace_back(std::move(mechanism));
|
418
|
+
return true;
|
419
|
+
}
|
420
|
+
|
421
|
+
void CdsLb::OnClusterChanged(const std::string& name,
|
422
|
+
XdsApi::CdsUpdate cluster_data) {
|
371
423
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
|
372
|
-
|
373
|
-
|
374
|
-
|
424
|
+
gpr_log(
|
425
|
+
GPR_INFO,
|
426
|
+
"[cdslb %p] received CDS update for cluster %s from xds client %p: %s",
|
427
|
+
this, name.c_str(), xds_client_.get(), cluster_data.ToString().c_str());
|
375
428
|
}
|
376
|
-
|
377
|
-
|
429
|
+
// Store the update in the map if we are still interested in watching this
|
430
|
+
// cluster (i.e., it is not cancelled already).
|
431
|
+
// If we've already deleted this entry, then this is an update notification
|
432
|
+
// that was scheduled before the deletion, so we can just ignore it.
|
433
|
+
auto it = watchers_.find(name);
|
434
|
+
if (it == watchers_.end()) return;
|
435
|
+
it->second.update = cluster_data;
|
436
|
+
// Take care of integration with new certificate code.
|
437
|
+
grpc_error* error = GRPC_ERROR_NONE;
|
438
|
+
error = UpdateXdsCertificateProvider(name, it->second.update.value());
|
378
439
|
if (error != GRPC_ERROR_NONE) {
|
379
|
-
OnError(error);
|
380
|
-
return;
|
440
|
+
return OnError(name, error);
|
381
441
|
}
|
382
|
-
//
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
442
|
+
// Scan the map starting from the root cluster to generate the list of
|
443
|
+
// discovery mechanisms. If we don't have some of the data we need (i.e., we
|
444
|
+
// just started up and not all watchers have returned data yet), then don't
|
445
|
+
// update the child policy at all.
|
446
|
+
Json::Array discovery_mechanisms;
|
447
|
+
std::set<std::string> clusters_needed;
|
448
|
+
if (GenerateDiscoveryMechanismForCluster(
|
449
|
+
config_->cluster(), &discovery_mechanisms, &clusters_needed)) {
|
450
|
+
// Construct config for child policy.
|
451
|
+
Json::Object xds_lb_policy;
|
452
|
+
if (cluster_data.lb_policy == "RING_HASH") {
|
453
|
+
std::string hash_function;
|
454
|
+
switch (cluster_data.hash_function) {
|
455
|
+
case XdsApi::CdsUpdate::HashFunction::XX_HASH:
|
456
|
+
hash_function = "XX_HASH";
|
457
|
+
break;
|
458
|
+
case XdsApi::CdsUpdate::HashFunction::MURMUR_HASH_2:
|
459
|
+
hash_function = "MURMUR_HASH_2";
|
460
|
+
break;
|
461
|
+
default:
|
462
|
+
GPR_ASSERT(0);
|
463
|
+
break;
|
464
|
+
}
|
465
|
+
xds_lb_policy["RING_HASH"] = Json::Object{
|
466
|
+
{"min_ring_size", cluster_data.min_ring_size},
|
467
|
+
{"max_ring_size", cluster_data.max_ring_size},
|
468
|
+
{"hash_function", hash_function},
|
469
|
+
};
|
470
|
+
} else {
|
471
|
+
xds_lb_policy["ROUND_ROBIN"] = Json::Object();
|
394
472
|
}
|
395
|
-
|
396
|
-
|
473
|
+
Json::Object child_config = {
|
474
|
+
{"xdsLbPolicy",
|
475
|
+
Json::Array{
|
476
|
+
xds_lb_policy,
|
477
|
+
}},
|
478
|
+
{"discoveryMechanisms", std::move(discovery_mechanisms)},
|
479
|
+
};
|
480
|
+
Json json = Json::Array{
|
481
|
+
Json::Object{
|
482
|
+
{"xds_cluster_resolver_experimental", std::move(child_config)},
|
483
|
+
},
|
484
|
+
};
|
397
485
|
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
|
398
|
-
|
399
|
-
|
486
|
+
std::string json_str = json.Dump(/*indent=*/1);
|
487
|
+
gpr_log(GPR_INFO, "[cdslb %p] generated config for child policy: %s",
|
488
|
+
this, json_str.c_str());
|
400
489
|
}
|
490
|
+
RefCountedPtr<LoadBalancingPolicy::Config> config =
|
491
|
+
LoadBalancingPolicyRegistry::ParseLoadBalancingConfig(json, &error);
|
492
|
+
if (error != GRPC_ERROR_NONE) {
|
493
|
+
OnError(name, error);
|
494
|
+
return;
|
495
|
+
}
|
496
|
+
// Create child policy if not already present.
|
497
|
+
if (child_policy_ == nullptr) {
|
498
|
+
LoadBalancingPolicy::Args args;
|
499
|
+
args.work_serializer = work_serializer();
|
500
|
+
args.args = args_;
|
501
|
+
args.channel_control_helper = absl::make_unique<Helper>(Ref());
|
502
|
+
child_policy_ = LoadBalancingPolicyRegistry::CreateLoadBalancingPolicy(
|
503
|
+
config->name(), std::move(args));
|
504
|
+
if (child_policy_ == nullptr) {
|
505
|
+
OnError(name, GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
506
|
+
"failed to create child policy"));
|
507
|
+
return;
|
508
|
+
}
|
509
|
+
grpc_pollset_set_add_pollset_set(child_policy_->interested_parties(),
|
510
|
+
interested_parties());
|
511
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
|
512
|
+
gpr_log(GPR_INFO, "[cdslb %p] created child policy %s (%p)", this,
|
513
|
+
config->name(), child_policy_.get());
|
514
|
+
}
|
515
|
+
}
|
516
|
+
// Update child policy.
|
517
|
+
UpdateArgs args;
|
518
|
+
args.config = std::move(config);
|
519
|
+
if (xds_certificate_provider_ != nullptr) {
|
520
|
+
grpc_arg arg_to_add = xds_certificate_provider_->MakeChannelArg();
|
521
|
+
args.args = grpc_channel_args_copy_and_add(args_, &arg_to_add, 1);
|
522
|
+
} else {
|
523
|
+
args.args = grpc_channel_args_copy(args_);
|
524
|
+
}
|
525
|
+
child_policy_->UpdateLocked(std::move(args));
|
401
526
|
}
|
402
|
-
//
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
527
|
+
// Remove entries in watchers_ for any clusters not in clusters_needed
|
528
|
+
for (auto it = watchers_.begin(); it != watchers_.end();) {
|
529
|
+
const std::string& cluster_name = it->first;
|
530
|
+
if (clusters_needed.find(cluster_name) != clusters_needed.end()) {
|
531
|
+
++it;
|
532
|
+
continue;
|
533
|
+
}
|
534
|
+
if (GRPC_TRACE_FLAG_ENABLED(grpc_cds_lb_trace)) {
|
535
|
+
gpr_log(GPR_INFO, "[cdslb %p] cancelling watch for cluster %s", this,
|
536
|
+
cluster_name.c_str());
|
537
|
+
}
|
538
|
+
CancelClusterDataWatch(cluster_name, it->second.watcher,
|
539
|
+
/*delay_unsubscription=*/false);
|
540
|
+
it = watchers_.erase(it);
|
410
541
|
}
|
411
|
-
child_policy_->UpdateLocked(std::move(args));
|
412
542
|
}
|
413
543
|
|
414
|
-
void CdsLb::OnError(grpc_error* error) {
|
544
|
+
void CdsLb::OnError(const std::string& name, grpc_error* error) {
|
415
545
|
gpr_log(GPR_ERROR, "[cdslb %p] xds error obtaining data for cluster %s: %s",
|
416
|
-
this,
|
546
|
+
this, name.c_str(), grpc_error_string(error));
|
417
547
|
// Go into TRANSIENT_FAILURE if we have not yet created the child
|
418
548
|
// policy (i.e., we have not yet received data from xds). Otherwise,
|
419
549
|
// we keep running with the data we had previously.
|
@@ -426,11 +556,11 @@ void CdsLb::OnError(grpc_error* error) {
|
|
426
556
|
}
|
427
557
|
}
|
428
558
|
|
429
|
-
void CdsLb::OnResourceDoesNotExist() {
|
559
|
+
void CdsLb::OnResourceDoesNotExist(const std::string& name) {
|
430
560
|
gpr_log(GPR_ERROR,
|
431
561
|
"[cdslb %p] CDS resource for %s does not exist -- reporting "
|
432
562
|
"TRANSIENT_FAILURE",
|
433
|
-
this,
|
563
|
+
this, name.c_str());
|
434
564
|
grpc_error* error =
|
435
565
|
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(
|
436
566
|
absl::StrCat("CDS resource \"", config_->cluster(),
|
@@ -444,7 +574,7 @@ void CdsLb::OnResourceDoesNotExist() {
|
|
444
574
|
}
|
445
575
|
|
446
576
|
grpc_error* CdsLb::UpdateXdsCertificateProvider(
|
447
|
-
const XdsApi::CdsUpdate& cluster_data) {
|
577
|
+
const std::string& cluster_name, const XdsApi::CdsUpdate& cluster_data) {
|
448
578
|
// Early out if channel is not configured to use xds security.
|
449
579
|
grpc_channel_credentials* channel_credentials =
|
450
580
|
grpc_channel_credentials_find_in_args(args_);
|
@@ -453,18 +583,16 @@ grpc_error* CdsLb::UpdateXdsCertificateProvider(
|
|
453
583
|
xds_certificate_provider_ = nullptr;
|
454
584
|
return GRPC_ERROR_NONE;
|
455
585
|
}
|
586
|
+
if (xds_certificate_provider_ == nullptr) {
|
587
|
+
xds_certificate_provider_ = MakeRefCounted<XdsCertificateProvider>();
|
588
|
+
}
|
589
|
+
// Configure root cert.
|
456
590
|
absl::string_view root_provider_instance_name =
|
457
591
|
cluster_data.common_tls_context.combined_validation_context
|
458
592
|
.validation_context_certificate_provider_instance.instance_name;
|
459
593
|
absl::string_view root_provider_cert_name =
|
460
594
|
cluster_data.common_tls_context.combined_validation_context
|
461
595
|
.validation_context_certificate_provider_instance.certificate_name;
|
462
|
-
absl::string_view identity_provider_instance_name =
|
463
|
-
cluster_data.common_tls_context
|
464
|
-
.tls_certificate_certificate_provider_instance.instance_name;
|
465
|
-
absl::string_view identity_provider_cert_name =
|
466
|
-
cluster_data.common_tls_context
|
467
|
-
.tls_certificate_certificate_provider_instance.certificate_name;
|
468
596
|
RefCountedPtr<XdsCertificateProvider> new_root_provider;
|
469
597
|
if (!root_provider_instance_name.empty()) {
|
470
598
|
new_root_provider =
|
@@ -491,6 +619,18 @@ grpc_error* CdsLb::UpdateXdsCertificateProvider(
|
|
491
619
|
}
|
492
620
|
root_certificate_provider_ = std::move(new_root_provider);
|
493
621
|
}
|
622
|
+
xds_certificate_provider_->UpdateRootCertNameAndDistributor(
|
623
|
+
cluster_name, root_provider_cert_name,
|
624
|
+
root_certificate_provider_ == nullptr
|
625
|
+
? nullptr
|
626
|
+
: root_certificate_provider_->distributor());
|
627
|
+
// Configure identity cert.
|
628
|
+
absl::string_view identity_provider_instance_name =
|
629
|
+
cluster_data.common_tls_context
|
630
|
+
.tls_certificate_certificate_provider_instance.instance_name;
|
631
|
+
absl::string_view identity_provider_cert_name =
|
632
|
+
cluster_data.common_tls_context
|
633
|
+
.tls_certificate_certificate_provider_instance.certificate_name;
|
494
634
|
RefCountedPtr<XdsCertificateProvider> new_identity_provider;
|
495
635
|
if (!identity_provider_instance_name.empty()) {
|
496
636
|
new_identity_provider =
|
@@ -517,56 +657,34 @@ grpc_error* CdsLb::UpdateXdsCertificateProvider(
|
|
517
657
|
}
|
518
658
|
identity_certificate_provider_ = std::move(new_identity_provider);
|
519
659
|
}
|
520
|
-
|
660
|
+
xds_certificate_provider_->UpdateIdentityCertNameAndDistributor(
|
661
|
+
cluster_name, identity_provider_cert_name,
|
662
|
+
identity_certificate_provider_ == nullptr
|
663
|
+
? nullptr
|
664
|
+
: identity_certificate_provider_->distributor());
|
665
|
+
// Configure SAN matchers.
|
666
|
+
const std::vector<StringMatcher>& match_subject_alt_names =
|
521
667
|
cluster_data.common_tls_context.combined_validation_context
|
522
668
|
.default_validation_context.match_subject_alt_names;
|
523
|
-
|
524
|
-
|
525
|
-
// Using mTLS configuration
|
526
|
-
if (xds_certificate_provider_ != nullptr &&
|
527
|
-
xds_certificate_provider_->ProvidesRootCerts() &&
|
528
|
-
xds_certificate_provider_->ProvidesIdentityCerts()) {
|
529
|
-
xds_certificate_provider_->UpdateRootCertNameAndDistributor(
|
530
|
-
root_provider_cert_name, root_certificate_provider_->distributor());
|
531
|
-
xds_certificate_provider_->UpdateIdentityCertNameAndDistributor(
|
532
|
-
identity_provider_cert_name,
|
533
|
-
identity_certificate_provider_->distributor());
|
534
|
-
xds_certificate_provider_->UpdateSubjectAlternativeNameMatchers(
|
535
|
-
match_subject_alt_names);
|
536
|
-
} else {
|
537
|
-
// Existing xDS certificate provider does not have mTLS configuration.
|
538
|
-
// Create new certificate provider so that new subchannel connectors are
|
539
|
-
// created.
|
540
|
-
xds_certificate_provider_ = MakeRefCounted<XdsCertificateProvider>(
|
541
|
-
root_provider_cert_name, root_certificate_provider_->distributor(),
|
542
|
-
identity_provider_cert_name,
|
543
|
-
identity_certificate_provider_->distributor(),
|
544
|
-
match_subject_alt_names);
|
545
|
-
}
|
546
|
-
} else if (!root_provider_instance_name.empty()) {
|
547
|
-
// Using TLS configuration
|
548
|
-
if (xds_certificate_provider_ != nullptr &&
|
549
|
-
xds_certificate_provider_->ProvidesRootCerts() &&
|
550
|
-
!xds_certificate_provider_->ProvidesIdentityCerts()) {
|
551
|
-
xds_certificate_provider_->UpdateRootCertNameAndDistributor(
|
552
|
-
root_provider_cert_name, root_certificate_provider_->distributor());
|
553
|
-
xds_certificate_provider_->UpdateSubjectAlternativeNameMatchers(
|
554
|
-
match_subject_alt_names);
|
555
|
-
} else {
|
556
|
-
// Existing xDS certificate provider does not have TLS configuration.
|
557
|
-
// Create new certificate provider so that new subchannel connectors are
|
558
|
-
// created.
|
559
|
-
xds_certificate_provider_ = MakeRefCounted<XdsCertificateProvider>(
|
560
|
-
root_provider_cert_name, root_certificate_provider_->distributor(),
|
561
|
-
"", nullptr, match_subject_alt_names);
|
562
|
-
}
|
563
|
-
} else {
|
564
|
-
// No configuration provided.
|
565
|
-
xds_certificate_provider_ = nullptr;
|
566
|
-
}
|
669
|
+
xds_certificate_provider_->UpdateSubjectAlternativeNameMatchers(
|
670
|
+
cluster_name, match_subject_alt_names);
|
567
671
|
return GRPC_ERROR_NONE;
|
568
672
|
}
|
569
673
|
|
674
|
+
void CdsLb::CancelClusterDataWatch(absl::string_view cluster_name,
|
675
|
+
XdsClient::ClusterWatcherInterface* watcher,
|
676
|
+
bool delay_unsubscription) {
|
677
|
+
if (xds_certificate_provider_ != nullptr) {
|
678
|
+
std::string name(cluster_name);
|
679
|
+
xds_certificate_provider_->UpdateRootCertNameAndDistributor(name, "",
|
680
|
+
nullptr);
|
681
|
+
xds_certificate_provider_->UpdateIdentityCertNameAndDistributor(name, "",
|
682
|
+
nullptr);
|
683
|
+
xds_certificate_provider_->UpdateSubjectAlternativeNameMatchers(name, {});
|
684
|
+
}
|
685
|
+
xds_client_->CancelClusterDataWatch(cluster_name, watcher,
|
686
|
+
delay_unsubscription);
|
687
|
+
}
|
570
688
|
//
|
571
689
|
// factory
|
572
690
|
//
|
@@ -601,6 +719,7 @@ class CdsLbFactory : public LoadBalancingPolicyFactory {
|
|
601
719
|
return nullptr;
|
602
720
|
}
|
603
721
|
std::vector<grpc_error*> error_list;
|
722
|
+
// cluster name.
|
604
723
|
std::string cluster;
|
605
724
|
auto it = json.object_value().find("cluster");
|
606
725
|
if (it == json.object_value().end()) {
|