grpc 1.36.0 → 1.37.0.pre1
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 +65 -37
- data/include/grpc/grpc.h +15 -1
- data/include/grpc/impl/codegen/port_platform.h +2 -0
- data/src/core/ext/filters/client_channel/client_channel.cc +327 -305
- data/src/core/ext/filters/client_channel/client_channel_factory.h +2 -1
- data/src/core/ext/filters/client_channel/config_selector.h +8 -0
- 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/lb_policy.cc +3 -0
- 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/xds_cluster_impl.cc +7 -22
- 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 +2 -2
- 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 +3 -0
- 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 +5 -9
- data/src/core/ext/filters/client_channel/resolver/google_c2p/google_c2p_resolver.cc +18 -3
- data/src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc +295 -91
- data/src/core/ext/filters/client_channel/server_address.cc +3 -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 +495 -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/workarounds/workaround_cronet_compression_filter.cc +1 -1
- data/src/core/ext/transport/chttp2/client/chttp2_connector.cc +1 -1
- 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 +457 -170
- data/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc +1 -1
- 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/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/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/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_components.upb.c +15 -0
- data/src/core/ext/upb-generated/envoy/config/route/v3/route_components.upb.h +44 -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 +6 -5
- data/src/core/ext/upb-generated/envoy/extensions/filters/network/http_connection_manager/v3/http_connection_manager.upb.h +13 -9
- 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/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/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/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/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/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/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_components.upbdefs.c +13 -7
- data/src/core/ext/upbdefs-generated/envoy/config/route/v3/route_components.upbdefs.h +5 -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 +21 -20
- 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/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/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/xds/xds_api.cc +1591 -279
- data/src/core/ext/xds/xds_api.h +279 -39
- data/src/core/ext/xds/xds_bootstrap.cc +21 -5
- data/src/core/ext/xds/xds_bootstrap.h +5 -1
- data/src/core/ext/xds/xds_client.cc +168 -23
- data/src/core/ext/xds/xds_client.h +26 -0
- 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 +391 -126
- 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 +0 -39
- data/src/core/lib/channel/handshaker.h +0 -17
- 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/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/ref_counted_ptr.h +2 -0
- data/src/core/lib/gprpp/thd.h +1 -1
- 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 +1 -1
- data/src/core/lib/iomgr/ev_epoll1_linux.cc +3 -3
- 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/resource_quota.cc +1 -1
- data/src/core/lib/iomgr/sockaddr_utils.cc +120 -0
- data/src/core/lib/iomgr/sockaddr_utils.h +25 -0
- data/src/core/lib/iomgr/tcp_posix.cc +1 -4
- 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/{security/authorization → matchers}/matchers.cc +8 -8
- data/src/core/lib/{security/authorization → matchers}/matchers.h +14 -12
- data/src/core/lib/security/security_connector/ssl_utils.cc +6 -4
- data/src/core/lib/security/security_connector/tls/tls_security_connector.cc +6 -0
- data/src/core/lib/security/transport/security_handshaker.cc +32 -2
- data/src/core/lib/slice/slice_intern.cc +6 -7
- data/src/core/lib/surface/channel.h +3 -3
- data/src/core/lib/surface/completion_queue.cc +1 -1
- 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 +40 -33
- data/src/core/lib/surface/server.h +74 -15
- data/src/core/lib/surface/version.cc +1 -1
- 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 +6 -0
- data/src/core/tsi/alts/handshaker/alts_handshaker_client.cc +1 -4
- 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 +10 -1
- 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/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/boringssl-with-bazel/err_data.c +255 -255
- 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/fipsmodule/cipher/cipher.c +21 -13
- data/third_party/boringssl-with-bazel/src/crypto/fipsmodule/rand/rand.c +7 -5
- data/third_party/boringssl-with-bazel/src/crypto/x509/x509_cmp.c +0 -28
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_attrib.c +22 -17
- data/third_party/boringssl-with-bazel/src/crypto/x509/x_x509.c +3 -1
- data/third_party/boringssl-with-bazel/src/include/openssl/cipher.h +4 -0
- data/third_party/boringssl-with-bazel/src/include/openssl/cpu.h +22 -32
- data/third_party/boringssl-with-bazel/src/include/openssl/ssl.h +25 -9
- data/third_party/boringssl-with-bazel/src/include/openssl/x509.h +0 -1
- data/third_party/boringssl-with-bazel/src/ssl/t1_lib.cc +33 -19
- data/third_party/xxhash/xxhash.h +5443 -0
- metadata +93 -49
- 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 -99
- 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
data/src/core/ext/xds/xds_api.h
CHANGED
@@ -33,10 +33,12 @@
|
|
33
33
|
|
34
34
|
#include <grpc/slice_buffer.h>
|
35
35
|
|
36
|
+
#include "envoy/admin/v3/config_dump.upb.h"
|
36
37
|
#include "src/core/ext/filters/client_channel/server_address.h"
|
37
38
|
#include "src/core/ext/xds/xds_bootstrap.h"
|
38
39
|
#include "src/core/ext/xds/xds_client_stats.h"
|
39
|
-
#include "src/core/
|
40
|
+
#include "src/core/ext/xds/xds_http_filters.h"
|
41
|
+
#include "src/core/lib/matchers/matchers.h"
|
40
42
|
|
41
43
|
namespace grpc_core {
|
42
44
|
|
@@ -58,13 +60,16 @@ class XdsApi {
|
|
58
60
|
int64_t seconds = 0;
|
59
61
|
int32_t nanos = 0;
|
60
62
|
bool operator==(const Duration& other) const {
|
61
|
-
return
|
63
|
+
return seconds == other.seconds && nanos == other.nanos;
|
62
64
|
}
|
63
65
|
std::string ToString() const {
|
64
66
|
return absl::StrFormat("Duration seconds: %ld, nanos %d", seconds, nanos);
|
65
67
|
}
|
66
68
|
};
|
67
69
|
|
70
|
+
using TypedPerFilterConfig =
|
71
|
+
std::map<std::string, XdsHttpFilterImpl::FilterConfig>;
|
72
|
+
|
68
73
|
// TODO(donnadionne): When we can use absl::variant<>, consider using that
|
69
74
|
// for: PathMatcher, HeaderMatcher, cluster_name and weighted_clusters
|
70
75
|
struct Route {
|
@@ -75,14 +80,38 @@ class XdsApi {
|
|
75
80
|
absl::optional<uint32_t> fraction_per_million;
|
76
81
|
|
77
82
|
bool operator==(const Matchers& other) const {
|
78
|
-
return
|
79
|
-
|
80
|
-
|
83
|
+
return path_matcher == other.path_matcher &&
|
84
|
+
header_matchers == other.header_matchers &&
|
85
|
+
fraction_per_million == other.fraction_per_million;
|
81
86
|
}
|
82
87
|
std::string ToString() const;
|
83
88
|
};
|
84
89
|
|
90
|
+
struct HashPolicy {
|
91
|
+
enum Type { HEADER, CHANNEL_ID };
|
92
|
+
Type type;
|
93
|
+
bool terminal = false;
|
94
|
+
// Fields used for type HEADER.
|
95
|
+
std::string header_name;
|
96
|
+
std::unique_ptr<RE2> regex = nullptr;
|
97
|
+
std::string regex_substitution;
|
98
|
+
|
99
|
+
HashPolicy() {}
|
100
|
+
|
101
|
+
// Copyable.
|
102
|
+
HashPolicy(const HashPolicy& other);
|
103
|
+
HashPolicy& operator=(const HashPolicy& other);
|
104
|
+
|
105
|
+
// Moveable.
|
106
|
+
HashPolicy(HashPolicy&& other) noexcept;
|
107
|
+
HashPolicy& operator=(HashPolicy&& other) noexcept;
|
108
|
+
|
109
|
+
bool operator==(const HashPolicy& other) const;
|
110
|
+
std::string ToString() const;
|
111
|
+
};
|
112
|
+
|
85
113
|
Matchers matchers;
|
114
|
+
std::vector<HashPolicy> hash_policies;
|
86
115
|
|
87
116
|
// Action for this route.
|
88
117
|
// TODO(roth): When we can use absl::variant<>, consider using that
|
@@ -91,8 +120,11 @@ class XdsApi {
|
|
91
120
|
struct ClusterWeight {
|
92
121
|
std::string name;
|
93
122
|
uint32_t weight;
|
123
|
+
TypedPerFilterConfig typed_per_filter_config;
|
124
|
+
|
94
125
|
bool operator==(const ClusterWeight& other) const {
|
95
|
-
return
|
126
|
+
return name == other.name && weight == other.weight &&
|
127
|
+
typed_per_filter_config == other.typed_per_filter_config;
|
96
128
|
}
|
97
129
|
std::string ToString() const;
|
98
130
|
};
|
@@ -103,11 +135,13 @@ class XdsApi {
|
|
103
135
|
// not set.
|
104
136
|
absl::optional<Duration> max_stream_duration;
|
105
137
|
|
138
|
+
TypedPerFilterConfig typed_per_filter_config;
|
139
|
+
|
106
140
|
bool operator==(const Route& other) const {
|
107
|
-
return
|
108
|
-
|
109
|
-
|
110
|
-
|
141
|
+
return matchers == other.matchers && cluster_name == other.cluster_name &&
|
142
|
+
weighted_clusters == other.weighted_clusters &&
|
143
|
+
max_stream_duration == other.max_stream_duration &&
|
144
|
+
typed_per_filter_config == other.typed_per_filter_config;
|
111
145
|
}
|
112
146
|
std::string ToString() const;
|
113
147
|
};
|
@@ -116,9 +150,11 @@ class XdsApi {
|
|
116
150
|
struct VirtualHost {
|
117
151
|
std::vector<std::string> domains;
|
118
152
|
std::vector<Route> routes;
|
153
|
+
TypedPerFilterConfig typed_per_filter_config;
|
119
154
|
|
120
155
|
bool operator==(const VirtualHost& other) const {
|
121
|
-
return domains == other.domains && routes == other.routes
|
156
|
+
return domains == other.domains && routes == other.routes &&
|
157
|
+
typed_per_filter_config == other.typed_per_filter_config;
|
122
158
|
}
|
123
159
|
};
|
124
160
|
|
@@ -204,29 +240,157 @@ class XdsApi {
|
|
204
240
|
kTcpListener = 0,
|
205
241
|
kHttpApiListener,
|
206
242
|
} type;
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
243
|
+
|
244
|
+
struct HttpConnectionManager {
|
245
|
+
// The name to use in the RDS request.
|
246
|
+
std::string route_config_name;
|
247
|
+
// Storing the Http Connection Manager Common Http Protocol Option
|
248
|
+
// max_stream_duration
|
249
|
+
Duration http_max_stream_duration;
|
250
|
+
// The RouteConfiguration to use for this listener.
|
251
|
+
// Present only if it is inlined in the LDS response.
|
252
|
+
absl::optional<RdsUpdate> rds_update;
|
253
|
+
|
254
|
+
struct HttpFilter {
|
255
|
+
std::string name;
|
256
|
+
XdsHttpFilterImpl::FilterConfig config;
|
257
|
+
|
258
|
+
bool operator==(const HttpFilter& other) const {
|
259
|
+
return name == other.name && config == other.config;
|
260
|
+
}
|
261
|
+
|
262
|
+
std::string ToString() const;
|
263
|
+
};
|
264
|
+
std::vector<HttpFilter> http_filters;
|
265
|
+
|
266
|
+
bool operator==(const HttpConnectionManager& other) const {
|
267
|
+
return route_config_name == other.route_config_name &&
|
268
|
+
http_max_stream_duration == other.http_max_stream_duration &&
|
269
|
+
rds_update == other.rds_update &&
|
270
|
+
http_filters == other.http_filters;
|
271
|
+
}
|
272
|
+
|
273
|
+
std::string ToString() const;
|
274
|
+
};
|
275
|
+
|
276
|
+
// Populated for type=kHttpApiListener.
|
277
|
+
HttpConnectionManager http_connection_manager;
|
278
|
+
|
279
|
+
// Populated for type=kTcpListener.
|
280
|
+
// host:port listening_address set when type is kTcpListener
|
281
|
+
std::string address;
|
282
|
+
|
283
|
+
struct FilterChainData {
|
284
|
+
DownstreamTlsContext downstream_tls_context;
|
285
|
+
// This is in principle the filter list.
|
286
|
+
// We currently require exactly one filter, which is the HCM.
|
287
|
+
HttpConnectionManager http_connection_manager;
|
288
|
+
|
289
|
+
bool operator==(const FilterChainData& other) const {
|
290
|
+
return downstream_tls_context == other.downstream_tls_context &&
|
291
|
+
http_connection_manager == other.http_connection_manager;
|
292
|
+
}
|
293
|
+
|
294
|
+
std::string ToString() const;
|
295
|
+
} filter_chain_data;
|
296
|
+
|
297
|
+
// A multi-level map used to determine which filter chain to use for a given
|
298
|
+
// incoming connection. Determining the right filter chain for a given
|
299
|
+
// connection checks the following properties, in order:
|
300
|
+
// - destination port (never matched, so not present in map)
|
301
|
+
// - destination IP address
|
302
|
+
// - server name (never matched, so not present in map)
|
303
|
+
// - transport protocol (allows only "raw_buffer" or unset, prefers the
|
304
|
+
// former, so only one of those two types is present in map)
|
305
|
+
// - application protocol (never matched, so not present in map)
|
306
|
+
// - connection source type (any, local or external)
|
307
|
+
// - source IP address
|
308
|
+
// - source port
|
309
|
+
// https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/listener/v3/listener_components.proto#config-listener-v3-filterchainmatch
|
310
|
+
// for more details
|
311
|
+
struct FilterChainMap {
|
312
|
+
struct FilterChainDataSharedPtr {
|
313
|
+
std::shared_ptr<FilterChainData> data;
|
314
|
+
bool operator==(const FilterChainDataSharedPtr& other) const {
|
315
|
+
return *data == *other.data;
|
316
|
+
}
|
317
|
+
};
|
318
|
+
struct CidrRange {
|
319
|
+
grpc_resolved_address address;
|
320
|
+
uint32_t prefix_len;
|
321
|
+
|
322
|
+
bool operator==(const CidrRange& other) const {
|
323
|
+
return memcmp(&address, &other.address, sizeof(address)) == 0 &&
|
324
|
+
prefix_len == other.prefix_len;
|
325
|
+
}
|
326
|
+
|
327
|
+
std::string ToString() const;
|
328
|
+
};
|
329
|
+
using SourcePortsMap = std::map<uint16_t, FilterChainDataSharedPtr>;
|
330
|
+
struct SourceIp {
|
331
|
+
absl::optional<CidrRange> prefix_range;
|
332
|
+
SourcePortsMap ports_map;
|
333
|
+
|
334
|
+
bool operator==(const SourceIp& other) const {
|
335
|
+
return prefix_range == other.prefix_range &&
|
336
|
+
ports_map == other.ports_map;
|
337
|
+
}
|
338
|
+
};
|
339
|
+
using SourceIpVector = std::vector<SourceIp>;
|
340
|
+
enum class ConnectionSourceType {
|
341
|
+
kAny = 0,
|
342
|
+
kSameIpOrLoopback,
|
343
|
+
kExternal
|
344
|
+
};
|
345
|
+
using ConnectionSourceTypesArray = std::array<SourceIpVector, 3>;
|
346
|
+
struct DestinationIp {
|
347
|
+
absl::optional<CidrRange> prefix_range;
|
348
|
+
// We always fail match on server name, so those filter chains are not
|
349
|
+
// included here.
|
350
|
+
ConnectionSourceTypesArray source_types_array;
|
351
|
+
|
352
|
+
bool operator==(const DestinationIp& other) const {
|
353
|
+
return prefix_range == other.prefix_range &&
|
354
|
+
source_types_array == other.source_types_array;
|
355
|
+
}
|
356
|
+
};
|
357
|
+
// We always fail match on destination ports map
|
358
|
+
using DestinationIpVector = std::vector<DestinationIp>;
|
359
|
+
DestinationIpVector destination_ip_vector;
|
360
|
+
|
361
|
+
bool operator==(const FilterChainMap& other) const {
|
362
|
+
return destination_ip_vector == other.destination_ip_vector;
|
363
|
+
}
|
364
|
+
|
365
|
+
std::string ToString() const;
|
366
|
+
} filter_chain_map;
|
367
|
+
|
368
|
+
absl::optional<FilterChainData> default_filter_chain;
|
216
369
|
|
217
370
|
bool operator==(const LdsUpdate& other) const {
|
218
|
-
return
|
219
|
-
|
220
|
-
|
221
|
-
|
371
|
+
return http_connection_manager == other.http_connection_manager &&
|
372
|
+
address == other.address &&
|
373
|
+
filter_chain_map == other.filter_chain_map &&
|
374
|
+
default_filter_chain == other.default_filter_chain;
|
222
375
|
}
|
223
376
|
|
224
377
|
std::string ToString() const;
|
225
378
|
};
|
226
379
|
|
227
|
-
|
380
|
+
struct LdsResourceData {
|
381
|
+
LdsUpdate resource;
|
382
|
+
std::string serialized_proto;
|
383
|
+
};
|
228
384
|
|
229
|
-
using
|
385
|
+
using LdsUpdateMap = std::map<std::string /*server_name*/, LdsResourceData>;
|
386
|
+
|
387
|
+
struct RdsResourceData {
|
388
|
+
RdsUpdate resource;
|
389
|
+
std::string serialized_proto;
|
390
|
+
};
|
391
|
+
|
392
|
+
using RdsUpdateMap =
|
393
|
+
std::map<std::string /*route_config_name*/, RdsResourceData>;
|
230
394
|
|
231
395
|
struct CdsUpdate {
|
232
396
|
enum ClusterType { EDS, LOGICAL_DNS, AGGREGATE };
|
@@ -269,7 +433,12 @@ class XdsApi {
|
|
269
433
|
std::string ToString() const;
|
270
434
|
};
|
271
435
|
|
272
|
-
|
436
|
+
struct CdsResourceData {
|
437
|
+
CdsUpdate resource;
|
438
|
+
std::string serialized_proto;
|
439
|
+
};
|
440
|
+
|
441
|
+
using CdsUpdateMap = std::map<std::string /*cluster_name*/, CdsResourceData>;
|
273
442
|
|
274
443
|
struct EdsUpdate {
|
275
444
|
struct Priority {
|
@@ -353,7 +522,13 @@ class XdsApi {
|
|
353
522
|
std::string ToString() const;
|
354
523
|
};
|
355
524
|
|
356
|
-
|
525
|
+
struct EdsResourceData {
|
526
|
+
EdsUpdate resource;
|
527
|
+
std::string serialized_proto;
|
528
|
+
};
|
529
|
+
|
530
|
+
using EdsUpdateMap =
|
531
|
+
std::map<std::string /*eds_service_name*/, EdsResourceData>;
|
357
532
|
|
358
533
|
struct ClusterLoadReport {
|
359
534
|
XdsClusterDropStats::Snapshot dropped_requests;
|
@@ -366,18 +541,66 @@ class XdsApi {
|
|
366
541
|
std::pair<std::string /*cluster_name*/, std::string /*eds_service_name*/>,
|
367
542
|
ClusterLoadReport>;
|
368
543
|
|
369
|
-
|
544
|
+
// The metadata of the xDS resource; used by the xDS config dump.
|
545
|
+
struct ResourceMetadata {
|
546
|
+
// Resource status from the view of a xDS client, which tells the
|
547
|
+
// synchronization status between the xDS client and the xDS server.
|
548
|
+
enum ClientResourceStatus {
|
549
|
+
// Client requested this resource but hasn't received any update from
|
550
|
+
// management server. The client will not fail requests, but will queue
|
551
|
+
// them
|
552
|
+
// until update arrives or the client times out waiting for the resource.
|
553
|
+
REQUESTED = 1,
|
554
|
+
// This resource has been requested by the client but has either not been
|
555
|
+
// delivered by the server or was previously delivered by the server and
|
556
|
+
// then subsequently removed from resources provided by the server.
|
557
|
+
DOES_NOT_EXIST,
|
558
|
+
// Client received this resource and replied with ACK.
|
559
|
+
ACKED,
|
560
|
+
// Client received this resource and replied with NACK.
|
561
|
+
NACKED
|
562
|
+
};
|
370
563
|
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
564
|
+
// The client status of this resource.
|
565
|
+
ClientResourceStatus client_status = REQUESTED;
|
566
|
+
// The serialized bytes of the last successfully updated raw xDS resource.
|
567
|
+
std::string serialized_proto;
|
568
|
+
// The timestamp when the resource was last successfully updated.
|
569
|
+
grpc_millis update_time = 0;
|
570
|
+
// The last successfully updated version of the resource.
|
571
|
+
std::string version;
|
572
|
+
// The rejected version string of the last failed update attempt.
|
573
|
+
std::string failed_version;
|
574
|
+
// Details about the last failed update attempt.
|
575
|
+
std::string failed_details;
|
576
|
+
// Timestamp of the last failed update attempt.
|
577
|
+
grpc_millis failed_update_time = 0;
|
578
|
+
};
|
579
|
+
using ResourceMetadataMap =
|
580
|
+
std::map<absl::string_view /*resource_name*/, const ResourceMetadata*>;
|
581
|
+
struct ResourceTypeMetadata {
|
582
|
+
absl::string_view version;
|
583
|
+
ResourceMetadataMap resource_metadata_map;
|
584
|
+
};
|
585
|
+
using ResourceTypeMetadataMap =
|
586
|
+
std::map<absl::string_view /*type_url*/, ResourceTypeMetadata>;
|
587
|
+
static_assert(static_cast<ResourceMetadata::ClientResourceStatus>(
|
588
|
+
envoy_admin_v3_REQUESTED) ==
|
589
|
+
ResourceMetadata::ClientResourceStatus::REQUESTED,
|
590
|
+
"");
|
591
|
+
static_assert(static_cast<ResourceMetadata::ClientResourceStatus>(
|
592
|
+
envoy_admin_v3_DOES_NOT_EXIST) ==
|
593
|
+
ResourceMetadata::ClientResourceStatus::DOES_NOT_EXIST,
|
594
|
+
"");
|
595
|
+
static_assert(static_cast<ResourceMetadata::ClientResourceStatus>(
|
596
|
+
envoy_admin_v3_ACKED) ==
|
597
|
+
ResourceMetadata::ClientResourceStatus::ACKED,
|
598
|
+
"");
|
599
|
+
static_assert(static_cast<ResourceMetadata::ClientResourceStatus>(
|
600
|
+
envoy_admin_v3_NACKED) ==
|
601
|
+
ResourceMetadata::ClientResourceStatus::NACKED,
|
602
|
+
"");
|
379
603
|
|
380
|
-
// Parses an ADS response.
|
381
604
|
// If the response can't be parsed at the top level, the resulting
|
382
605
|
// type_url will be empty.
|
383
606
|
// If there is any other type of validation error, the parse_error
|
@@ -396,8 +619,21 @@ class XdsApi {
|
|
396
619
|
EdsUpdateMap eds_update_map;
|
397
620
|
std::set<std::string> resource_names_failed;
|
398
621
|
};
|
622
|
+
|
623
|
+
XdsApi(XdsClient* client, TraceFlag* tracer, const XdsBootstrap::Node* node);
|
624
|
+
|
625
|
+
// Creates an ADS request.
|
626
|
+
// Takes ownership of \a error.
|
627
|
+
grpc_slice CreateAdsRequest(const XdsBootstrap::XdsServer& server,
|
628
|
+
const std::string& type_url,
|
629
|
+
const std::set<absl::string_view>& resource_names,
|
630
|
+
const std::string& version,
|
631
|
+
const std::string& nonce, grpc_error* error,
|
632
|
+
bool populate_node);
|
633
|
+
|
634
|
+
// Parses an ADS response.
|
399
635
|
AdsParseResult ParseAdsResponse(
|
400
|
-
const grpc_slice& encoded_response,
|
636
|
+
const XdsBootstrap::XdsServer& server, const grpc_slice& encoded_response,
|
401
637
|
const std::set<absl::string_view>& expected_listener_names,
|
402
638
|
const std::set<absl::string_view>& expected_route_configuration_names,
|
403
639
|
const std::set<absl::string_view>& expected_cluster_names,
|
@@ -417,6 +653,10 @@ class XdsApi {
|
|
417
653
|
std::set<std::string>* cluster_names,
|
418
654
|
grpc_millis* load_reporting_interval);
|
419
655
|
|
656
|
+
// Assemble the client config proto message and return the serialized result.
|
657
|
+
std::string AssembleClientConfig(
|
658
|
+
const ResourceTypeMetadataMap& resource_type_metadata_map);
|
659
|
+
|
420
660
|
private:
|
421
661
|
XdsClient* client_;
|
422
662
|
TraceFlag* tracer_;
|
@@ -93,13 +93,14 @@ std::string BootstrapString(const XdsBootstrap& bootstrap) {
|
|
93
93
|
" locality={\n"
|
94
94
|
" region=\"%s\",\n"
|
95
95
|
" zone=\"%s\",\n"
|
96
|
-
"
|
96
|
+
" sub_zone=\"%s\"\n"
|
97
97
|
" },\n"
|
98
98
|
" metadata=%s,\n"
|
99
99
|
"},\n",
|
100
100
|
bootstrap.node()->id, bootstrap.node()->cluster,
|
101
101
|
bootstrap.node()->locality_region, bootstrap.node()->locality_zone,
|
102
|
-
bootstrap.node()->
|
102
|
+
bootstrap.node()->locality_sub_zone,
|
103
|
+
bootstrap.node()->metadata.Dump()));
|
103
104
|
}
|
104
105
|
parts.push_back(absl::StrFormat(
|
105
106
|
"servers=[\n"
|
@@ -118,6 +119,11 @@ std::string BootstrapString(const XdsBootstrap& bootstrap) {
|
|
118
119
|
absl::StrJoin(bootstrap.server().server_features, ", "), "],\n"));
|
119
120
|
}
|
120
121
|
parts.push_back(" }\n],\n");
|
122
|
+
if (!bootstrap.server_listener_resource_name_template().empty()) {
|
123
|
+
parts.push_back(
|
124
|
+
absl::StrFormat("server_listener_resource_name_template=\"%s\",\n",
|
125
|
+
bootstrap.server_listener_resource_name_template()));
|
126
|
+
}
|
121
127
|
parts.push_back("certificate_providers={\n");
|
122
128
|
for (const auto& entry : bootstrap.certificate_providers()) {
|
123
129
|
parts.push_back(
|
@@ -232,6 +238,16 @@ XdsBootstrap::XdsBootstrap(Json json, grpc_error** error) {
|
|
232
238
|
if (parse_error != GRPC_ERROR_NONE) error_list.push_back(parse_error);
|
233
239
|
}
|
234
240
|
}
|
241
|
+
it = json.mutable_object()->find("server_listener_resource_name_template");
|
242
|
+
if (it != json.mutable_object()->end()) {
|
243
|
+
if (it->second.type() != Json::Type::STRING) {
|
244
|
+
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
245
|
+
"\"server_listener_resource_name_template\" field is not a string"));
|
246
|
+
} else {
|
247
|
+
server_listener_resource_name_template_ =
|
248
|
+
std::move(*it->second.mutable_string_value());
|
249
|
+
}
|
250
|
+
}
|
235
251
|
if (XdsSecurityEnabled()) {
|
236
252
|
it = json.mutable_object()->find("certificate_providers");
|
237
253
|
if (it != json.mutable_object()->end()) {
|
@@ -455,13 +471,13 @@ grpc_error* XdsBootstrap::ParseLocality(Json* json) {
|
|
455
471
|
node_->locality_zone = std::move(*it->second.mutable_string_value());
|
456
472
|
}
|
457
473
|
}
|
458
|
-
it = json->mutable_object()->find("
|
474
|
+
it = json->mutable_object()->find("sub_zone");
|
459
475
|
if (it != json->mutable_object()->end()) {
|
460
476
|
if (it->second.type() != Json::Type::STRING) {
|
461
477
|
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
|
462
|
-
"\"
|
478
|
+
"\"sub_zone\" field is not a string"));
|
463
479
|
} else {
|
464
|
-
node_->
|
480
|
+
node_->locality_sub_zone = std::move(*it->second.mutable_string_value());
|
465
481
|
}
|
466
482
|
}
|
467
483
|
return GRPC_ERROR_CREATE_FROM_VECTOR("errors parsing \"locality\" object",
|