diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 53185d722924a..dccf3bb3f77d8 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -130,70 +130,6 @@ def _go_deps(skip_targets): def _envoy_api_deps(): _repository_impl("envoy_api") - api_bind_targets = [ - "address", - "base", - "bootstrap", - "discovery", - "cds", - "discovery", - "eds", - "grpc_service", - "health_check", - "lds", - "metrics", - "protocol", - "rds", - "sds", - "stats", - "trace", - ] - for t in api_bind_targets: - native.bind( - name = "envoy_" + t, - actual = "@envoy_api//api:" + t + "_cc", - ) - filter_bind_targets = [ - "fault", - ] - for t in filter_bind_targets: - native.bind( - name = "envoy_filter_" + t, - actual = "@envoy_api//api/filter:" + t + "_cc", - ) - http_filter_bind_targets = [ - "buffer", - "fault", - "health_check", - "ip_tagging", - "lua", - "rate_limit", - "router", - "squash", - "transcoder", - ] - for t in http_filter_bind_targets: - native.bind( - name = "envoy_filter_http_" + t, - actual = "@envoy_api//api/filter/http:" + t + "_cc", - ) - network_filter_bind_targets = [ - "http_connection_manager", - "tcp_proxy", - "mongo_proxy", - "redis_proxy", - "rate_limit", - "client_ssl_auth", - ] - for t in network_filter_bind_targets: - native.bind( - name = "envoy_filter_network_" + t, - actual = "@envoy_api//api/filter/network:" + t + "_cc", - ) - native.bind( - name = "envoy_filter_accesslog", - actual = "@envoy_api//api/filter/accesslog:accesslog_cc", - ) native.bind( name = "http_api_protos", actual = "@googleapis//:http_api_protos", diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index c56bf374894a5..dc136484a5be2 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -71,7 +71,7 @@ REPOSITORY_LOCATIONS = dict( urls = ["https://github.com/google/protobuf/archive/v3.5.0.tar.gz"], ), envoy_api = dict( - commit = "5aa0208c3bf0ba35833dc4ac16c73839b032e70a", + commit = "8345af596d78d5da6becb0538fced3d65efbaadf", remote = "https://github.com/envoyproxy/data-plane-api", ), grpc_httpjson_transcoding = dict( diff --git a/include/envoy/grpc/BUILD b/include/envoy/grpc/BUILD index 477ec0049e918..16921a15cdde1 100644 --- a/include/envoy/grpc/BUILD +++ b/include/envoy/grpc/BUILD @@ -23,10 +23,10 @@ envoy_cc_library( envoy_cc_library( name = "async_client_manager_interface", hdrs = ["async_client_manager.h"], - external_deps = ["envoy_grpc_service"], deps = [ ":async_client_interface", "//include/envoy/stats:stats_interface", + "@envoy_api//envoy/api/v2:grpc_service_cc", ], ) diff --git a/include/envoy/grpc/async_client_manager.h b/include/envoy/grpc/async_client_manager.h index 8291a3cbbf53e..766405ada3a1c 100644 --- a/include/envoy/grpc/async_client_manager.h +++ b/include/envoy/grpc/async_client_manager.h @@ -1,10 +1,9 @@ #pragma once +#include "envoy/api/v2/grpc_service.pb.h" #include "envoy/grpc/async_client.h" #include "envoy/stats/stats.h" -#include "api/grpc_service.pb.h" - namespace Envoy { namespace Grpc { diff --git a/include/envoy/local_info/BUILD b/include/envoy/local_info/BUILD index 108a0a06a56c6..217cfb6acca4c 100644 --- a/include/envoy/local_info/BUILD +++ b/include/envoy/local_info/BUILD @@ -11,6 +11,8 @@ envoy_package() envoy_cc_library( name = "local_info_interface", hdrs = ["local_info.h"], - external_deps = ["envoy_base"], - deps = ["//include/envoy/network:address_interface"], + deps = [ + "//include/envoy/network:address_interface", + "@envoy_api//envoy/api/v2:base_cc", + ], ) diff --git a/include/envoy/local_info/local_info.h b/include/envoy/local_info/local_info.h index 4acefb52654a6..f4beb8c08ef8b 100644 --- a/include/envoy/local_info/local_info.h +++ b/include/envoy/local_info/local_info.h @@ -2,11 +2,10 @@ #include +#include "envoy/api/v2/base.pb.h" #include "envoy/common/pure.h" #include "envoy/network/address.h" -#include "api/base.pb.h" - namespace Envoy { namespace LocalInfo { diff --git a/include/envoy/network/resolver.h b/include/envoy/network/resolver.h index b4c93bc145dcc..1bc7dd92a94bf 100644 --- a/include/envoy/network/resolver.h +++ b/include/envoy/network/resolver.h @@ -5,11 +5,10 @@ #include #include +#include "envoy/api/v2/address.pb.h" #include "envoy/common/pure.h" #include "envoy/network/address.h" -#include "api/address.pb.h" - namespace Envoy { namespace Network { namespace Address { diff --git a/include/envoy/router/BUILD b/include/envoy/router/BUILD index db0e05cee1502..102640b0a6184 100644 --- a/include/envoy/router/BUILD +++ b/include/envoy/router/BUILD @@ -17,7 +17,6 @@ envoy_cc_library( envoy_cc_library( name = "route_config_provider_manager_interface", hdrs = ["route_config_provider_manager.h"], - external_deps = ["envoy_filter_network_http_connection_manager"], deps = [ ":rds_interface", "//include/envoy/event:dispatcher_interface", @@ -28,6 +27,7 @@ envoy_cc_library( "//include/envoy/stats:stats_interface", "//include/envoy/thread_local:thread_local_interface", "//include/envoy/upstream:cluster_manager_interface", + "@envoy_api//envoy/api/v2/filter/network:http_connection_manager_cc", ], ) diff --git a/include/envoy/router/route_config_provider_manager.h b/include/envoy/router/route_config_provider_manager.h index 32d9db045deac..d9f17990898d7 100644 --- a/include/envoy/router/route_config_provider_manager.h +++ b/include/envoy/router/route_config_provider_manager.h @@ -2,6 +2,7 @@ #include +#include "envoy/api/v2/filter/network/http_connection_manager.pb.h" #include "envoy/event/dispatcher.h" #include "envoy/init/init.h" #include "envoy/json/json_object.h" @@ -12,8 +13,6 @@ #include "envoy/thread_local/thread_local.h" #include "envoy/upstream/cluster_manager.h" -#include "api/filter/network/http_connection_manager.pb.h" - namespace Envoy { namespace Router { diff --git a/include/envoy/router/router.h b/include/envoy/router/router.h index bb030bc9481c7..63d19df1ee62d 100644 --- a/include/envoy/router/router.h +++ b/include/envoy/router/router.h @@ -9,6 +9,7 @@ #include #include "envoy/access_log/access_log.h" +#include "envoy/api/v2/base.pb.h" #include "envoy/common/optional.h" #include "envoy/http/codec.h" #include "envoy/http/codes.h" @@ -19,8 +20,6 @@ #include "common/protobuf/protobuf.h" #include "common/protobuf/utility.h" -#include "api/base.pb.h" - namespace Envoy { namespace Router { diff --git a/include/envoy/server/BUILD b/include/envoy/server/BUILD index 0772aac42be72..b69ecf15b7082 100644 --- a/include/envoy/server/BUILD +++ b/include/envoy/server/BUILD @@ -110,7 +110,6 @@ envoy_cc_library( envoy_cc_library( name = "filter_config_interface", hdrs = ["filter_config.h"], - external_deps = ["envoy_base"], deps = [ ":admin_interface", "//include/envoy/access_log:access_log_interface", @@ -128,13 +127,13 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/common:macros", "//source/common/protobuf", + "@envoy_api//envoy/api/v2:base_cc", ], ) envoy_cc_library( name = "listener_manager_interface", hdrs = ["listener_manager.h"], - external_deps = ["envoy_lds"], deps = [ ":drain_manager_interface", ":filter_config_interface", @@ -143,6 +142,7 @@ envoy_cc_library( "//include/envoy/network:listen_socket_interface", "//include/envoy/ssl:context_interface", "//source/common/protobuf", + "@envoy_api//envoy/api/v2/listener:listener_cc", ], ) diff --git a/include/envoy/server/filter_config.h b/include/envoy/server/filter_config.h index b349788bdd23d..c48d63774e368 100644 --- a/include/envoy/server/filter_config.h +++ b/include/envoy/server/filter_config.h @@ -3,6 +3,7 @@ #include #include "envoy/access_log/access_log.h" +#include "envoy/api/v2/base.pb.h" #include "envoy/http/filter.h" #include "envoy/init/init.h" #include "envoy/json/json_object.h" @@ -20,8 +21,6 @@ #include "common/common/macros.h" #include "common/protobuf/protobuf.h" -#include "api/base.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/include/envoy/server/listener_manager.h b/include/envoy/server/listener_manager.h index fccafe7ed2aed..93be7d1aa7c3f 100644 --- a/include/envoy/server/listener_manager.h +++ b/include/envoy/server/listener_manager.h @@ -1,5 +1,6 @@ #pragma once +#include "envoy/api/v2/listener/listener.pb.h" #include "envoy/network/filter.h" #include "envoy/network/listen_socket.h" #include "envoy/network/listener.h" @@ -9,8 +10,6 @@ #include "common/protobuf/protobuf.h" -#include "api/lds.pb.h" - namespace Envoy { namespace Server { @@ -36,9 +35,9 @@ class ListenerComponentFactory { * @param context supplies the factory creation context. * @return std::vector the list of filter factories. */ - virtual std::vector - createNetworkFilterFactoryList(const Protobuf::RepeatedPtrField& filters, - Configuration::FactoryContext& context) PURE; + virtual std::vector createNetworkFilterFactoryList( + const Protobuf::RepeatedPtrField& filters, + Configuration::FactoryContext& context) PURE; /** * Creates a list of listener filter factories. @@ -47,7 +46,7 @@ class ListenerComponentFactory { * @return std::vector the list of filter factories. */ virtual std::vector createListenerFilterFactoryList( - const Protobuf::RepeatedPtrField& filters, + const Protobuf::RepeatedPtrField& filters, Configuration::FactoryContext& context) PURE; /** diff --git a/include/envoy/upstream/BUILD b/include/envoy/upstream/BUILD index b54670667038f..2798936e624c0 100644 --- a/include/envoy/upstream/BUILD +++ b/include/envoy/upstream/BUILD @@ -11,10 +11,6 @@ envoy_package() envoy_cc_library( name = "cluster_manager_interface", hdrs = ["cluster_manager.h"], - external_deps = [ - "envoy_bootstrap", - "envoy_cds", - ], deps = [ ":load_balancer_interface", ":thread_local_cluster_interface", @@ -26,6 +22,8 @@ envoy_cc_library( "//include/envoy/http:conn_pool_interface", "//include/envoy/local_info:local_info_interface", "//include/envoy/runtime:runtime_interface", + "@envoy_api//envoy/api/v2:cds_cc", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) @@ -43,12 +41,12 @@ envoy_cc_library( envoy_cc_library( name = "host_description_interface", hdrs = ["host_description.h"], - external_deps = ["envoy_base"], deps = [ ":health_check_host_monitor_interface", ":outlier_detection_interface", "//include/envoy/network:address_interface", "//include/envoy/stats:stats_macros", + "@envoy_api//envoy/api/v2:base_cc", ], ) @@ -64,9 +62,9 @@ envoy_cc_library( envoy_cc_library( name = "load_balancer_type_interface", hdrs = ["load_balancer_type.h"], - external_deps = ["envoy_cds"], deps = [ "//source/common/protobuf", + "@envoy_api//envoy/api/v2:cds_cc", ], ) diff --git a/include/envoy/upstream/cluster_manager.h b/include/envoy/upstream/cluster_manager.h index 8b73151201864..bd0536c2b204b 100644 --- a/include/envoy/upstream/cluster_manager.h +++ b/include/envoy/upstream/cluster_manager.h @@ -7,6 +7,8 @@ #include #include "envoy/access_log/access_log.h" +#include "envoy/api/v2/cds.pb.h" +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" #include "envoy/config/grpc_mux.h" #include "envoy/grpc/async_client_manager.h" #include "envoy/http/async_client.h" @@ -17,9 +19,6 @@ #include "envoy/upstream/thread_local_cluster.h" #include "envoy/upstream/upstream.h" -#include "api/bootstrap.pb.h" -#include "api/cds.pb.h" - namespace Envoy { namespace Upstream { @@ -193,12 +192,11 @@ class ClusterManagerFactory { /** * Allocate a cluster manager from configuration proto. */ - virtual ClusterManagerPtr clusterManagerFromProto(const envoy::api::v2::Bootstrap& bootstrap, - Stats::Store& stats, ThreadLocal::Instance& tls, - Runtime::Loader& runtime, - Runtime::RandomGenerator& random, - const LocalInfo::LocalInfo& local_info, - AccessLog::AccessLogManager& log_manager) PURE; + virtual ClusterManagerPtr + clusterManagerFromProto(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, + Stats::Store& stats, ThreadLocal::Instance& tls, Runtime::Loader& runtime, + Runtime::RandomGenerator& random, const LocalInfo::LocalInfo& local_info, + AccessLog::AccessLogManager& log_manager) PURE; /** * Allocate an HTTP connection pool. diff --git a/include/envoy/upstream/host_description.h b/include/envoy/upstream/host_description.h index 4e37ccfdfbf9b..d4dab625f754d 100644 --- a/include/envoy/upstream/host_description.h +++ b/include/envoy/upstream/host_description.h @@ -3,13 +3,12 @@ #include #include +#include "envoy/api/v2/base.pb.h" #include "envoy/network/address.h" #include "envoy/stats/stats_macros.h" #include "envoy/upstream/health_check_host_monitor.h" #include "envoy/upstream/outlier_detection.h" -#include "api/base.pb.h" - namespace Envoy { namespace Upstream { @@ -17,8 +16,8 @@ namespace Upstream { * All per host stats. @see stats_macros.h * * {rq_success, rq_error} have specific semantics driven by the needs of EDS load reporting. See - * envoy.api.v2.UpstreamLocalityStats for the definitions of success/error. These are latched by - * LoadStatsReporter, independent of the normal stats sink flushing. + * envoy.api.v2.endpoint.UpstreamLocalityStats for the definitions of success/error. These are + * latched by LoadStatsReporter, independent of the normal stats sink flushing. */ // clang-format off #define ALL_HOST_STATS(COUNTER, GAUGE) \ diff --git a/include/envoy/upstream/load_balancer_type.h b/include/envoy/upstream/load_balancer_type.h index 201ac13a3c699..9680c5fff1a30 100644 --- a/include/envoy/upstream/load_balancer_type.h +++ b/include/envoy/upstream/load_balancer_type.h @@ -4,9 +4,9 @@ #include #include -#include "common/protobuf/protobuf.h" +#include "envoy/api/v2/cds.pb.h" -#include "api/cds.pb.h" +#include "common/protobuf/protobuf.h" namespace Envoy { namespace Upstream { diff --git a/include/envoy/upstream/upstream.h b/include/envoy/upstream/upstream.h index 59ddae9ce419e..4d27ddd9207f7 100644 --- a/include/envoy/upstream/upstream.h +++ b/include/envoy/upstream/upstream.h @@ -8,6 +8,7 @@ #include #include +#include "envoy/api/v2/base.pb.h" #include "envoy/common/callback.h" #include "envoy/common/optional.h" #include "envoy/http/codec.h" @@ -19,8 +20,6 @@ #include "envoy/upstream/outlier_detection.h" #include "envoy/upstream/resource_manager.h" -#include "api/base.pb.h" - namespace Envoy { namespace Upstream { @@ -295,8 +294,8 @@ class PrioritySet { /** * All cluster load report stats. These are only use for EDS load reporting and not sent to the - * stats sink. See envoy.api.v2.ClusterStats for the definition of upstream_rq_dropped. These are - * latched by LoadStatsReporter, independent of the normal stats sink flushing. + * stats sink. See envoy.api.v2.endpoint.ClusterStats for the definition of upstream_rq_dropped. + * These are latched by LoadStatsReporter, independent of the normal stats sink flushing. */ // clang-format off #define ALL_CLUSTER_LOAD_REPORT_STATS(COUNTER) \ diff --git a/source/common/access_log/BUILD b/source/common/access_log/BUILD index d116f7a441224..cf2b12f8bdc70 100644 --- a/source/common/access_log/BUILD +++ b/source/common/access_log/BUILD @@ -57,7 +57,6 @@ envoy_cc_library( name = "grpc_access_log_lib", srcs = ["grpc_access_log_impl.cc"], hdrs = ["grpc_access_log_impl.h"], - external_deps = ["envoy_filter_accesslog"], deps = [ "//include/envoy/access_log:access_log_interface", "//include/envoy/grpc:async_client_interface", @@ -66,5 +65,8 @@ envoy_cc_library( "//include/envoy/thread_local:thread_local_interface", "//include/envoy/upstream:cluster_manager_interface", "//source/common/grpc:async_client_lib", + "@envoy_api//envoy/api/v2/filter/accesslog:accesslog_cc", + "@envoy_api//envoy/config/accesslog/v2:als_cc", + "@envoy_api//envoy/service/accesslog/v2:als_cc", ], ) diff --git a/source/common/access_log/access_log_impl.h b/source/common/access_log/access_log_impl.h index a9cbe4ccda265..59e2fc138f32e 100644 --- a/source/common/access_log/access_log_impl.h +++ b/source/common/access_log/access_log_impl.h @@ -5,14 +5,13 @@ #include #include "envoy/access_log/access_log.h" +#include "envoy/api/v2/filter/accesslog/accesslog.pb.h" #include "envoy/request_info/request_info.h" #include "envoy/runtime/runtime.h" #include "envoy/server/access_log_config.h" #include "common/protobuf/protobuf.h" -#include "api/filter/accesslog/accesslog.pb.h" - namespace Envoy { namespace AccessLog { diff --git a/source/common/access_log/grpc_access_log_impl.cc b/source/common/access_log/grpc_access_log_impl.cc index b747efaf5e766..2487cdaa98a00 100644 --- a/source/common/access_log/grpc_access_log_impl.cc +++ b/source/common/access_log/grpc_access_log_impl.cc @@ -32,8 +32,7 @@ GrpcAccessLogStreamerImpl::ThreadLocalStreamer::ThreadLocalStreamer( : client_(shared_state->factory_->create()), shared_state_(shared_state) {} void GrpcAccessLogStreamerImpl::ThreadLocalStreamer::send( - envoy::api::v2::filter::accesslog::StreamAccessLogsMessage& message, - const std::string& log_name) { + envoy::service::accesslog::v2::StreamAccessLogsMessage& message, const std::string& log_name) { auto stream_it = stream_map_.find(log_name); if (stream_it == stream_map_.end()) { stream_it = stream_map_.emplace(log_name, ThreadLocalStream(*this, log_name)).first; @@ -43,7 +42,7 @@ void GrpcAccessLogStreamerImpl::ThreadLocalStreamer::send( if (stream_entry.stream_ == nullptr) { stream_entry.stream_ = client_->start(*Protobuf::DescriptorPool::generated_pool()->FindMethodByName( - "envoy.api.v2.filter.accesslog.AccessLogService.StreamAccessLogs"), + "envoy.service.accesslog.v2.AccessLogService.StreamAccessLogs"), stream_entry); auto* identifier = message.mutable_identifier(); @@ -60,7 +59,7 @@ void GrpcAccessLogStreamerImpl::ThreadLocalStreamer::send( } HttpGrpcAccessLog::HttpGrpcAccessLog( - FilterPtr&& filter, const envoy::api::v2::filter::accesslog::HttpGrpcAccessLogConfig& config, + FilterPtr&& filter, const envoy::config::accesslog::v2::HttpGrpcAccessLogConfig& config, GrpcAccessLogStreamerSharedPtr grpc_access_log_streamer) : filter_(std::move(filter)), config_(config), grpc_access_log_streamer_(grpc_access_log_streamer) {} @@ -150,7 +149,7 @@ void HttpGrpcAccessLog::log(const Http::HeaderMap* request_headers, } } - envoy::api::v2::filter::accesslog::StreamAccessLogsMessage message; + envoy::service::accesslog::v2::StreamAccessLogsMessage message; auto* log_entry = message.mutable_http_logs()->add_log_entry(); // Common log properties. diff --git a/source/common/access_log/grpc_access_log_impl.h b/source/common/access_log/grpc_access_log_impl.h index 3d9d5ceac9469..4c79b02d65e69 100644 --- a/source/common/access_log/grpc_access_log_impl.h +++ b/source/common/access_log/grpc_access_log_impl.h @@ -3,14 +3,15 @@ #include #include "envoy/access_log/access_log.h" +#include "envoy/api/v2/filter/accesslog/accesslog.pb.h" +#include "envoy/config/accesslog/v2/als.pb.h" #include "envoy/grpc/async_client.h" #include "envoy/grpc/async_client_manager.h" #include "envoy/local_info/local_info.h" +#include "envoy/service/accesslog/v2/als.pb.h" #include "envoy/singleton/instance.h" #include "envoy/thread_local/thread_local.h" -#include "api/filter/accesslog/accesslog.pb.h" - namespace Envoy { namespace AccessLog { @@ -29,7 +30,7 @@ class GrpcAccessLogStreamer { * @param message supplies the access log to send. * @param log_name supplies the name of the log stream to send on. */ - virtual void send(envoy::api::v2::filter::accesslog::StreamAccessLogsMessage& message, + virtual void send(envoy::service::accesslog::v2::StreamAccessLogsMessage& message, const std::string& log_name) PURE; }; @@ -45,7 +46,7 @@ class GrpcAccessLogStreamerImpl : public Singleton::Instance, public GrpcAccessL const LocalInfo::LocalInfo& local_info); // GrpcAccessLogStreamer - void send(envoy::api::v2::filter::accesslog::StreamAccessLogsMessage& message, + void send(envoy::service::accesslog::v2::StreamAccessLogsMessage& message, const std::string& log_name) override { tls_slot_->getTyped().send(message, log_name); } @@ -71,7 +72,7 @@ class GrpcAccessLogStreamerImpl : public Singleton::Instance, public GrpcAccessL * Per-thread stream state. */ struct ThreadLocalStream : public Grpc::TypedAsyncStreamCallbacks< - envoy::api::v2::filter::accesslog::StreamAccessLogsResponse> { + envoy::service::accesslog::v2::StreamAccessLogsResponse> { ThreadLocalStream(ThreadLocalStreamer& parent, const std::string& log_name) : parent_(parent), log_name_(log_name) {} @@ -79,7 +80,7 @@ class GrpcAccessLogStreamerImpl : public Singleton::Instance, public GrpcAccessL void onCreateInitialMetadata(Http::HeaderMap&) override {} void onReceiveInitialMetadata(Http::HeaderMapPtr&&) override {} void onReceiveMessage( - std::unique_ptr&&) override {} + std::unique_ptr&&) override {} void onReceiveTrailingMetadata(Http::HeaderMapPtr&&) override {} void onRemoteClose(Grpc::Status::GrpcStatus status, const std::string& message) override; @@ -93,7 +94,7 @@ class GrpcAccessLogStreamerImpl : public Singleton::Instance, public GrpcAccessL */ struct ThreadLocalStreamer : public ThreadLocal::ThreadLocalObject { ThreadLocalStreamer(const SharedStateSharedPtr& shared_state); - void send(envoy::api::v2::filter::accesslog::StreamAccessLogsMessage& message, + void send(envoy::service::accesslog::v2::StreamAccessLogsMessage& message, const std::string& log_name); Grpc::AsyncClientPtr client_; @@ -110,7 +111,7 @@ class GrpcAccessLogStreamerImpl : public Singleton::Instance, public GrpcAccessL class HttpGrpcAccessLog : public Instance { public: HttpGrpcAccessLog(FilterPtr&& filter, - const envoy::api::v2::filter::accesslog::HttpGrpcAccessLogConfig& config, + const envoy::config::accesslog::v2::HttpGrpcAccessLogConfig& config, GrpcAccessLogStreamerSharedPtr grpc_access_log_streamer); static void addressToAccessLogAddress(envoy::api::v2::Address& proto_address, @@ -125,7 +126,7 @@ class HttpGrpcAccessLog : public Instance { private: FilterPtr filter_; - const envoy::api::v2::filter::accesslog::HttpGrpcAccessLogConfig config_; + const envoy::config::accesslog::v2::HttpGrpcAccessLogConfig config_; GrpcAccessLogStreamerSharedPtr grpc_access_log_streamer_; }; diff --git a/source/common/config/BUILD b/source/common/config/BUILD index 7c3996c51ba17..6d174c1160edc 100644 --- a/source/common/config/BUILD +++ b/source/common/config/BUILD @@ -12,12 +12,12 @@ envoy_cc_library( name = "address_json_lib", srcs = ["address_json.cc"], hdrs = ["address_json.h"], - external_deps = ["envoy_address"], deps = [ "//include/envoy/json:json_object_interface", "//source/common/common:assert_lib", "//source/common/network:cidr_range_lib", "//source/common/network:utility_lib", + "@envoy_api//envoy/api/v2:address_cc", ], ) @@ -25,7 +25,6 @@ envoy_cc_library( name = "bootstrap_json_lib", srcs = ["bootstrap_json.cc"], hdrs = ["bootstrap_json.h"], - external_deps = ["envoy_bootstrap"], deps = [ ":address_json_lib", ":cds_json_lib", @@ -37,6 +36,7 @@ envoy_cc_library( "//source/common/config:well_known_names", "//source/common/json:config_schemas_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) @@ -44,9 +44,9 @@ envoy_cc_library( name = "base_json_lib", srcs = ["base_json.cc"], hdrs = ["base_json.h"], - external_deps = ["envoy_base"], deps = [ "//include/envoy/json:json_object_interface", + "@envoy_api//envoy/api/v2:base_cc", ], ) @@ -54,7 +54,6 @@ envoy_cc_library( name = "cds_json_lib", srcs = ["cds_json.cc"], hdrs = ["cds_json.h"], - external_deps = ["envoy_cds"], deps = [ ":address_json_lib", ":json_utility_lib", @@ -67,6 +66,8 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/json:config_schemas_lib", "//source/common/network:utility_lib", + "@envoy_api//envoy/api/v2:cds_cc", + "@envoy_api//envoy/api/v2/cluster:circuit_breaker_cc", ], ) @@ -88,22 +89,6 @@ envoy_cc_library( name = "filter_json_lib", srcs = ["filter_json.cc"], hdrs = ["filter_json.h"], - external_deps = [ - "envoy_filter_network_http_connection_manager", - "envoy_filter_http_buffer", - "envoy_filter_http_lua", - "envoy_filter_http_fault", - "envoy_filter_http_health_check", - "envoy_filter_http_rate_limit", - "envoy_filter_http_transcoder", - "envoy_filter_http_router", - "envoy_filter_http_squash", - "envoy_filter_network_mongo_proxy", - "envoy_filter_network_redis_proxy", - "envoy_filter_network_tcp_proxy", - "envoy_filter_network_rate_limit", - "envoy_filter_network_client_ssl_auth", - ], deps = [ ":address_json_lib", ":json_utility_lib", @@ -117,6 +102,20 @@ envoy_cc_library( "//source/common/json:config_schemas_lib", "//source/common/protobuf", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2/filter/http:buffer_cc", + "@envoy_api//envoy/api/v2/filter/http:fault_cc", + "@envoy_api//envoy/api/v2/filter/http:health_check_cc", + "@envoy_api//envoy/api/v2/filter/http:lua_cc", + "@envoy_api//envoy/api/v2/filter/http:rate_limit_cc", + "@envoy_api//envoy/api/v2/filter/http:router_cc", + "@envoy_api//envoy/api/v2/filter/http:squash_cc", + "@envoy_api//envoy/api/v2/filter/http:transcoder_cc", + "@envoy_api//envoy/api/v2/filter/network:client_ssl_auth_cc", + "@envoy_api//envoy/api/v2/filter/network:http_connection_manager_cc", + "@envoy_api//envoy/api/v2/filter/network:mongo_proxy_cc", + "@envoy_api//envoy/api/v2/filter/network:rate_limit_cc", + "@envoy_api//envoy/api/v2/filter/network:redis_proxy_cc", + "@envoy_api//envoy/api/v2/filter/network:tcp_proxy_cc", ], ) @@ -124,7 +123,6 @@ envoy_cc_library( name = "grpc_mux_lib", srcs = ["grpc_mux_impl.cc"], hdrs = ["grpc_mux_impl.h"], - external_deps = ["envoy_discovery"], deps = [ ":utility_lib", "//include/envoy/config:grpc_mux_interface", @@ -133,13 +131,14 @@ envoy_cc_library( "//include/envoy/upstream:cluster_manager_interface", "//source/common/common:logger_lib", "//source/common/protobuf", + "@envoy_api//envoy/api/v2:discovery_cc", + "@envoy_api//envoy/service/discovery/v2:ads_cc", ], ) envoy_cc_library( name = "grpc_mux_subscription_lib", hdrs = ["grpc_mux_subscription_impl.h"], - external_deps = ["envoy_discovery"], deps = [ "//include/envoy/config:grpc_mux_interface", "//include/envoy/config:subscription_interface", @@ -147,29 +146,26 @@ envoy_cc_library( "//source/common/common:logger_lib", "//source/common/grpc:common_lib", "//source/common/protobuf", + "@envoy_api//envoy/api/v2:discovery_cc", ], ) envoy_cc_library( name = "grpc_subscription_lib", hdrs = ["grpc_subscription_impl.h"], - external_deps = ["envoy_base"], deps = [ ":grpc_mux_lib", ":grpc_mux_subscription_lib", "//include/envoy/config:subscription_interface", "//include/envoy/event:dispatcher_interface", "//include/envoy/grpc:async_client_interface", + "@envoy_api//envoy/api/v2:base_cc", ], ) envoy_cc_library( name = "http_subscription_lib", hdrs = ["http_subscription_impl.h"], - external_deps = [ - "envoy_base", - "http_api_protos", - ], deps = [ "//include/envoy/config:subscription_interface", "//source/common/buffer:buffer_lib", @@ -179,6 +175,8 @@ envoy_cc_library( "//source/common/http:rest_api_fetcher_lib", "//source/common/protobuf", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2:base_cc", + "@googleapis//:http_api_protos", ], ) @@ -196,7 +194,6 @@ envoy_cc_library( name = "lds_json_lib", srcs = ["lds_json.cc"], hdrs = ["lds_json.h"], - external_deps = ["envoy_lds"], deps = [ ":address_json_lib", ":json_utility_lib", @@ -207,6 +204,7 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/json:config_schemas_lib", "//source/common/network:utility_lib", + "@envoy_api//envoy/api/v2:lds_cc", ], ) @@ -214,10 +212,10 @@ envoy_cc_library( name = "metadata_lib", srcs = ["metadata.cc"], hdrs = ["metadata.h"], - external_deps = ["envoy_base"], deps = [ "//source/common/protobuf", "//source/common/singleton:const_singleton", + "@envoy_api//envoy/api/v2:base_cc", ], ) @@ -225,10 +223,10 @@ envoy_cc_library( name = "protocol_json_lib", srcs = ["protocol_json.cc"], hdrs = ["protocol_json.h"], - external_deps = ["envoy_protocol"], deps = [ ":json_utility_lib", "//include/envoy/json:json_object_interface", + "@envoy_api//envoy/api/v2:protocol_cc", ], ) @@ -242,7 +240,6 @@ envoy_cc_library( name = "rds_json_lib", srcs = ["rds_json.cc"], hdrs = ["rds_json.h"], - external_deps = ["envoy_rds"], deps = [ ":base_json_lib", ":json_utility_lib", @@ -252,13 +249,13 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/config:utility_lib", "//source/common/json:config_schemas_lib", + "@envoy_api//envoy/api/v2:rds_cc", ], ) envoy_cc_library( name = "subscription_factory_lib", hdrs = ["subscription_factory.h"], - external_deps = ["envoy_base"], deps = [ ":filesystem_subscription_lib", ":grpc_mux_subscription_lib", @@ -269,6 +266,7 @@ envoy_cc_library( "//include/envoy/upstream:cluster_manager_interface", "//source/common/filesystem:filesystem_lib", "//source/common/protobuf", + "@envoy_api//envoy/api/v2:base_cc", ], ) @@ -276,11 +274,11 @@ envoy_cc_library( name = "tls_context_json_lib", srcs = ["tls_context_json.cc"], hdrs = ["tls_context_json.h"], - external_deps = ["envoy_sds"], deps = [ ":json_utility_lib", "//include/envoy/json:json_object_interface", "//source/common/common:utility_lib", + "@envoy_api//envoy/api/v2/auth:cert_cc", ], ) @@ -288,14 +286,6 @@ envoy_cc_library( name = "utility_lib", srcs = ["utility.cc"], hdrs = ["utility.h"], - external_deps = [ - "envoy_base", - "envoy_cds", - "envoy_eds", - "envoy_lds", - "envoy_rds", - "envoy_filter_network_http_connection_manager", - ], deps = [ ":json_utility_lib", ":resources_lib", @@ -315,6 +305,12 @@ envoy_cc_library( "//source/common/protobuf:utility_lib", "//source/common/singleton:const_singleton", "//source/common/stats:stats_lib", + "@envoy_api//envoy/api/v2:base_cc", + "@envoy_api//envoy/api/v2:cds_cc", + "@envoy_api//envoy/api/v2:eds_cc", + "@envoy_api//envoy/api/v2:lds_cc", + "@envoy_api//envoy/api/v2:rds_cc", + "@envoy_api//envoy/api/v2/filter/network:http_connection_manager_cc", ], ) diff --git a/source/common/config/address_json.h b/source/common/config/address_json.h index f79b4ee2411ad..c8659a6fe0b56 100644 --- a/source/common/config/address_json.h +++ b/source/common/config/address_json.h @@ -1,11 +1,10 @@ #pragma once +#include "envoy/api/v2/address.pb.h" #include "envoy/json/json_object.h" #include "common/protobuf/protobuf.h" -#include "api/address.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/base_json.h b/source/common/config/base_json.h index 507bbea9a9a88..f6c611c830c39 100644 --- a/source/common/config/base_json.h +++ b/source/common/config/base_json.h @@ -1,9 +1,8 @@ #pragma once +#include "envoy/api/v2/base.pb.h" #include "envoy/json/json_object.h" -#include "api/base.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/bootstrap_json.cc b/source/common/config/bootstrap_json.cc index e06c4207391af..332a7b72e3c53 100644 --- a/source/common/config/bootstrap_json.cc +++ b/source/common/config/bootstrap_json.cc @@ -13,8 +13,8 @@ namespace Envoy { namespace Config { -void BootstrapJson::translateClusterManagerBootstrap(const Json::Object& json_cluster_manager, - envoy::api::v2::Bootstrap& bootstrap) { +void BootstrapJson::translateClusterManagerBootstrap( + const Json::Object& json_cluster_manager, envoy::config::bootstrap::v2::Bootstrap& bootstrap) { json_cluster_manager.validateSchema(Json::Schema::CLUSTER_MANAGER_SCHEMA); Optional eds_config; @@ -52,7 +52,7 @@ void BootstrapJson::translateClusterManagerBootstrap(const Json::Object& json_cl } void BootstrapJson::translateBootstrap(const Json::Object& json_config, - envoy::api::v2::Bootstrap& bootstrap) { + envoy::config::bootstrap::v2::Bootstrap& bootstrap) { json_config.validateSchema(Json::Schema::TOP_LEVEL_CONFIG_SCHEMA); translateClusterManagerBootstrap(*json_config.getObject("cluster_manager"), bootstrap); @@ -73,7 +73,7 @@ void BootstrapJson::translateBootstrap(const Json::Object& json_config, if (json_config.hasObject("statsd_udp_ip_address")) { auto* stats_sink = stats_sinks->Add(); stats_sink->set_name(Config::StatsSinkNames::get().STATSD); - envoy::api::v2::StatsdSink statsd_sink; + envoy::config::metrics::v2::StatsdSink statsd_sink; AddressJson::translateAddress(json_config.getString("statsd_udp_ip_address"), false, true, *statsd_sink.mutable_address()); MessageUtil::jsonConvert(statsd_sink, *stats_sink->mutable_config()); @@ -82,7 +82,7 @@ void BootstrapJson::translateBootstrap(const Json::Object& json_config, if (json_config.hasObject("statsd_tcp_cluster_name")) { auto* stats_sink = stats_sinks->Add(); stats_sink->set_name(Config::StatsSinkNames::get().STATSD); - envoy::api::v2::StatsdSink statsd_sink; + envoy::config::metrics::v2::StatsdSink statsd_sink; statsd_sink.set_tcp_cluster_name(json_config.getString("statsd_tcp_cluster_name")); MessageUtil::jsonConvert(statsd_sink, *stats_sink->mutable_config()); } diff --git a/source/common/config/bootstrap_json.h b/source/common/config/bootstrap_json.h index 114f6c3a646ff..80c567d7264ad 100644 --- a/source/common/config/bootstrap_json.h +++ b/source/common/config/bootstrap_json.h @@ -1,29 +1,28 @@ #pragma once +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" #include "envoy/json/json_object.h" -#include "api/bootstrap.pb.h" - namespace Envoy { namespace Config { class BootstrapJson { public: /** - * Translate a v1 JSON cluster manager object to v2 envoy::api::v2::Bootstrap. + * Translate a v1 JSON cluster manager object to v2 envoy::config::bootstrap::v2::Bootstrap. * @param json_cluster_manager source v1 JSON cluster manager object. - * @param bootstrap destination v2 envoy::api::v2::Bootstrap. + * @param bootstrap destination v2 envoy::config::bootstrap::v2::Bootstrap. */ static void translateClusterManagerBootstrap(const Json::Object& json_cluster_manager, - envoy::api::v2::Bootstrap& bootstrap); + envoy::config::bootstrap::v2::Bootstrap& bootstrap); /** - * Translate a v1 JSON static config object to v2 envoy::api::v2::Bootstrap. + * Translate a v1 JSON static config object to v2 envoy::config::bootstrap::v2::Bootstrap. * @param json_config source v1 JSON static config object. - * @param bootstrap destination v2 envoy::api::v2::Bootstrap. + * @param bootstrap destination v2 envoy::config::bootstrap::v2::Bootstrap. */ static void translateBootstrap(const Json::Object& json_config, - envoy::api::v2::Bootstrap& bootstrap); + envoy::config::bootstrap::v2::Bootstrap& bootstrap); }; } // namespace Config diff --git a/source/common/config/cds_json.cc b/source/common/config/cds_json.cc index a118a2d4448b0..3bc114f77ec42 100644 --- a/source/common/config/cds_json.cc +++ b/source/common/config/cds_json.cc @@ -57,9 +57,9 @@ void CdsJson::translateHealthCheck(const Json::Object& json_health_check, } } -void CdsJson::translateThresholds(const Json::Object& json_thresholds, - const envoy::api::v2::RoutingPriority& priority, - envoy::api::v2::CircuitBreakers::Thresholds& thresholds) { +void CdsJson::translateThresholds( + const Json::Object& json_thresholds, const envoy::api::v2::RoutingPriority& priority, + envoy::api::v2::cluster::CircuitBreakers::Thresholds& thresholds) { thresholds.set_priority(priority); JSON_UTIL_SET_INTEGER(json_thresholds, thresholds, max_connections); JSON_UTIL_SET_INTEGER(json_thresholds, thresholds, max_pending_requests); @@ -68,7 +68,7 @@ void CdsJson::translateThresholds(const Json::Object& json_thresholds, } void CdsJson::translateCircuitBreakers(const Json::Object& json_circuit_breakers, - envoy::api::v2::CircuitBreakers& circuit_breakers) { + envoy::api::v2::cluster::CircuitBreakers& circuit_breakers) { translateThresholds(*json_circuit_breakers.getObject("default", true), envoy::api::v2::RoutingPriority::DEFAULT, *circuit_breakers.mutable_thresholds()->Add()); @@ -79,7 +79,7 @@ void CdsJson::translateCircuitBreakers(const Json::Object& json_circuit_breakers void CdsJson::translateOutlierDetection( const Json::Object& json_outlier_detection, - envoy::api::v2::Cluster::OutlierDetection& outlier_detection) { + envoy::api::v2::cluster::OutlierDetection& outlier_detection) { JSON_UTIL_SET_DURATION(json_outlier_detection, outlier_detection, interval); JSON_UTIL_SET_DURATION(json_outlier_detection, outlier_detection, base_ejection_time); JSON_UTIL_SET_INTEGER(json_outlier_detection, outlier_detection, consecutive_5xx); diff --git a/source/common/config/cds_json.h b/source/common/config/cds_json.h index 448d6a501ac0f..106782d5df38c 100644 --- a/source/common/config/cds_json.h +++ b/source/common/config/cds_json.h @@ -1,11 +1,11 @@ #pragma once +#include "envoy/api/v2/cds.pb.h" +#include "envoy/api/v2/cluster/circuit_breaker.pb.h" #include "envoy/common/optional.h" #include "envoy/json/json_object.h" #include "envoy/upstream/cluster_manager.h" -#include "api/cds.pb.h" - namespace Envoy { namespace Config { @@ -36,15 +36,15 @@ class CdsJson { */ static void translateThresholds(const Json::Object& json_thresholds, const envoy::api::v2::RoutingPriority& priority, - envoy::api::v2::CircuitBreakers::Thresholds& thresholds); + envoy::api::v2::cluster::CircuitBreakers::Thresholds& thresholds); /** - * Translate a v1 JSON circuit breakers object to v2 envoy::api::v2::CircuitBreakers. + * Translate a v1 JSON circuit breakers object to v2 envoy::api::v2::cluster::CircuitBreakers. * @param json_circuit_breakers source v1 JSON circuit breakers object. - * @param circuit_breakers destination v2 envoy::api::v2::CircuitBreakers. + * @param circuit_breakers destination v2 envoy::api::v2::cluster::CircuitBreakers. */ static void translateCircuitBreakers(const Json::Object& json_circuit_breakers, - envoy::api::v2::CircuitBreakers& circuit_breakers); + envoy::api::v2::cluster::CircuitBreakers& circuit_breakers); /** * Translate a v1 JSON outlier detection object to v2 envoy::api::v2::OutlierDetection. @@ -53,7 +53,7 @@ class CdsJson { */ static void translateOutlierDetection(const Json::Object& json_outlier_detection, - envoy::api::v2::Cluster::OutlierDetection& outlier_detection); + envoy::api::v2::cluster::OutlierDetection& outlier_detection); /** * Translate a v1 JSON Cluster to v2 envoy::api::v2::Cluster. diff --git a/source/common/config/filesystem_subscription_impl.h b/source/common/config/filesystem_subscription_impl.h index 1bf5bd22e8fd6..a1a1df4d28f12 100644 --- a/source/common/config/filesystem_subscription_impl.h +++ b/source/common/config/filesystem_subscription_impl.h @@ -1,5 +1,6 @@ #pragma once +#include "envoy/api/v2/base.pb.h" #include "envoy/config/subscription.h" #include "envoy/event/dispatcher.h" #include "envoy/filesystem/filesystem.h" @@ -10,8 +11,6 @@ #include "common/protobuf/protobuf.h" #include "common/protobuf/utility.h" -#include "api/base.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/filter_json.h b/source/common/config/filter_json.h index c4d1d01c5a932..c9ac9f6a8581f 100644 --- a/source/common/config/filter_json.h +++ b/source/common/config/filter_json.h @@ -1,22 +1,21 @@ #pragma once +#include "envoy/api/v2/filter/http/buffer.pb.h" +#include "envoy/api/v2/filter/http/fault.pb.h" +#include "envoy/api/v2/filter/http/health_check.pb.h" +#include "envoy/api/v2/filter/http/lua.pb.h" +#include "envoy/api/v2/filter/http/rate_limit.pb.h" +#include "envoy/api/v2/filter/http/router.pb.h" +#include "envoy/api/v2/filter/http/squash.pb.h" +#include "envoy/api/v2/filter/http/transcoder.pb.h" +#include "envoy/api/v2/filter/network/client_ssl_auth.pb.h" +#include "envoy/api/v2/filter/network/http_connection_manager.pb.h" +#include "envoy/api/v2/filter/network/mongo_proxy.pb.h" +#include "envoy/api/v2/filter/network/rate_limit.pb.h" +#include "envoy/api/v2/filter/network/redis_proxy.pb.h" +#include "envoy/api/v2/filter/network/tcp_proxy.pb.h" #include "envoy/json/json_object.h" -#include "api/filter/http/buffer.pb.h" -#include "api/filter/http/fault.pb.h" -#include "api/filter/http/health_check.pb.h" -#include "api/filter/http/lua.pb.h" -#include "api/filter/http/rate_limit.pb.h" -#include "api/filter/http/router.pb.h" -#include "api/filter/http/squash.pb.h" -#include "api/filter/http/transcoder.pb.h" -#include "api/filter/network/client_ssl_auth.pb.h" -#include "api/filter/network/http_connection_manager.pb.h" -#include "api/filter/network/mongo_proxy.pb.h" -#include "api/filter/network/rate_limit.pb.h" -#include "api/filter/network/redis_proxy.pb.h" -#include "api/filter/network/tcp_proxy.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/grpc_mux_impl.h b/source/common/config/grpc_mux_impl.h index 0f49244ba1aca..c5171713a3eb3 100644 --- a/source/common/config/grpc_mux_impl.h +++ b/source/common/config/grpc_mux_impl.h @@ -2,16 +2,16 @@ #include +#include "envoy/api/v2/discovery.pb.h" #include "envoy/config/grpc_mux.h" #include "envoy/config/subscription.h" #include "envoy/event/dispatcher.h" #include "envoy/grpc/async_client.h" +#include "envoy/service/discovery/v2/ads.pb.h" #include "envoy/upstream/cluster_manager.h" #include "common/common/logger.h" -#include "api/discovery.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/grpc_mux_subscription_impl.h b/source/common/config/grpc_mux_subscription_impl.h index caecccd9f5c6c..2ff0dbb3da5d7 100644 --- a/source/common/config/grpc_mux_subscription_impl.h +++ b/source/common/config/grpc_mux_subscription_impl.h @@ -1,5 +1,6 @@ #pragma once +#include "envoy/api/v2/discovery.pb.h" #include "envoy/config/grpc_mux.h" #include "envoy/config/subscription.h" @@ -9,8 +10,6 @@ #include "common/protobuf/protobuf.h" #include "common/protobuf/utility.h" -#include "api/discovery.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/grpc_subscription_impl.h b/source/common/config/grpc_subscription_impl.h index 13ee5cc5e6ff2..b9c5d0ed2afe6 100644 --- a/source/common/config/grpc_subscription_impl.h +++ b/source/common/config/grpc_subscription_impl.h @@ -1,5 +1,6 @@ #pragma once +#include "envoy/api/v2/base.pb.h" #include "envoy/config/subscription.h" #include "envoy/event/dispatcher.h" #include "envoy/grpc/async_client.h" @@ -7,8 +8,6 @@ #include "common/config/grpc_mux_impl.h" #include "common/config/grpc_mux_subscription_impl.h" -#include "api/base.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/http_subscription_impl.h b/source/common/config/http_subscription_impl.h index 8da4312e05d0d..a3e34d45585fe 100644 --- a/source/common/config/http_subscription_impl.h +++ b/source/common/config/http_subscription_impl.h @@ -1,5 +1,6 @@ #pragma once +#include "envoy/api/v2/base.pb.h" #include "envoy/config/subscription.h" #include "common/buffer/buffer_impl.h" @@ -12,7 +13,6 @@ #include "common/protobuf/protobuf.h" #include "common/protobuf/utility.h" -#include "api/base.pb.h" #include "google/api/annotations.pb.h" namespace Envoy { diff --git a/source/common/config/lds_json.h b/source/common/config/lds_json.h index 04716ce7c5f1d..4848192acf570 100644 --- a/source/common/config/lds_json.h +++ b/source/common/config/lds_json.h @@ -1,9 +1,9 @@ #pragma once +#include "envoy/api/v2/lds.pb.h" +#include "envoy/api/v2/listener/listener.pb.h" #include "envoy/json/json_object.h" -#include "api/lds.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/metadata.h b/source/common/config/metadata.h index b77ffb7f2cc71..d9140526f5567 100644 --- a/source/common/config/metadata.h +++ b/source/common/config/metadata.h @@ -2,11 +2,11 @@ #include +#include "envoy/api/v2/base.pb.h" + #include "common/protobuf/protobuf.h" #include "common/singleton/const_singleton.h" -#include "api/base.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/protocol_json.h b/source/common/config/protocol_json.h index 83b69fb2a81d6..39d61d5104a2a 100644 --- a/source/common/config/protocol_json.h +++ b/source/common/config/protocol_json.h @@ -1,9 +1,8 @@ #pragma once +#include "envoy/api/v2/protocol.pb.h" #include "envoy/json/json_object.h" -#include "api/protocol.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/rds_json.cc b/source/common/config/rds_json.cc index eeb45e000b5df..f504d53e075fa 100644 --- a/source/common/config/rds_json.cc +++ b/source/common/config/rds_json.cc @@ -13,13 +13,13 @@ namespace Envoy { namespace Config { void RdsJson::translateWeightedCluster(const Json::Object& json_weighted_clusters, - envoy::api::v2::WeightedCluster& weighted_cluster) { + envoy::api::v2::route::WeightedCluster& weighted_cluster) { JSON_UTIL_SET_STRING(json_weighted_clusters, weighted_cluster, runtime_key_prefix); const auto clusters = json_weighted_clusters.getObjectArray("clusters"); std::transform(clusters.cbegin(), clusters.cend(), Protobuf::RepeatedPtrFieldBackInserter(weighted_cluster.mutable_clusters()), [](const Json::ObjectSharedPtr& json_cluster_weight) { - envoy::api::v2::WeightedCluster::ClusterWeight cluster_weight; + envoy::api::v2::route::WeightedCluster::ClusterWeight cluster_weight; JSON_UTIL_SET_STRING(*json_cluster_weight, cluster_weight, name); JSON_UTIL_SET_INTEGER(*json_cluster_weight, cluster_weight, weight); return cluster_weight; @@ -27,7 +27,7 @@ void RdsJson::translateWeightedCluster(const Json::Object& json_weighted_cluster } void RdsJson::translateVirtualCluster(const Json::Object& json_virtual_cluster, - envoy::api::v2::VirtualCluster& virtual_cluster) { + envoy::api::v2::route::VirtualCluster& virtual_cluster) { JSON_UTIL_SET_STRING(json_virtual_cluster, virtual_cluster, name); JSON_UTIL_SET_STRING(json_virtual_cluster, virtual_cluster, pattern); @@ -36,7 +36,8 @@ void RdsJson::translateVirtualCluster(const Json::Object& json_virtual_cluster, virtual_cluster.set_method(method); } -void RdsJson::translateCors(const Json::Object& json_cors, envoy::api::v2::CorsPolicy& cors) { +void RdsJson::translateCors(const Json::Object& json_cors, + envoy::api::v2::route::CorsPolicy& cors) { for (const std::string& origin : json_cors.getStringArray("allow_origin", true)) { cors.add_allow_origin(origin); } @@ -49,7 +50,7 @@ void RdsJson::translateCors(const Json::Object& json_cors, envoy::api::v2::CorsP } void RdsJson::translateRateLimit(const Json::Object& json_rate_limit, - envoy::api::v2::RateLimit& rate_limit) { + envoy::api::v2::route::RateLimit& rate_limit) { json_rate_limit.validateSchema(Json::Schema::HTTP_RATE_LIMITS_CONFIGURATION_SCHEMA); JSON_UTIL_SET_INTEGER(json_rate_limit, rate_limit, stage); JSON_UTIL_SET_STRING(json_rate_limit, rate_limit, disable_key); @@ -79,7 +80,7 @@ void RdsJson::translateRateLimit(const Json::Object& json_rate_limit, std::transform(headers.cbegin(), headers.cend(), Protobuf::RepeatedPtrFieldBackInserter(header_value_match->mutable_headers()), [](const Json::ObjectSharedPtr& json_header_matcher) { - envoy::api::v2::HeaderMatcher header_matcher; + envoy::api::v2::route::HeaderMatcher header_matcher; translateHeaderMatcher(*json_header_matcher, header_matcher); return header_matcher; }); @@ -88,7 +89,7 @@ void RdsJson::translateRateLimit(const Json::Object& json_rate_limit, } void RdsJson::translateHeaderMatcher(const Json::Object& json_header_matcher, - envoy::api::v2::HeaderMatcher& header_matcher) { + envoy::api::v2::route::HeaderMatcher& header_matcher) { json_header_matcher.validateSchema(Json::Schema::HEADER_DATA_CONFIGURATION_SCHEMA); JSON_UTIL_SET_STRING(json_header_matcher, header_matcher, name); JSON_UTIL_SET_STRING(json_header_matcher, header_matcher, value); @@ -97,7 +98,7 @@ void RdsJson::translateHeaderMatcher(const Json::Object& json_header_matcher, void RdsJson::translateQueryParameterMatcher( const Json::Object& json_query_parameter_matcher, - envoy::api::v2::QueryParameterMatcher& query_parameter_matcher) { + envoy::api::v2::route::QueryParameterMatcher& query_parameter_matcher) { json_query_parameter_matcher.validateSchema(Json::Schema::QUERY_PARAMETER_CONFIGURATION_SCHEMA); JSON_UTIL_SET_STRING(json_query_parameter_matcher, query_parameter_matcher, name); JSON_UTIL_SET_STRING(json_query_parameter_matcher, query_parameter_matcher, value); @@ -138,7 +139,7 @@ void RdsJson::translateRouteConfiguration(const Json::Object& json_route_config, } void RdsJson::translateVirtualHost(const Json::Object& json_virtual_host, - envoy::api::v2::VirtualHost& virtual_host) { + envoy::api::v2::route::VirtualHost& virtual_host) { json_virtual_host.validateSchema(Json::Schema::VIRTUAL_HOST_CONFIGURATION_SCHEMA); const std::string name = json_virtual_host.getString("name", ""); @@ -154,8 +155,8 @@ void RdsJson::translateVirtualHost(const Json::Object& json_virtual_host, translateRoute(*json_route, *route); } - envoy::api::v2::VirtualHost::TlsRequirementType tls_requirement{}; - envoy::api::v2::VirtualHost::TlsRequirementType_Parse( + envoy::api::v2::route::VirtualHost::TlsRequirementType tls_requirement{}; + envoy::api::v2::route::VirtualHost::TlsRequirementType_Parse( StringUtil::toUpper(json_virtual_host.getString("require_ssl", "")), &tls_requirement); virtual_host.set_require_tls(tls_requirement); @@ -183,13 +184,13 @@ void RdsJson::translateVirtualHost(const Json::Object& json_virtual_host, } void RdsJson::translateDecorator(const Json::Object& json_decorator, - envoy::api::v2::Decorator& decorator) { + envoy::api::v2::route::Decorator& decorator) { if (json_decorator.hasObject("operation")) { decorator.set_operation(json_decorator.getString("operation")); } } -void RdsJson::translateRoute(const Json::Object& json_route, envoy::api::v2::Route& route) { +void RdsJson::translateRoute(const Json::Object& json_route, envoy::api::v2::route::Route& route) { json_route.validateSchema(Json::Schema::ROUTE_ENTRY_CONFIGURATION_SCHEMA); auto* match = route.mutable_match(); diff --git a/source/common/config/rds_json.h b/source/common/config/rds_json.h index 60ba7f6d98de3..dba4c8b5b6188 100644 --- a/source/common/config/rds_json.h +++ b/source/common/config/rds_json.h @@ -1,61 +1,62 @@ #pragma once +#include "envoy/api/v2/rds.pb.h" +#include "envoy/api/v2/route/route.pb.h" #include "envoy/json/json_object.h" -#include "api/rds.pb.h" - namespace Envoy { namespace Config { class RdsJson { public: /** - * Translate a v1 JSON weighted clusters object to v2 envoy::api::v2::WeightedCluster. + * Translate a v1 JSON weighted clusters object to v2 envoy::api::v2::route::WeightedCluster. * @param json_weighted_clusters source v1 JSON weighted clusters object. - * @param weighted_cluster destination v2 envoy::api::v2::WeightedCluster. + * @param weighted_cluster destination v2 envoy::api::v2::route::WeightedCluster. */ static void translateWeightedCluster(const Json::Object& json_weighted_clusters, - envoy::api::v2::WeightedCluster& weighted_cluster); + envoy::api::v2::route::WeightedCluster& weighted_cluster); /** - * Translate a v1 JSON virtual cluster object to v2 envoy::api::v2::VirtualCluster. + * Translate a v1 JSON virtual cluster object to v2 envoy::api::v2::route::VirtualCluster. * @param json_virtual_cluster source v1 JSON virtual cluster object. - * @param virtual_cluster destination v2 envoy::api::v2::VirtualCluster. + * @param virtual_cluster destination v2 envoy::api::v2::route::VirtualCluster. */ static void translateVirtualCluster(const Json::Object& json_virtual_cluster, - envoy::api::v2::VirtualCluster& virtual_cluster); + envoy::api::v2::route::VirtualCluster& virtual_cluster); /** - * Translate a v1 JSON cors object to v2 envoy::api::v2::CorsPolicy. + * Translate a v1 JSON cors object to v2 envoy::api::v2::route::CorsPolicy. * @param json_cors source v1 JSON cors object. - * @param cors destination v2 envoy::api::v2::CorsPolicy. + * @param cors destination v2 envoy::api::v2::route::CorsPolicy. */ - static void translateCors(const Json::Object& json_cors, envoy::api::v2::CorsPolicy& cors); + static void translateCors(const Json::Object& json_cors, envoy::api::v2::route::CorsPolicy& cors); /** - * Translate a v1 JSON rate limit object to v2 envoy::api::v2::RateLimit. + * Translate a v1 JSON rate limit object to v2 envoy::api::v2::route::RateLimit. * @param json_rate_limit source v1 JSON rate limit object. - * @param rate_limit destination v2 envoy::api::v2::RateLimit. + * @param rate_limit destination v2 envoy::api::v2::route::RateLimit. */ static void translateRateLimit(const Json::Object& json_rate_limit, - envoy::api::v2::RateLimit& rate_limit); + envoy::api::v2::route::RateLimit& rate_limit); /** - * Translate a v1 JSON header matcher object to v2 envoy::api::v2::HeaderMatcher. + * Translate a v1 JSON header matcher object to v2 envoy::api::v2::route::HeaderMatcher. * @param json_header_matcher source v1 JSON header matcher object. - * @param header_matcher destination v2 envoy::api::v2::HeaderMatcher. + * @param header_matcher destination v2 envoy::api::v2::route::HeaderMatcher. */ static void translateHeaderMatcher(const Json::Object& json_header_matcher, - envoy::api::v2::HeaderMatcher& header_matcher); + envoy::api::v2::route::HeaderMatcher& header_matcher); /** - * Translate a v1 JSON query parameter matcher object to v2 envoy::api::v2::QueryParameterMatcher. + * Translate a v1 JSON query parameter matcher object to v2 + * envoy::api::v2::route::QueryParameterMatcher. * @param json_query_parameter_matcher source v1 JSON query parameter matcher object. - * @param query_parameter_matcher destination v2 envoy::api::v2::QueryParameterMatcher. + * @param query_parameter_matcher destination v2 envoy::api::v2::route::QueryParameterMatcher. */ - static void - translateQueryParameterMatcher(const Json::Object& json_query_parameter_matcher, - envoy::api::v2::QueryParameterMatcher& query_parameter_matcher); + static void translateQueryParameterMatcher( + const Json::Object& json_query_parameter_matcher, + envoy::api::v2::route::QueryParameterMatcher& query_parameter_matcher); /** * Translate a v1 JSON route configuration object to v2 envoy::api::v2::RouteConfiguration. @@ -66,27 +67,27 @@ class RdsJson { envoy::api::v2::RouteConfiguration& route_config); /** - * Translate a v1 JSON virtual host object to v2 envoy::api::v2::VirtualHost. + * Translate a v1 JSON virtual host object to v2 envoy::api::v2::route::VirtualHost. * @param json_virtual_host source v1 JSON virtual host object. - * @param virtual_host destination v2 envoy::api::v2::VirtualHost. + * @param virtual_host destination v2 envoy::api::v2::route::VirtualHost. */ static void translateVirtualHost(const Json::Object& json_virtual_host, - envoy::api::v2::VirtualHost& virtual_host); + envoy::api::v2::route::VirtualHost& virtual_host); /** - * Translate a v1 JSON decorator object to v2 envoy::api::v2::Decorator. + * Translate a v1 JSON decorator object to v2 envoy::api::v2::route::Decorator. * @param json_decorator source v1 JSON decorator object. - * @param decorator destination v2 envoy::api::v2::Decorator. + * @param decorator destination v2 envoy::api::v2::route::Decorator. */ static void translateDecorator(const Json::Object& json_decorator, - envoy::api::v2::Decorator& decorator); + envoy::api::v2::route::Decorator& decorator); /** - * Translate a v1 JSON route object to v2 envoy::api::v2::Route. + * Translate a v1 JSON route object to v2 envoy::api::v2::route::Route. * @param json_route source v1 JSON route object. - * @param route destination v2 envoy::api::v2::Route. + * @param route destination v2 envoy::api::v2::route::Route. */ - static void translateRoute(const Json::Object& json_route, envoy::api::v2::Route& route); + static void translateRoute(const Json::Object& json_route, envoy::api::v2::route::Route& route); }; } // namespace Config diff --git a/source/common/config/subscription_factory.h b/source/common/config/subscription_factory.h index 7b7d2d05cd916..a376f1e13cea8 100644 --- a/source/common/config/subscription_factory.h +++ b/source/common/config/subscription_factory.h @@ -2,6 +2,7 @@ #include +#include "envoy/api/v2/base.pb.h" #include "envoy/config/subscription.h" #include "envoy/upstream/cluster_manager.h" @@ -13,8 +14,6 @@ #include "common/filesystem/filesystem_impl.h" #include "common/protobuf/protobuf.h" -#include "api/base.pb.h" - namespace Envoy { namespace Config { diff --git a/source/common/config/tls_context_json.cc b/source/common/config/tls_context_json.cc index 1c106056a93cc..ac64997e74f55 100644 --- a/source/common/config/tls_context_json.cc +++ b/source/common/config/tls_context_json.cc @@ -1,17 +1,17 @@ #include "common/config/tls_context_json.h" +#include "envoy/api/v2/auth/cert.pb.validate.h" + #include "common/common/utility.h" #include "common/config/json_utility.h" #include "common/protobuf/utility.h" -#include "api/sds.pb.validate.h" - namespace Envoy { namespace Config { void TlsContextJson::translateDownstreamTlsContext( const Json::Object& json_tls_context, - envoy::api::v2::DownstreamTlsContext& downstream_tls_context) { + envoy::api::v2::auth::DownstreamTlsContext& downstream_tls_context) { translateCommonTlsContext(json_tls_context, *downstream_tls_context.mutable_common_tls_context()); JSON_UTIL_SET_BOOL(json_tls_context, downstream_tls_context, require_client_certificate); @@ -25,14 +25,15 @@ void TlsContextJson::translateDownstreamTlsContext( void TlsContextJson::translateUpstreamTlsContext( const Json::Object& json_tls_context, - envoy::api::v2::UpstreamTlsContext& upstream_tls_context) { + envoy::api::v2::auth::UpstreamTlsContext& upstream_tls_context) { translateCommonTlsContext(json_tls_context, *upstream_tls_context.mutable_common_tls_context()); upstream_tls_context.set_sni(json_tls_context.getString("sni", "")); MessageUtil::validate(upstream_tls_context); } void TlsContextJson::translateCommonTlsContext( - const Json::Object& json_tls_context, envoy::api::v2::CommonTlsContext& common_tls_context) { + const Json::Object& json_tls_context, + envoy::api::v2::auth::CommonTlsContext& common_tls_context) { const std::string alpn_protocols_str{json_tls_context.getString("alpn_protocols", "")}; for (auto alpn_protocol : StringUtil::splitToken(alpn_protocols_str, ",")) { common_tls_context.add_alpn_protocols(std::string{alpn_protocol}); @@ -70,8 +71,8 @@ void TlsContextJson::translateCommonTlsContext( } } -void TlsContextJson::translateTlsCertificate(const Json::Object& json_tls_context, - envoy::api::v2::TlsCertificate& tls_certificate) { +void TlsContextJson::translateTlsCertificate( + const Json::Object& json_tls_context, envoy::api::v2::auth::TlsCertificate& tls_certificate) { if (json_tls_context.hasObject("cert_chain_file")) { tls_certificate.mutable_certificate_chain()->set_filename( json_tls_context.getString("cert_chain_file", "")); diff --git a/source/common/config/tls_context_json.h b/source/common/config/tls_context_json.h index 0b7a90d42098d..53a1a14afe75d 100644 --- a/source/common/config/tls_context_json.h +++ b/source/common/config/tls_context_json.h @@ -1,45 +1,45 @@ #pragma once +#include "envoy/api/v2/auth/cert.pb.h" #include "envoy/json/json_object.h" -#include "api/sds.pb.h" - namespace Envoy { namespace Config { class TlsContextJson { public: /** - * Translate a v1 JSON TLS context to v2 envoy::api::v2::DownstreamTlsContext. + * Translate a v1 JSON TLS context to v2 envoy::api::v2::auth::DownstreamTlsContext. * @param json_tls_context source v1 JSON TLS context object. * @param downstream_tls_context destination v2 envoy::api::v2::Cluster. */ static void translateDownstreamTlsContext(const Json::Object& json_tls_context, - envoy::api::v2::DownstreamTlsContext& downstream_tls_context); + envoy::api::v2::auth::DownstreamTlsContext& downstream_tls_context); /** - * Translate a v1 JSON TLS context to v2 envoy::api::v2::UpstreamTlsContext. + * Translate a v1 JSON TLS context to v2 envoy::api::v2::auth::UpstreamTlsContext. * @param json_tls_context source v1 JSON TLS context object. * @param upstream_tls_context destination v2 envoy::api::v2::Cluster. */ - static void translateUpstreamTlsContext(const Json::Object& json_tls_context, - envoy::api::v2::UpstreamTlsContext& upstream_tls_context); + static void + translateUpstreamTlsContext(const Json::Object& json_tls_context, + envoy::api::v2::auth::UpstreamTlsContext& upstream_tls_context); /** - * Translate a v1 JSON TLS context to v2 envoy::api::v2::CommonTlsContext. + * Translate a v1 JSON TLS context to v2 envoy::api::v2::auth::CommonTlsContext. * @param json_tls_context source v1 JSON TLS context object. * @param common_tls_context destination v2 envoy::api::v2::Cluster. */ static void translateCommonTlsContext(const Json::Object& json_tls_context, - envoy::api::v2::CommonTlsContext& common_tls_context); + envoy::api::v2::auth::CommonTlsContext& common_tls_context); /** - * Translate a v1 JSON TLS context to v2 envoy::api::v2::TlsCertificate. + * Translate a v1 JSON TLS context to v2 envoy::api::v2::auth::TlsCertificate. * @param json_tls_context source v1 JSON TLS context object. - * @param common_tls_context destination v2 envoy::api::v2::TlsCertificate. + * @param common_tls_context destination v2 envoy::api::v2::auth::TlsCertificate. */ static void translateTlsCertificate(const Json::Object& json_tls_context, - envoy::api::v2::TlsCertificate& tls_certificate); + envoy::api::v2::auth::TlsCertificate& tls_certificate); }; } // namespace Config diff --git a/source/common/config/utility.cc b/source/common/config/utility.cc index 06a9e9102bf8f..4d9d97cdd3a7c 100644 --- a/source/common/config/utility.cc +++ b/source/common/config/utility.cc @@ -2,6 +2,8 @@ #include +#include "envoy/config/metrics/v2/stats.pb.h" + #include "common/common/assert.h" #include "common/common/hex.h" #include "common/common/utility.h" @@ -14,7 +16,6 @@ #include "common/protobuf/utility.h" #include "common/stats/stats_impl.h" -#include "api/stats.pb.h" #include "fmt/format.h" namespace Envoy { @@ -164,7 +165,8 @@ std::string Utility::resourceName(const ProtobufWkt::Any& resource) { fmt::format("Unknown type URL {} in DiscoveryResponse", resource.type_url())); } -Stats::TagProducerPtr Utility::createTagProducer(const envoy::api::v2::Bootstrap& bootstrap) { +Stats::TagProducerPtr +Utility::createTagProducer(const envoy::config::bootstrap::v2::Bootstrap& bootstrap) { return std::make_unique(bootstrap.stats_config()); } diff --git a/source/common/config/utility.h b/source/common/config/utility.h index a8e3c843cf152..2d72a49c80f43 100644 --- a/source/common/config/utility.h +++ b/source/common/config/utility.h @@ -1,5 +1,12 @@ #pragma once +#include "envoy/api/v2/base.pb.h" +#include "envoy/api/v2/cds.pb.h" +#include "envoy/api/v2/eds.pb.h" +#include "envoy/api/v2/filter/network/http_connection_manager.pb.h" +#include "envoy/api/v2/lds.pb.h" +#include "envoy/api/v2/route/route.pb.h" +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" #include "envoy/config/grpc_mux.h" #include "envoy/config/subscription.h" #include "envoy/json/json_object.h" @@ -16,14 +23,6 @@ #include "common/protobuf/utility.h" #include "common/singleton/const_singleton.h" -#include "api/base.pb.h" -#include "api/bootstrap.pb.h" -#include "api/cds.pb.h" -#include "api/eds.pb.h" -#include "api/filter/network/http_connection_manager.pb.h" -#include "api/lds.pb.h" -#include "api/rds.pb.h" - namespace Envoy { namespace Config { @@ -236,7 +235,8 @@ class Utility { * @param bootstrap bootstrap proto. * @throws EnvoyException when the conflict of tag names is found. */ - static Stats::TagProducerPtr createTagProducer(const envoy::api::v2::Bootstrap& bootstrap); + static Stats::TagProducerPtr + createTagProducer(const envoy::config::bootstrap::v2::Bootstrap& bootstrap); /** * Check user supplied name in RDS/CDS/LDS for sanity. diff --git a/source/common/filter/BUILD b/source/common/filter/BUILD index f1eddee693ad9..db6ca897aef4a 100644 --- a/source/common/filter/BUILD +++ b/source/common/filter/BUILD @@ -25,7 +25,6 @@ envoy_cc_library( name = "ratelimit_lib", srcs = ["ratelimit.cc"], hdrs = ["ratelimit.h"], - external_deps = ["envoy_filter_network_rate_limit"], deps = [ "//include/envoy/network:connection_interface", "//include/envoy/network:filter_interface", @@ -33,6 +32,7 @@ envoy_cc_library( "//include/envoy/runtime:runtime_interface", "//include/envoy/stats:stats_macros", "//source/common/tracing:http_tracer_lib", + "@envoy_api//envoy/api/v2/filter/network:rate_limit_cc", ], ) @@ -40,9 +40,6 @@ envoy_cc_library( name = "tcp_proxy_lib", srcs = ["tcp_proxy.cc"], hdrs = ["tcp_proxy.h"], - external_deps = [ - "envoy_filter_network_tcp_proxy", - ], deps = [ "//include/envoy/access_log:access_log_interface", "//include/envoy/buffer:buffer_interface", @@ -65,5 +62,6 @@ envoy_cc_library( "//source/common/network:filter_lib", "//source/common/network:utility_lib", "//source/common/request_info:request_info_lib", + "@envoy_api//envoy/api/v2/filter/network:tcp_proxy_cc", ], ) diff --git a/source/common/filter/auth/BUILD b/source/common/filter/auth/BUILD index efc1aa64c0736..a691c2ecd8f0f 100644 --- a/source/common/filter/auth/BUILD +++ b/source/common/filter/auth/BUILD @@ -12,7 +12,6 @@ envoy_cc_library( name = "client_ssl_lib", srcs = ["client_ssl.cc"], hdrs = ["client_ssl.h"], - external_deps = ["envoy_filter_network_client_ssl_auth"], deps = [ "//include/envoy/network:connection_interface", "//include/envoy/network:filter_interface", @@ -30,5 +29,6 @@ envoy_cc_library( "//source/common/json:json_loader_lib", "//source/common/network:cidr_range_lib", "//source/common/network:utility_lib", + "@envoy_api//envoy/api/v2/filter/network:client_ssl_auth_cc", ], ) diff --git a/source/common/filter/auth/client_ssl.h b/source/common/filter/auth/client_ssl.h index 4fe5ec5d5c8c7..870151682f913 100644 --- a/source/common/filter/auth/client_ssl.h +++ b/source/common/filter/auth/client_ssl.h @@ -5,6 +5,7 @@ #include #include +#include "envoy/api/v2/filter/network/client_ssl_auth.pb.h" #include "envoy/network/filter.h" #include "envoy/runtime/runtime.h" #include "envoy/stats/stats_macros.h" @@ -16,8 +17,6 @@ #include "common/network/utility.h" #include "common/protobuf/utility.h" -#include "api/filter/network/client_ssl_auth.pb.h" - namespace Envoy { namespace Filter { namespace Auth { diff --git a/source/common/filter/ratelimit.h b/source/common/filter/ratelimit.h index b94c0774ed284..61a12b161c37c 100644 --- a/source/common/filter/ratelimit.h +++ b/source/common/filter/ratelimit.h @@ -5,14 +5,13 @@ #include #include +#include "envoy/api/v2/filter/network/rate_limit.pb.h" #include "envoy/network/connection.h" #include "envoy/network/filter.h" #include "envoy/ratelimit/ratelimit.h" #include "envoy/runtime/runtime.h" #include "envoy/stats/stats_macros.h" -#include "api/filter/network/rate_limit.pb.h" - namespace Envoy { namespace RateLimit { namespace TcpFilter { diff --git a/source/common/filter/tcp_proxy.cc b/source/common/filter/tcp_proxy.cc index 6c0674bba976e..7237d5de61c22 100644 --- a/source/common/filter/tcp_proxy.cc +++ b/source/common/filter/tcp_proxy.cc @@ -3,6 +3,7 @@ #include #include +#include "envoy/api/v2/filter/network/http_connection_manager.pb.h" #include "envoy/buffer/buffer.h" #include "envoy/event/dispatcher.h" #include "envoy/event/timer.h" @@ -14,7 +15,6 @@ #include "common/common/assert.h" #include "common/common/empty_string.h" -#include "api/filter/network/http_connection_manager.pb.h" #include "fmt/format.h" namespace Envoy { diff --git a/source/common/filter/tcp_proxy.h b/source/common/filter/tcp_proxy.h index 1c4cdc108107d..15452eaeee4cc 100644 --- a/source/common/filter/tcp_proxy.h +++ b/source/common/filter/tcp_proxy.h @@ -7,6 +7,7 @@ #include #include "envoy/access_log/access_log.h" +#include "envoy/api/v2/filter/network/tcp_proxy.pb.h" #include "envoy/event/timer.h" #include "envoy/network/connection.h" #include "envoy/network/filter.h" @@ -22,8 +23,6 @@ #include "common/network/utility.h" #include "common/request_info/request_info_impl.h" -#include "api/filter/network/tcp_proxy.pb.h" - namespace Envoy { namespace Filter { diff --git a/source/common/grpc/BUILD b/source/common/grpc/BUILD index bb0ccae947856..ff1455cacc5c4 100644 --- a/source/common/grpc/BUILD +++ b/source/common/grpc/BUILD @@ -93,8 +93,6 @@ envoy_cc_library( external_deps = [ "path_matcher", "grpc_transcoding", - "http_api_protos", - "envoy_filter_http_transcoder", ], deps = [ ":codec_lib", @@ -104,6 +102,8 @@ envoy_cc_library( "//source/common/common:base64_lib", "//source/common/http:headers_lib", "//source/common/protobuf", + "@envoy_api//envoy/api/v2/filter/http:transcoder_cc", + "@googleapis//:http_api_protos", ], ) diff --git a/source/common/grpc/json_transcoder_filter.h b/source/common/grpc/json_transcoder_filter.h index f57319c218fe2..4f442bf800c13 100644 --- a/source/common/grpc/json_transcoder_filter.h +++ b/source/common/grpc/json_transcoder_filter.h @@ -1,5 +1,6 @@ #pragma once +#include "envoy/api/v2/filter/http/transcoder.pb.h" #include "envoy/buffer/buffer.h" #include "envoy/http/filter.h" #include "envoy/http/header_map.h" @@ -9,7 +10,6 @@ #include "common/grpc/transcoder_input_stream_impl.h" #include "common/protobuf/protobuf.h" -#include "api/filter/http/transcoder.pb.h" #include "grpc_transcoding/path_matcher.h" #include "grpc_transcoding/request_message_translator.h" #include "grpc_transcoding/transcoder.h" diff --git a/source/common/http/BUILD b/source/common/http/BUILD index 98099c2e7b5e8..f31fa177f25ba 100644 --- a/source/common/http/BUILD +++ b/source/common/http/BUILD @@ -227,7 +227,6 @@ envoy_cc_library( hdrs = ["utility.h"], external_deps = [ "abseil_strings", - "envoy_protocol", ], deps = [ ":exception_lib", @@ -244,6 +243,7 @@ envoy_cc_library( "//source/common/json:json_loader_lib", "//source/common/network:utility_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2:protocol_cc", ], ) diff --git a/source/common/http/filter/BUILD b/source/common/http/filter/BUILD index e2a49655eaa8e..5c1bc333b0b0c 100644 --- a/source/common/http/filter/BUILD +++ b/source/common/http/filter/BUILD @@ -48,7 +48,6 @@ envoy_cc_library( name = "fault_filter_lib", srcs = ["fault_filter.cc"], hdrs = ["fault_filter.h"], - external_deps = ["envoy_filter_http_fault"], deps = [ "//include/envoy/event:timer_interface", "//include/envoy/http:codes_interface", @@ -64,6 +63,7 @@ envoy_cc_library( "//source/common/http:headers_lib", "//source/common/protobuf:utility_lib", "//source/common/router:config_lib", + "@envoy_api//envoy/api/v2/filter/http:fault_cc", ], ) @@ -84,7 +84,6 @@ envoy_cc_library( name = "squash_filter_lib", srcs = ["squash_filter.cc"], hdrs = ["squash_filter.h"], - external_deps = ["envoy_filter_http_squash"], deps = [ "//include/envoy/event:timer_interface", "//include/envoy/http:codes_interface", @@ -97,6 +96,7 @@ envoy_cc_library( "//source/common/http:message_lib", "//source/common/http:utility_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2/filter/http:squash_cc", ], ) @@ -117,7 +117,6 @@ envoy_cc_library( envoy_cc_library( name = "ratelimit_includes", hdrs = ["ratelimit.h"], - external_deps = ["envoy_filter_http_rate_limit"], deps = [ "//include/envoy/http:filter_interface", "//include/envoy/local_info:local_info_interface", @@ -129,5 +128,6 @@ envoy_cc_library( "//source/common/json:config_schemas_lib", "//source/common/json:json_loader_lib", "//source/common/json:json_validator_lib", + "@envoy_api//envoy/api/v2/filter/http:rate_limit_cc", ], ) diff --git a/source/common/http/filter/fault_filter.h b/source/common/http/filter/fault_filter.h index 7ea43a9ed970d..5f7841b628e5a 100644 --- a/source/common/http/filter/fault_filter.h +++ b/source/common/http/filter/fault_filter.h @@ -6,15 +6,14 @@ #include #include +#include "envoy/api/v2/filter/http/fault.pb.h" +#include "envoy/api/v2/route/route.pb.h" #include "envoy/http/filter.h" #include "envoy/runtime/runtime.h" #include "envoy/stats/stats_macros.h" #include "common/router/config_impl.h" -#include "api/filter/http/fault.pb.h" -#include "api/rds.pb.h" - namespace Envoy { namespace Http { diff --git a/source/common/http/filter/ratelimit.h b/source/common/http/filter/ratelimit.h index 870209e007996..585219fca32c4 100644 --- a/source/common/http/filter/ratelimit.h +++ b/source/common/http/filter/ratelimit.h @@ -5,6 +5,7 @@ #include #include +#include "envoy/api/v2/filter/http/rate_limit.pb.h" #include "envoy/http/filter.h" #include "envoy/local_info/local_info.h" #include "envoy/ratelimit/ratelimit.h" @@ -14,8 +15,6 @@ #include "common/common/assert.h" #include "common/http/header_map_impl.h" -#include "api/filter/http/rate_limit.pb.h" - namespace Envoy { namespace Http { namespace RateLimit { diff --git a/source/common/http/filter/squash_filter.h b/source/common/http/filter/squash_filter.h index 0f4f8a9d8e18f..a924e6d952089 100644 --- a/source/common/http/filter/squash_filter.h +++ b/source/common/http/filter/squash_filter.h @@ -4,6 +4,7 @@ #include #include +#include "envoy/api/v2/filter/http/squash.pb.h" #include "envoy/common/optional.h" #include "envoy/http/async_client.h" #include "envoy/http/filter.h" @@ -12,8 +13,6 @@ #include "common/common/logger.h" #include "common/protobuf/protobuf.h" -#include "api/filter/http/squash.pb.h" - namespace Envoy { namespace Http { diff --git a/source/common/http/utility.h b/source/common/http/utility.h index 7747e538cd0be..323a37e61cd7b 100644 --- a/source/common/http/utility.h +++ b/source/common/http/utility.h @@ -4,13 +4,12 @@ #include #include +#include "envoy/api/v2/protocol.pb.h" #include "envoy/http/codes.h" #include "envoy/http/filter.h" #include "common/json/json_loader.h" -#include "api/protocol.pb.h" - namespace Envoy { namespace Http { diff --git a/source/common/mongo/BUILD b/source/common/mongo/BUILD index 670461d571c9c..e8754e8c6f1a6 100644 --- a/source/common/mongo/BUILD +++ b/source/common/mongo/BUILD @@ -40,7 +40,6 @@ envoy_cc_library( name = "proxy_lib", srcs = ["proxy.cc"], hdrs = ["proxy.h"], - external_deps = ["envoy_filter_network_mongo_proxy"], deps = [ ":codec_lib", ":utility_lib", @@ -61,6 +60,7 @@ envoy_cc_library( "//source/common/network:filter_lib", "//source/common/protobuf:utility_lib", "//source/common/singleton:const_singleton", + "@envoy_api//envoy/api/v2/filter/network:mongo_proxy_cc", ], ) diff --git a/source/common/mongo/proxy.h b/source/common/mongo/proxy.h index 78103b71b5b2a..b54f0f253376d 100644 --- a/source/common/mongo/proxy.h +++ b/source/common/mongo/proxy.h @@ -7,6 +7,7 @@ #include #include "envoy/access_log/access_log.h" +#include "envoy/api/v2/filter/network/mongo_proxy.pb.h" #include "envoy/common/time.h" #include "envoy/event/timer.h" #include "envoy/mongo/codec.h" @@ -24,8 +25,6 @@ #include "common/protobuf/utility.h" #include "common/singleton/const_singleton.h" -#include "api/filter/network/mongo_proxy.pb.h" - namespace Envoy { namespace Mongo { diff --git a/source/common/network/BUILD b/source/common/network/BUILD index 607a3b248b255..542bb82022fab 100644 --- a/source/common/network/BUILD +++ b/source/common/network/BUILD @@ -23,9 +23,6 @@ envoy_cc_library( name = "cidr_range_lib", srcs = ["cidr_range.cc"], hdrs = ["cidr_range.h"], - external_deps = [ - "envoy_address", - ], deps = [ ":address_lib", ":utility_lib", @@ -33,6 +30,7 @@ envoy_cc_library( "//include/envoy/network:address_interface", "//source/common/common:assert_lib", "//source/common/common:utility_lib", + "@envoy_api//envoy/api/v2:address_cc", ], ) @@ -136,13 +134,13 @@ envoy_cc_library( name = "raw_buffer_socket_lib", srcs = ["raw_buffer_socket.cc"], hdrs = ["raw_buffer_socket.h"], - external_deps = ["envoy_base"], deps = [ ":utility_lib", "//include/envoy/network:transport_socket_interface", "//source/common/buffer:buffer_lib", "//source/common/common:empty_string", "//source/common/http:headers_lib", + "@envoy_api//envoy/api/v2:base_cc", ], ) @@ -150,7 +148,6 @@ envoy_cc_library( name = "resolver_lib", srcs = ["resolver_impl.cc"], hdrs = ["resolver_impl.h"], - external_deps = ["envoy_base"], deps = [ ":utility_lib", "//include/envoy/network:address_interface", @@ -159,6 +156,7 @@ envoy_cc_library( "//source/common/config:well_known_names", "//source/common/network:address_lib", "//source/common/protobuf", + "@envoy_api//envoy/api/v2:base_cc", ], ) @@ -168,7 +166,6 @@ envoy_cc_library( hdrs = ["utility.h"], external_deps = [ "abseil_strings", - "envoy_base", ], deps = [ ":address_lib", @@ -177,5 +174,6 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/common:utility_lib", "//source/common/protobuf", + "@envoy_api//envoy/api/v2:base_cc", ], ) diff --git a/source/common/network/cidr_range.h b/source/common/network/cidr_range.h index eda1db444edff..cbc425fd16add 100644 --- a/source/common/network/cidr_range.h +++ b/source/common/network/cidr_range.h @@ -3,13 +3,12 @@ #include #include +#include "envoy/api/v2/address.pb.h" #include "envoy/json/json_object.h" #include "envoy/network/address.h" #include "common/protobuf/protobuf.h" -#include "api/address.pb.h" - namespace Envoy { namespace Network { namespace Address { diff --git a/source/common/network/resolver_impl.cc b/source/common/network/resolver_impl.cc index eef0dc4ba3c0a..77b45c2d06ecb 100644 --- a/source/common/network/resolver_impl.cc +++ b/source/common/network/resolver_impl.cc @@ -1,5 +1,6 @@ #include "common/network/resolver_impl.h" +#include "envoy/api/v2/address.pb.h" #include "envoy/common/exception.h" #include "envoy/network/address.h" #include "envoy/network/resolver.h" @@ -9,8 +10,6 @@ #include "common/network/address_impl.h" #include "common/network/utility.h" -#include "api/address.pb.h" - namespace Envoy { namespace Network { namespace Address { diff --git a/source/common/network/resolver_impl.h b/source/common/network/resolver_impl.h index 30af33cb5a1c3..6f3fd0ff3b36f 100644 --- a/source/common/network/resolver_impl.h +++ b/source/common/network/resolver_impl.h @@ -1,13 +1,12 @@ #pragma once +#include "envoy/api/v2/address.pb.h" #include "envoy/network/address.h" #include "envoy/network/connection.h" #include "envoy/network/resolver.h" #include "common/network/address_impl.h" -#include "api/address.pb.h" - namespace Envoy { namespace Network { namespace Address { diff --git a/source/common/network/utility.h b/source/common/network/utility.h index 6a82d7d6cabe1..16c58530617e5 100644 --- a/source/common/network/utility.h +++ b/source/common/network/utility.h @@ -4,11 +4,11 @@ #include #include +#include "envoy/api/v2/address.pb.h" #include "envoy/network/connection.h" #include "envoy/stats/stats.h" #include "absl/strings/string_view.h" -#include "api/address.pb.h" namespace Envoy { namespace Network { diff --git a/source/common/ratelimit/BUILD b/source/common/ratelimit/BUILD index fcc70e9fd3bf3..df6c04c90c277 100644 --- a/source/common/ratelimit/BUILD +++ b/source/common/ratelimit/BUILD @@ -13,7 +13,6 @@ envoy_cc_library( name = "ratelimit_lib", srcs = ["ratelimit_impl.cc"], hdrs = ["ratelimit_impl.h"], - external_deps = ["envoy_bootstrap"], deps = [ ":ratelimit_proto", "//include/envoy/grpc:async_client_interface", @@ -23,6 +22,7 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/http:headers_lib", "//source/common/tracing:http_tracer_lib", + "@envoy_api//envoy/config/ratelimit/v2:rls_cc", ], ) diff --git a/source/common/ratelimit/ratelimit_impl.cc b/source/common/ratelimit/ratelimit_impl.cc index 70070d373143b..ae31ab9bae1c7 100644 --- a/source/common/ratelimit/ratelimit_impl.cc +++ b/source/common/ratelimit/ratelimit_impl.cc @@ -75,13 +75,14 @@ void GrpcClientImpl::onFailure(Grpc::Status::GrpcStatus status, const std::strin callbacks_ = nullptr; } -GrpcFactoryImpl::GrpcFactoryImpl(const envoy::api::v2::RateLimitServiceConfig& config, +GrpcFactoryImpl::GrpcFactoryImpl(const envoy::config::ratelimit::v2::RateLimitServiceConfig& config, Grpc::AsyncClientManager& async_client_manager, Stats::Scope& scope) { envoy::api::v2::GrpcService grpc_service; grpc_service.MergeFrom(config.grpc_service()); // TODO(htuch): cluster_name is deprecated, remove after 1.6.0. - if (config.service_specifier_case() == envoy::api::v2::RateLimitServiceConfig::kClusterName) { + if (config.service_specifier_case() == + envoy::config::ratelimit::v2::RateLimitServiceConfig::kClusterName) { grpc_service.mutable_envoy_grpc()->set_cluster_name(config.cluster_name()); } async_client_factory_ = async_client_manager.factoryForGrpcService(grpc_service, scope); diff --git a/source/common/ratelimit/ratelimit_impl.h b/source/common/ratelimit/ratelimit_impl.h index 97a6a36d37123..7d000b6d3293b 100644 --- a/source/common/ratelimit/ratelimit_impl.h +++ b/source/common/ratelimit/ratelimit_impl.h @@ -5,6 +5,7 @@ #include #include +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" #include "envoy/grpc/async_client.h" #include "envoy/grpc/async_client_manager.h" #include "envoy/ratelimit/ratelimit.h" @@ -15,8 +16,6 @@ #include "source/common/ratelimit/ratelimit.pb.h" -#include "api/bootstrap.pb.h" - namespace Envoy { namespace RateLimit { @@ -65,7 +64,7 @@ class GrpcClientImpl : public Client, public RateLimitAsyncCallbacks { class GrpcFactoryImpl : public ClientFactory { public: - GrpcFactoryImpl(const envoy::api::v2::RateLimitServiceConfig& config, + GrpcFactoryImpl(const envoy::config::ratelimit::v2::RateLimitServiceConfig& config, Grpc::AsyncClientManager& async_client_manager, Stats::Scope& scope); // RateLimit::ClientFactory diff --git a/source/common/redis/BUILD b/source/common/redis/BUILD index 8d9ad98ad9525..229efcb7763de 100644 --- a/source/common/redis/BUILD +++ b/source/common/redis/BUILD @@ -38,7 +38,6 @@ envoy_cc_library( name = "conn_pool_lib", srcs = ["conn_pool_impl.cc"], hdrs = ["conn_pool_impl.h"], - external_deps = ["envoy_filter_network_redis_proxy"], deps = [ ":codec_lib", "//include/envoy/redis:conn_pool_interface", @@ -49,6 +48,7 @@ envoy_cc_library( "//source/common/common:assert_lib", "//source/common/network:filter_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2/filter/network:redis_proxy_cc", ], ) @@ -56,7 +56,6 @@ envoy_cc_library( name = "proxy_filter_lib", srcs = ["proxy_filter.cc"], hdrs = ["proxy_filter.h"], - external_deps = ["envoy_filter_network_redis_proxy"], deps = [ "//include/envoy/network:drain_decision_interface", "//include/envoy/network:filter_interface", @@ -66,6 +65,7 @@ envoy_cc_library( "//source/common/buffer:buffer_lib", "//source/common/common:assert_lib", "//source/common/config:utility_lib", + "@envoy_api//envoy/api/v2/filter/network:redis_proxy_cc", ], ) diff --git a/source/common/redis/conn_pool_impl.h b/source/common/redis/conn_pool_impl.h index 6fbead0dd8834..e6543da2701a2 100644 --- a/source/common/redis/conn_pool_impl.h +++ b/source/common/redis/conn_pool_impl.h @@ -8,6 +8,7 @@ #include #include +#include "envoy/api/v2/filter/network/redis_proxy.pb.h" #include "envoy/redis/conn_pool.h" #include "envoy/thread_local/thread_local.h" #include "envoy/upstream/cluster_manager.h" @@ -17,8 +18,6 @@ #include "common/protobuf/utility.h" #include "common/redis/codec_impl.h" -#include "api/filter/network/redis_proxy.pb.h" - namespace Envoy { namespace Redis { namespace ConnPool { diff --git a/source/common/redis/proxy_filter.h b/source/common/redis/proxy_filter.h index a9b3f9e9f876e..7771fbad797fc 100644 --- a/source/common/redis/proxy_filter.h +++ b/source/common/redis/proxy_filter.h @@ -5,6 +5,7 @@ #include #include +#include "envoy/api/v2/filter/network/redis_proxy.pb.h" #include "envoy/network/drain_decision.h" #include "envoy/network/filter.h" #include "envoy/redis/codec.h" @@ -13,8 +14,6 @@ #include "common/buffer/buffer_impl.h" -#include "api/filter/network/redis_proxy.pb.h" - namespace Envoy { namespace Redis { diff --git a/source/common/router/BUILD b/source/common/router/BUILD index 927a062e794b4..3acd7b1809037 100644 --- a/source/common/router/BUILD +++ b/source/common/router/BUILD @@ -41,7 +41,6 @@ envoy_cc_library( name = "config_utility_lib", srcs = ["config_utility.cc"], hdrs = ["config_utility.h"], - external_deps = ["envoy_rds"], deps = [ "//include/envoy/http:codes_interface", "//include/envoy/upstream:resource_manager_interface", @@ -51,6 +50,7 @@ envoy_cc_library( "//source/common/filesystem:filesystem_lib", "//source/common/http:headers_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2:rds_cc", ], ) @@ -58,10 +58,6 @@ envoy_cc_library( name = "rds_lib", srcs = ["rds_impl.cc"], hdrs = ["rds_impl.h"], - external_deps = [ - "envoy_filter_network_http_connection_manager", - "envoy_rds", - ], deps = [ ":config_lib", ":rds_subscription_lib", @@ -80,6 +76,8 @@ envoy_cc_library( "//source/common/config:subscription_factory_lib", "//source/common/config:utility_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2:rds_cc", + "@envoy_api//envoy/api/v2/filter/network:http_connection_manager_cc", ], ) @@ -87,9 +85,6 @@ envoy_cc_library( name = "rds_subscription_lib", srcs = ["rds_subscription.cc"], hdrs = ["rds_subscription.h"], - external_deps = [ - "envoy_filter_network_http_connection_manager", - ], deps = [ "//include/envoy/config:subscription_interface", "//source/common/common:assert_lib", @@ -98,6 +93,7 @@ envoy_cc_library( "//source/common/http:headers_lib", "//source/common/http:rest_api_fetcher_lib", "//source/common/json:json_loader_lib", + "@envoy_api//envoy/api/v2/filter/network:http_connection_manager_cc", ], ) @@ -129,7 +125,6 @@ envoy_cc_library( name = "router_lib", srcs = ["router.cc"], hdrs = ["router.h"], - external_deps = ["envoy_filter_http_router"], deps = [ ":config_lib", ":header_parser_lib", @@ -167,6 +162,7 @@ envoy_cc_library( "//source/common/http:utility_lib", "//source/common/request_info:request_info_lib", "//source/common/tracing:http_tracer_lib", + "@envoy_api//envoy/api/v2/filter/http:router_cc", ], ) diff --git a/source/common/router/config_impl.cc b/source/common/router/config_impl.cc index 404bcf261738f..16a15fc7e8949 100644 --- a/source/common/router/config_impl.cc +++ b/source/common/router/config_impl.cc @@ -35,7 +35,7 @@ std::string SslRedirector::newPath(const Http::HeaderMap& headers) const { return Http::Utility::createSslRedirectPath(headers); } -RetryPolicyImpl::RetryPolicyImpl(const envoy::api::v2::RouteAction& config) { +RetryPolicyImpl::RetryPolicyImpl(const envoy::api::v2::route::RouteAction& config) { if (!config.has_retry_policy()) { return; } @@ -47,7 +47,7 @@ RetryPolicyImpl::RetryPolicyImpl(const envoy::api::v2::RouteAction& config) { retry_on_ |= RetryStateImpl::parseRetryGrpcOn(config.retry_policy().retry_on()); } -CorsPolicyImpl::CorsPolicyImpl(const envoy::api::v2::CorsPolicy& config) { +CorsPolicyImpl::CorsPolicyImpl(const envoy::api::v2::route::CorsPolicy& config) { for (const auto& origin : config.allow_origin()) { allow_origin_.push_back(origin); } @@ -61,7 +61,7 @@ CorsPolicyImpl::CorsPolicyImpl(const envoy::api::v2::CorsPolicy& config) { enabled_ = PROTOBUF_GET_WRAPPED_OR_DEFAULT(config, enabled, true); } -ShadowPolicyImpl::ShadowPolicyImpl(const envoy::api::v2::RouteAction& config) { +ShadowPolicyImpl::ShadowPolicyImpl(const envoy::api::v2::route::RouteAction& config) { if (!config.has_request_mirror_policy()) { return; } @@ -126,20 +126,21 @@ class IpHashMethod : public HashPolicyImpl::HashMethod { }; HashPolicyImpl::HashPolicyImpl( - const Protobuf::RepeatedPtrField& hash_policies) { + const Protobuf::RepeatedPtrField& + hash_policies) { // TODO(htuch): Add support for cookie hash policies, #1295 hash_impls_.reserve(hash_policies.size()); for (auto& hash_policy : hash_policies) { switch (hash_policy.policy_specifier_case()) { - case envoy::api::v2::RouteAction::HashPolicy::kHeader: + case envoy::api::v2::route::RouteAction::HashPolicy::kHeader: hash_impls_.emplace_back(new HeaderHashMethod(hash_policy.header().header_name())); break; - case envoy::api::v2::RouteAction::HashPolicy::kCookie: + case envoy::api::v2::route::RouteAction::HashPolicy::kCookie: hash_impls_.emplace_back( new CookieHashMethod(hash_policy.cookie().name(), hash_policy.cookie().ttl().seconds())); break; - case envoy::api::v2::RouteAction::HashPolicy::kConnectionProperties: + case envoy::api::v2::route::RouteAction::HashPolicy::kConnectionProperties: if (hash_policy.connection_properties().source_ip()) { hash_impls_.emplace_back(new IpHashMethod()); } @@ -204,7 +205,7 @@ MetadataMatchCriteriaImpl::extractMetadataMatchCriteria(const MetadataMatchCrite return v; } -DecoratorImpl::DecoratorImpl(const envoy::api::v2::Decorator& decorator) +DecoratorImpl::DecoratorImpl(const envoy::api::v2::route::Decorator& decorator) : operation_(decorator.operation()) {} void DecoratorImpl::apply(Tracing::Span& span) const { @@ -216,7 +217,8 @@ void DecoratorImpl::apply(Tracing::Span& span) const { const std::string& DecoratorImpl::getOperation() const { return operation_; } RouteEntryImplBase::RouteEntryImplBase(const VirtualHostImpl& vhost, - const envoy::api::v2::Route& route, Runtime::Loader& loader) + const envoy::api::v2::route::Route& route, + Runtime::Loader& loader) : case_sensitive_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(route.match(), case_sensitive, true)), prefix_rewrite_(route.route().prefix_rewrite()), host_rewrite_(route.route().host_rewrite()), vhost_(vhost), @@ -256,7 +258,8 @@ RouteEntryImplBase::RouteEntryImplBase(const VirtualHostImpl& vhost, // single cluster, pointing back to the parent. Metadata criteria // from the weighted cluster (if any) are merged with and override // the criteria from the route. - if (route.route().cluster_specifier_case() == envoy::api::v2::RouteAction::kWeightedClusters) { + if (route.route().cluster_specifier_case() == + envoy::api::v2::route::RouteAction::kWeightedClusters) { ASSERT(total_cluster_weight_ > 0); uint64_t total_weight = 0UL; @@ -357,7 +360,7 @@ void RouteEntryImplBase::finalizeResponseHeaders( } Optional -RouteEntryImplBase::loadRuntimeData(const envoy::api::v2::RouteMatch& route_match) { +RouteEntryImplBase::loadRuntimeData(const envoy::api::v2::route::RouteMatch& route_match) { Optional runtime; if (route_match.has_runtime()) { RuntimeData data; @@ -406,7 +409,7 @@ std::string RouteEntryImplBase::newPath(const Http::HeaderMap& headers) const { } std::multimap -RouteEntryImplBase::parseOpaqueConfig(const envoy::api::v2::Route& route) { +RouteEntryImplBase::parseOpaqueConfig(const envoy::api::v2::route::Route& route) { std::multimap ret; if (route.has_metadata()) { const auto filter_metadata = @@ -423,7 +426,7 @@ RouteEntryImplBase::parseOpaqueConfig(const envoy::api::v2::Route& route) { return ret; } -DecoratorConstPtr RouteEntryImplBase::parseDecorator(const envoy::api::v2::Route& route) { +DecoratorConstPtr RouteEntryImplBase::parseDecorator(const envoy::api::v2::route::Route& route) { DecoratorConstPtr ret; if (route.has_decorator()) { ret = DecoratorConstPtr(new DecoratorImpl(route.decorator())); @@ -519,7 +522,7 @@ void RouteEntryImplBase::validateClusters(Upstream::ClusterManager& cm) const { } PrefixRouteEntryImpl::PrefixRouteEntryImpl(const VirtualHostImpl& vhost, - const envoy::api::v2::Route& route, + const envoy::api::v2::route::Route& route, Runtime::Loader& loader) : RouteEntryImplBase(vhost, route, loader), prefix_(route.match().prefix()) {} @@ -540,7 +543,8 @@ RouteConstSharedPtr PrefixRouteEntryImpl::matches(const Http::HeaderMap& headers } PathRouteEntryImpl::PathRouteEntryImpl(const VirtualHostImpl& vhost, - const envoy::api::v2::Route& route, Runtime::Loader& loader) + const envoy::api::v2::route::Route& route, + Runtime::Loader& loader) : RouteEntryImplBase(vhost, route, loader), path_(route.match().path()) {} void PathRouteEntryImpl::finalizeRequestHeaders( @@ -579,7 +583,7 @@ RouteConstSharedPtr PathRouteEntryImpl::matches(const Http::HeaderMap& headers, } RegexRouteEntryImpl::RegexRouteEntryImpl(const VirtualHostImpl& vhost, - const envoy::api::v2::Route& route, + const envoy::api::v2::route::Route& route, Runtime::Loader& loader) : RouteEntryImplBase(vhost, route, loader), regex_(RegexUtil::parseRegex(route.match().regex().c_str())) {} @@ -607,7 +611,7 @@ RouteConstSharedPtr RegexRouteEntryImpl::matches(const Http::HeaderMap& headers, return nullptr; } -VirtualHostImpl::VirtualHostImpl(const envoy::api::v2::VirtualHost& virtual_host, +VirtualHostImpl::VirtualHostImpl(const envoy::api::v2::route::VirtualHost& virtual_host, const ConfigImpl& global_route_config, Runtime::Loader& runtime, Upstream::ClusterManager& cm, bool validate_clusters) : name_(virtual_host.name()), rate_limit_policy_(virtual_host.rate_limits()), @@ -616,13 +620,13 @@ VirtualHostImpl::VirtualHostImpl(const envoy::api::v2::VirtualHost& virtual_host response_headers_parser_(HeaderParser::configure(virtual_host.response_headers_to_add(), virtual_host.response_headers_to_remove())) { switch (virtual_host.require_tls()) { - case envoy::api::v2::VirtualHost::NONE: + case envoy::api::v2::route::VirtualHost::NONE: ssl_requirements_ = SslRequirements::NONE; break; - case envoy::api::v2::VirtualHost::EXTERNAL_ONLY: + case envoy::api::v2::route::VirtualHost::EXTERNAL_ONLY: ssl_requirements_ = SslRequirements::EXTERNAL_ONLY; break; - case envoy::api::v2::VirtualHost::ALL: + case envoy::api::v2::route::VirtualHost::ALL: ssl_requirements_ = SslRequirements::ALL; break; default: @@ -631,10 +635,11 @@ VirtualHostImpl::VirtualHostImpl(const envoy::api::v2::VirtualHost& virtual_host for (const auto& route : virtual_host.routes()) { const bool has_prefix = - route.match().path_specifier_case() == envoy::api::v2::RouteMatch::kPrefix; - const bool has_path = route.match().path_specifier_case() == envoy::api::v2::RouteMatch::kPath; + route.match().path_specifier_case() == envoy::api::v2::route::RouteMatch::kPrefix; + const bool has_path = + route.match().path_specifier_case() == envoy::api::v2::route::RouteMatch::kPath; const bool has_regex = - route.match().path_specifier_case() == envoy::api::v2::RouteMatch::kRegex; + route.match().path_specifier_case() == envoy::api::v2::route::RouteMatch::kRegex; if (has_prefix) { routes_.emplace_back(new PrefixRouteEntryImpl(*this, route, runtime)); } else if (has_path) { @@ -666,7 +671,7 @@ VirtualHostImpl::VirtualHostImpl(const envoy::api::v2::VirtualHost& virtual_host } VirtualHostImpl::VirtualClusterEntry::VirtualClusterEntry( - const envoy::api::v2::VirtualCluster& virtual_cluster) { + const envoy::api::v2::route::VirtualCluster& virtual_cluster) { if (virtual_cluster.method() != envoy::api::v2::RequestMethod::METHOD_UNSPECIFIED) { method_ = envoy::api::v2::RequestMethod_Name(virtual_cluster.method()); } diff --git a/source/common/router/config_impl.h b/source/common/router/config_impl.h index 9f5d3a0283556..765a2a507dd27 100644 --- a/source/common/router/config_impl.h +++ b/source/common/router/config_impl.h @@ -10,6 +10,8 @@ #include #include +#include "envoy/api/v2/rds.pb.h" +#include "envoy/api/v2/route/route.pb.h" #include "envoy/common/optional.h" #include "envoy/router/router.h" #include "envoy/runtime/runtime.h" @@ -20,8 +22,6 @@ #include "common/router/header_parser.h" #include "common/router/router_ratelimit.h" -#include "api/rds.pb.h" - namespace Envoy { namespace Router { @@ -73,7 +73,7 @@ class SslRedirectRoute : public Route { */ class CorsPolicyImpl : public CorsPolicy { public: - CorsPolicyImpl(const envoy::api::v2::CorsPolicy& config); + CorsPolicyImpl(const envoy::api::v2::route::CorsPolicy& config); // Router::CorsPolicy const std::list& allowOrigins() const override { return allow_origin_; }; @@ -100,7 +100,7 @@ class ConfigImpl; */ class VirtualHostImpl : public VirtualHost { public: - VirtualHostImpl(const envoy::api::v2::VirtualHost& virtual_host, + VirtualHostImpl(const envoy::api::v2::route::VirtualHost& virtual_host, const ConfigImpl& global_route_config, Runtime::Loader& runtime, Upstream::ClusterManager& cm, bool validate_clusters); @@ -120,7 +120,7 @@ class VirtualHostImpl : public VirtualHost { enum class SslRequirements { NONE, EXTERNAL_ONLY, ALL }; struct VirtualClusterEntry : public VirtualCluster { - VirtualClusterEntry(const envoy::api::v2::VirtualCluster& virtual_cluster); + VirtualClusterEntry(const envoy::api::v2::route::VirtualCluster& virtual_cluster); // Router::VirtualCluster const std::string& name() const override { return name_; } @@ -159,7 +159,7 @@ typedef std::shared_ptr VirtualHostSharedPtr; */ class RetryPolicyImpl : public RetryPolicy { public: - RetryPolicyImpl(const envoy::api::v2::RouteAction& config); + RetryPolicyImpl(const envoy::api::v2::route::RouteAction& config); // Router::RetryPolicy std::chrono::milliseconds perTryTimeout() const override { return per_try_timeout_; } @@ -177,7 +177,7 @@ class RetryPolicyImpl : public RetryPolicy { */ class ShadowPolicyImpl : public ShadowPolicy { public: - ShadowPolicyImpl(const envoy::api::v2::RouteAction& config); + ShadowPolicyImpl(const envoy::api::v2::route::RouteAction& config); // Router::ShadowPolicy const std::string& cluster() const override { return cluster_; } @@ -194,8 +194,8 @@ class ShadowPolicyImpl : public ShadowPolicy { */ class HashPolicyImpl : public HashPolicy { public: - HashPolicyImpl( - const Protobuf::RepeatedPtrField& hash_policy); + HashPolicyImpl(const Protobuf::RepeatedPtrField& + hash_policy); // Router::HashPolicy Optional generateHash(const std::string& downstream_addr, @@ -270,7 +270,7 @@ class MetadataMatchCriteriaImpl : public MetadataMatchCriteria { */ class DecoratorImpl : public Decorator { public: - DecoratorImpl(const envoy::api::v2::Decorator& decorator); + DecoratorImpl(const envoy::api::v2::route::Decorator& decorator); // Decorator::apply void apply(Tracing::Span& span) const override; @@ -294,7 +294,7 @@ class RouteEntryImplBase : public RouteEntry, /** * @throw EnvoyException with reason if the route configuration contains any errors */ - RouteEntryImplBase(const VirtualHostImpl& vhost, const envoy::api::v2::Route& route, + RouteEntryImplBase(const VirtualHostImpl& vhost, const envoy::api::v2::route::Route& route, Runtime::Loader& loader); bool isRedirect() const { return !host_redirect_.empty() || !path_redirect_.empty(); } @@ -454,12 +454,12 @@ class RouteEntryImplBase : public RouteEntry, typedef std::shared_ptr WeightedClusterEntrySharedPtr; - static Optional loadRuntimeData(const envoy::api::v2::RouteMatch& route); + static Optional loadRuntimeData(const envoy::api::v2::route::RouteMatch& route); static std::multimap - parseOpaqueConfig(const envoy::api::v2::Route& route); + parseOpaqueConfig(const envoy::api::v2::route::Route& route); - static DecoratorConstPtr parseDecorator(const envoy::api::v2::Route& route); + static DecoratorConstPtr parseDecorator(const envoy::api::v2::route::Route& route); // Default timeout is 15s if nothing is specified in the route config. static const uint64_t DEFAULT_ROUTE_TIMEOUT_MS = 15000; @@ -504,7 +504,7 @@ class RouteEntryImplBase : public RouteEntry, */ class PrefixRouteEntryImpl : public RouteEntryImplBase { public: - PrefixRouteEntryImpl(const VirtualHostImpl& vhost, const envoy::api::v2::Route& route, + PrefixRouteEntryImpl(const VirtualHostImpl& vhost, const envoy::api::v2::route::Route& route, Runtime::Loader& loader); // Router::RouteEntry @@ -523,7 +523,7 @@ class PrefixRouteEntryImpl : public RouteEntryImplBase { */ class PathRouteEntryImpl : public RouteEntryImplBase { public: - PathRouteEntryImpl(const VirtualHostImpl& vhost, const envoy::api::v2::Route& route, + PathRouteEntryImpl(const VirtualHostImpl& vhost, const envoy::api::v2::route::Route& route, Runtime::Loader& loader); // Router::RouteEntry @@ -542,7 +542,7 @@ class PathRouteEntryImpl : public RouteEntryImplBase { */ class RegexRouteEntryImpl : public RouteEntryImplBase { public: - RegexRouteEntryImpl(const VirtualHostImpl& vhost, const envoy::api::v2::Route& route, + RegexRouteEntryImpl(const VirtualHostImpl& vhost, const envoy::api::v2::route::Route& route, Runtime::Loader& loader); // Router::RouteEntry diff --git a/source/common/router/config_utility.cc b/source/common/router/config_utility.cc index fb40ed27d9430..b722faa5e907e 100644 --- a/source/common/router/config_utility.cc +++ b/source/common/router/config_utility.cc @@ -73,24 +73,25 @@ bool ConfigUtility::matchQueryParams( } Http::Code ConfigUtility::parseRedirectResponseCode( - const envoy::api::v2::RedirectAction::RedirectResponseCode& code) { + const envoy::api::v2::route::RedirectAction::RedirectResponseCode& code) { switch (code) { - case envoy::api::v2::RedirectAction::MOVED_PERMANENTLY: + case envoy::api::v2::route::RedirectAction::MOVED_PERMANENTLY: return Http::Code::MovedPermanently; - case envoy::api::v2::RedirectAction::FOUND: + case envoy::api::v2::route::RedirectAction::FOUND: return Http::Code::Found; - case envoy::api::v2::RedirectAction::SEE_OTHER: + case envoy::api::v2::route::RedirectAction::SEE_OTHER: return Http::Code::SeeOther; - case envoy::api::v2::RedirectAction::TEMPORARY_REDIRECT: + case envoy::api::v2::route::RedirectAction::TEMPORARY_REDIRECT: return Http::Code::TemporaryRedirect; - case envoy::api::v2::RedirectAction::PERMANENT_REDIRECT: + case envoy::api::v2::route::RedirectAction::PERMANENT_REDIRECT: return Http::Code::PermanentRedirect; default: NOT_IMPLEMENTED; } } -Optional ConfigUtility::parseDirectResponseCode(const envoy::api::v2::Route& route) { +Optional +ConfigUtility::parseDirectResponseCode(const envoy::api::v2::route::Route& route) { if (route.has_redirect()) { return parseRedirectResponseCode(route.redirect().response_code()); } else if (route.has_direct_response()) { @@ -99,7 +100,7 @@ Optional ConfigUtility::parseDirectResponseCode(const envoy::api::v2 return Optional(); } -std::string ConfigUtility::parseDirectResponseBody(const envoy::api::v2::Route& route) { +std::string ConfigUtility::parseDirectResponseBody(const envoy::api::v2::route::Route& route) { if (!route.has_direct_response() || !route.direct_response().has_body()) { return EMPTY_STRING; } @@ -128,11 +129,11 @@ std::string ConfigUtility::parseDirectResponseBody(const envoy::api::v2::Route& } Http::Code ConfigUtility::parseClusterNotFoundResponseCode( - const envoy::api::v2::RouteAction::ClusterNotFoundResponseCode& code) { + const envoy::api::v2::route::RouteAction::ClusterNotFoundResponseCode& code) { switch (code) { - case envoy::api::v2::RouteAction::SERVICE_UNAVAILABLE: + case envoy::api::v2::route::RouteAction::SERVICE_UNAVAILABLE: return Http::Code::ServiceUnavailable; - case envoy::api::v2::RouteAction::NOT_FOUND: + case envoy::api::v2::route::RouteAction::NOT_FOUND: return Http::Code::NotFound; default: NOT_IMPLEMENTED; diff --git a/source/common/router/config_utility.h b/source/common/router/config_utility.h index e6cf9edd97f5c..f1f8f4b5c9658 100644 --- a/source/common/router/config_utility.h +++ b/source/common/router/config_utility.h @@ -4,6 +4,7 @@ #include #include +#include "envoy/api/v2/route/route.pb.h" #include "envoy/common/optional.h" #include "envoy/http/codes.h" #include "envoy/json/json_object.h" @@ -16,8 +17,6 @@ #include "common/http/utility.h" #include "common/protobuf/utility.h" -#include "api/rds.pb.h" - namespace Envoy { namespace Router { @@ -30,13 +29,13 @@ class ConfigUtility { // An empty header value allows for matching to be only based on header presence. // Regex is an opt-in. Unless explicitly mentioned, the header values will be used for // exact string matching. - HeaderData(const envoy::api::v2::HeaderMatcher& config) + HeaderData(const envoy::api::v2::route::HeaderMatcher& config) : name_(config.name()), value_(config.value()), is_regex_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(config, regex, false)), regex_pattern_(is_regex_ ? RegexUtil::parseRegex(value_) : std::regex()) {} HeaderData(const Json::Object& config) : HeaderData([&config] { - envoy::api::v2::HeaderMatcher header_matcher; + envoy::api::v2::route::HeaderMatcher header_matcher; Envoy::Config::RdsJson::translateHeaderMatcher(config, header_matcher); return header_matcher; }()) {} @@ -52,7 +51,7 @@ class ConfigUtility { // equivalent of the QueryParameterMatcher proto in the RDS v2 API. class QueryParameterMatcher { public: - QueryParameterMatcher(const envoy::api::v2::QueryParameterMatcher& config) + QueryParameterMatcher(const envoy::api::v2::route::QueryParameterMatcher& config) : name_(config.name()), value_(config.value()), is_regex_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(config, regex, false)), regex_pattern_(is_regex_ ? RegexUtil::parseRegex(value_) : std::regex()) {} @@ -102,8 +101,8 @@ class ConfigUtility { * @param code supplies the RedirectResponseCode enum. * @return Returns the Http::Code version of the RedirectResponseCode. */ - static Http::Code - parseRedirectResponseCode(const envoy::api::v2::RedirectAction::RedirectResponseCode& code); + static Http::Code parseRedirectResponseCode( + const envoy::api::v2::route::RedirectAction::RedirectResponseCode& code); /** * Returns the HTTP Status Code enum parsed from the route's redirect or direct_response. @@ -112,7 +111,7 @@ class ConfigUtility { * or the HTTP status code from the route's redirect if specified, * or an empty Option otherwise. */ - static Optional parseDirectResponseCode(const envoy::api::v2::Route& route); + static Optional parseDirectResponseCode(const envoy::api::v2::route::Route& route); /** * Returns the content of the response body to send with direct responses from a route. @@ -122,7 +121,7 @@ class ConfigUtility { * route's direct_response if specified, or an empty string otherwise. * @throw EnvoyException if the route configuration contains an error. */ - static std::string parseDirectResponseBody(const envoy::api::v2::Route& route); + static std::string parseDirectResponseBody(const envoy::api::v2::route::Route& route); /** * Returns the HTTP Status Code enum parsed from proto. @@ -130,7 +129,7 @@ class ConfigUtility { * @return Returns the Http::Code version of the ClusterNotFoundResponseCode enum. */ static Http::Code parseClusterNotFoundResponseCode( - const envoy::api::v2::RouteAction::ClusterNotFoundResponseCode& code); + const envoy::api::v2::route::RouteAction::ClusterNotFoundResponseCode& code); }; } // namespace Router diff --git a/source/common/router/header_parser.h b/source/common/router/header_parser.h index 3985696e2f40f..90cbbbcb6bb56 100644 --- a/source/common/router/header_parser.h +++ b/source/common/router/header_parser.h @@ -4,13 +4,12 @@ #include #include "envoy/access_log/access_log.h" +#include "envoy/api/v2/base.pb.h" #include "envoy/http/header_map.h" #include "common/protobuf/protobuf.h" #include "common/router/header_formatter.h" -#include "api/base.pb.h" - namespace Envoy { namespace Router { diff --git a/source/common/router/rds_impl.cc b/source/common/router/rds_impl.cc index da2c99383de5e..c631ea8a39334 100644 --- a/source/common/router/rds_impl.cc +++ b/source/common/router/rds_impl.cc @@ -5,6 +5,9 @@ #include #include +#include "envoy/api/v2/rds.pb.validate.h" +#include "envoy/api/v2/route/route.pb.validate.h" + #include "common/common/assert.h" #include "common/config/rds_json.h" #include "common/config/subscription_factory.h" @@ -13,7 +16,6 @@ #include "common/router/config_impl.h" #include "common/router/rds_subscription.h" -#include "api/rds.pb.validate.h" #include "fmt/format.h" namespace Envoy { @@ -55,6 +57,7 @@ RdsRouteConfigProviderImpl::RdsRouteConfigProviderImpl( route_config_provider_manager_(route_config_provider_manager), manager_identifier_(manager_identifier) { ::Envoy::Config::Utility::checkLocalInfo("rds", local_info); + ConfigConstSharedPtr initial_config(new NullConfigImpl()); tls_->set([initial_config](Event::Dispatcher&) -> ThreadLocal::ThreadLocalObjectSharedPtr { return std::make_shared(initial_config); diff --git a/source/common/router/rds_impl.h b/source/common/router/rds_impl.h index 11143a2e75110..02084ba5d81a1 100644 --- a/source/common/router/rds_impl.h +++ b/source/common/router/rds_impl.h @@ -5,6 +5,9 @@ #include #include +#include "envoy/api/v2/filter/network/http_connection_manager.pb.h" +#include "envoy/api/v2/rds.pb.h" +#include "envoy/api/v2/route/route.pb.h" #include "envoy/config/subscription.h" #include "envoy/http/codes.h" #include "envoy/init/init.h" @@ -18,9 +21,6 @@ #include "common/common/logger.h" #include "common/protobuf/utility.h" -#include "api/filter/network/http_connection_manager.pb.h" -#include "api/rds.pb.h" - namespace Envoy { namespace Router { diff --git a/source/common/router/rds_subscription.h b/source/common/router/rds_subscription.h index 531d0cec89461..c11b26e624a2f 100644 --- a/source/common/router/rds_subscription.h +++ b/source/common/router/rds_subscription.h @@ -3,13 +3,12 @@ #include #include +#include "envoy/api/v2/filter/network/http_connection_manager.pb.h" #include "envoy/config/subscription.h" #include "common/common/assert.h" #include "common/http/rest_api_fetcher.h" -#include "api/filter/network/http_connection_manager.pb.h" - namespace Envoy { namespace Router { diff --git a/source/common/router/router.h b/source/common/router/router.h index bda04e9923c57..8a7baec703f76 100644 --- a/source/common/router/router.h +++ b/source/common/router/router.h @@ -5,6 +5,7 @@ #include #include +#include "envoy/api/v2/filter/http/router.pb.h" #include "envoy/http/codec.h" #include "envoy/http/codes.h" #include "envoy/http/filter.h" @@ -23,8 +24,6 @@ #include "common/http/utility.h" #include "common/request_info/request_info_impl.h" -#include "api/filter/http/router.pb.h" - namespace Envoy { namespace Router { diff --git a/source/common/router/router_ratelimit.cc b/source/common/router/router_ratelimit.cc index aa8cc23f72d0d..96810f5bf51d9 100644 --- a/source/common/router/router_ratelimit.cc +++ b/source/common/router/router_ratelimit.cc @@ -64,7 +64,7 @@ bool GenericKeyAction::populateDescriptor(const Router::RouteEntry&, } HeaderValueMatchAction::HeaderValueMatchAction( - const envoy::api::v2::RateLimit::Action::HeaderValueMatch& action) + const envoy::api::v2::route::RateLimit::Action::HeaderValueMatch& action) : descriptor_value_(action.descriptor_value()), expect_match_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(action, expect_match, true)) { for (const auto& header_matcher : action.headers()) { @@ -84,27 +84,27 @@ bool HeaderValueMatchAction::populateDescriptor(const Router::RouteEntry&, } } -RateLimitPolicyEntryImpl::RateLimitPolicyEntryImpl(const envoy::api::v2::RateLimit& config) +RateLimitPolicyEntryImpl::RateLimitPolicyEntryImpl(const envoy::api::v2::route::RateLimit& config) : disable_key_(config.disable_key()), stage_(static_cast(PROTOBUF_GET_WRAPPED_OR_DEFAULT(config, stage, 0))) { for (const auto& action : config.actions()) { switch (action.action_specifier_case()) { - case envoy::api::v2::RateLimit::Action::kSourceCluster: + case envoy::api::v2::route::RateLimit::Action::kSourceCluster: actions_.emplace_back(new SourceClusterAction()); break; - case envoy::api::v2::RateLimit::Action::kDestinationCluster: + case envoy::api::v2::route::RateLimit::Action::kDestinationCluster: actions_.emplace_back(new DestinationClusterAction()); break; - case envoy::api::v2::RateLimit::Action::kRequestHeaders: + case envoy::api::v2::route::RateLimit::Action::kRequestHeaders: actions_.emplace_back(new RequestHeadersAction(action.request_headers())); break; - case envoy::api::v2::RateLimit::Action::kRemoteAddress: + case envoy::api::v2::route::RateLimit::Action::kRemoteAddress: actions_.emplace_back(new RemoteAddressAction()); break; - case envoy::api::v2::RateLimit::Action::kGenericKey: + case envoy::api::v2::route::RateLimit::Action::kGenericKey: actions_.emplace_back(new GenericKeyAction(action.generic_key())); break; - case envoy::api::v2::RateLimit::Action::kHeaderValueMatch: + case envoy::api::v2::route::RateLimit::Action::kHeaderValueMatch: actions_.emplace_back(new HeaderValueMatchAction(action.header_value_match())); break; default: @@ -133,7 +133,7 @@ void RateLimitPolicyEntryImpl::populateDescriptors( } RateLimitPolicyImpl::RateLimitPolicyImpl( - const Protobuf::RepeatedPtrField& rate_limits) + const Protobuf::RepeatedPtrField& rate_limits) : rate_limit_entries_reference_(RateLimitPolicyImpl::MAX_STAGE_NUMBER + 1) { for (const auto& rate_limit : rate_limits) { std::unique_ptr rate_limit_policy_entry( diff --git a/source/common/router/router_ratelimit.h b/source/common/router/router_ratelimit.h index 6e70e81504618..a14443dbbd8cb 100644 --- a/source/common/router/router_ratelimit.h +++ b/source/common/router/router_ratelimit.h @@ -42,7 +42,7 @@ class DestinationClusterAction : public RateLimitAction { */ class RequestHeadersAction : public RateLimitAction { public: - RequestHeadersAction(const envoy::api::v2::RateLimit::Action::RequestHeaders& action) + RequestHeadersAction(const envoy::api::v2::route::RateLimit::Action::RequestHeaders& action) : header_name_(action.header_name()), descriptor_key_(action.descriptor_key()) {} // Router::RateLimitAction @@ -71,7 +71,7 @@ class RemoteAddressAction : public RateLimitAction { */ class GenericKeyAction : public RateLimitAction { public: - GenericKeyAction(const envoy::api::v2::RateLimit::Action::GenericKey& action) + GenericKeyAction(const envoy::api::v2::route::RateLimit::Action::GenericKey& action) : descriptor_value_(action.descriptor_value()) {} // Router::RateLimitAction @@ -88,7 +88,7 @@ class GenericKeyAction : public RateLimitAction { */ class HeaderValueMatchAction : public RateLimitAction { public: - HeaderValueMatchAction(const envoy::api::v2::RateLimit::Action::HeaderValueMatch& action); + HeaderValueMatchAction(const envoy::api::v2::route::RateLimit::Action::HeaderValueMatch& action); // Router::RateLimitAction bool populateDescriptor(const Router::RouteEntry& route, RateLimit::Descriptor& descriptor, @@ -106,7 +106,7 @@ class HeaderValueMatchAction : public RateLimitAction { */ class RateLimitPolicyEntryImpl : public RateLimitPolicyEntry { public: - RateLimitPolicyEntryImpl(const envoy::api::v2::RateLimit& config); + RateLimitPolicyEntryImpl(const envoy::api::v2::route::RateLimit& config); // Router::RateLimitPolicyEntry uint64_t stage() const override { return stage_; } @@ -127,7 +127,8 @@ class RateLimitPolicyEntryImpl : public RateLimitPolicyEntry { */ class RateLimitPolicyImpl : public RateLimitPolicy { public: - RateLimitPolicyImpl(const Protobuf::RepeatedPtrField& rate_limits); + RateLimitPolicyImpl( + const Protobuf::RepeatedPtrField& rate_limits); // Router::RateLimitPolicy const std::vector>& diff --git a/source/common/ssl/BUILD b/source/common/ssl/BUILD index e86e5940eae2d..6546bb6688b59 100644 --- a/source/common/ssl/BUILD +++ b/source/common/ssl/BUILD @@ -40,7 +40,6 @@ envoy_cc_library( srcs = ["context_config_impl.cc"], hdrs = ["context_config_impl.h"], external_deps = [ - "envoy_sds", "ssl", ], deps = [ @@ -49,6 +48,7 @@ envoy_cc_library( "//source/common/config:tls_context_json_lib", "//source/common/json:json_loader_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2/auth:cert_cc", ], ) diff --git a/source/common/ssl/context_config_impl.cc b/source/common/ssl/context_config_impl.cc index 666adc2771aa5..cc103341e24ca 100644 --- a/source/common/ssl/context_config_impl.cc +++ b/source/common/ssl/context_config_impl.cc @@ -34,7 +34,7 @@ const std::string ContextConfigImpl::DEFAULT_CIPHER_SUITES = const std::string ContextConfigImpl::DEFAULT_ECDH_CURVES = "X25519:P-256"; -ContextConfigImpl::ContextConfigImpl(const envoy::api::v2::CommonTlsContext& config) +ContextConfigImpl::ContextConfigImpl(const envoy::api::v2::auth::CommonTlsContext& config) : alpn_protocols_(RepeatedPtrUtil::join(config.alpn_protocols(), ",")), alt_alpn_protocols_(config.deprecated_v1().alt_alpn_protocols()), cipher_suites_(StringUtil::nonEmptyStringOrDefault( @@ -96,19 +96,18 @@ const std::string ContextConfigImpl::getDataSourcePath(const envoy::api::v2::Dat return source.specifier_case() == envoy::api::v2::DataSource::kFilename ? source.filename() : ""; } -unsigned -ContextConfigImpl::tlsVersionFromProto(const envoy::api::v2::TlsParameters_TlsProtocol& version, - unsigned default_version) { +unsigned ContextConfigImpl::tlsVersionFromProto( + const envoy::api::v2::auth::TlsParameters_TlsProtocol& version, unsigned default_version) { switch (version) { - case envoy::api::v2::TlsParameters::TLS_AUTO: + case envoy::api::v2::auth::TlsParameters::TLS_AUTO: return default_version; - case envoy::api::v2::TlsParameters::TLSv1_0: + case envoy::api::v2::auth::TlsParameters::TLSv1_0: return TLS1_VERSION; - case envoy::api::v2::TlsParameters::TLSv1_1: + case envoy::api::v2::auth::TlsParameters::TLSv1_1: return TLS1_1_VERSION; - case envoy::api::v2::TlsParameters::TLSv1_2: + case envoy::api::v2::auth::TlsParameters::TLSv1_2: return TLS1_2_VERSION; - case envoy::api::v2::TlsParameters::TLSv1_3: + case envoy::api::v2::auth::TlsParameters::TLSv1_3: return TLS1_3_VERSION; default: NOT_IMPLEMENTED; @@ -117,7 +116,8 @@ ContextConfigImpl::tlsVersionFromProto(const envoy::api::v2::TlsParameters_TlsPr NOT_REACHED; } -ClientContextConfigImpl::ClientContextConfigImpl(const envoy::api::v2::UpstreamTlsContext& config) +ClientContextConfigImpl::ClientContextConfigImpl( + const envoy::api::v2::auth::UpstreamTlsContext& config) : ContextConfigImpl(config.common_tls_context()), server_name_indication_(config.sni()) { // TODO(PiotrSikora): Support multiple TLS certificates. ASSERT(config.common_tls_context().tls_certificates().size() <= 1); @@ -125,12 +125,13 @@ ClientContextConfigImpl::ClientContextConfigImpl(const envoy::api::v2::UpstreamT ClientContextConfigImpl::ClientContextConfigImpl(const Json::Object& config) : ClientContextConfigImpl([&config] { - envoy::api::v2::UpstreamTlsContext upstream_tls_context; + envoy::api::v2::auth::UpstreamTlsContext upstream_tls_context; Config::TlsContextJson::translateUpstreamTlsContext(config, upstream_tls_context); return upstream_tls_context; }()) {} -ServerContextConfigImpl::ServerContextConfigImpl(const envoy::api::v2::DownstreamTlsContext& config) +ServerContextConfigImpl::ServerContextConfigImpl( + const envoy::api::v2::auth::DownstreamTlsContext& config) : ContextConfigImpl(config.common_tls_context()), require_client_certificate_( PROTOBUF_GET_WRAPPED_OR_DEFAULT(config, require_client_certificate, false)), @@ -138,15 +139,15 @@ ServerContextConfigImpl::ServerContextConfigImpl(const envoy::api::v2::Downstrea std::vector ret; switch (config.session_ticket_keys_type_case()) { - case envoy::api::v2::DownstreamTlsContext::kSessionTicketKeys: + case envoy::api::v2::auth::DownstreamTlsContext::kSessionTicketKeys: for (const auto& datasource : config.session_ticket_keys().keys()) { validateAndAppendKey(ret, readDataSource(datasource, false)); } break; - case envoy::api::v2::DownstreamTlsContext::kSessionTicketKeysSdsSecretConfig: + case envoy::api::v2::auth::DownstreamTlsContext::kSessionTicketKeysSdsSecretConfig: NOT_IMPLEMENTED; break; - case envoy::api::v2::DownstreamTlsContext::SESSION_TICKET_KEYS_TYPE_NOT_SET: + case envoy::api::v2::auth::DownstreamTlsContext::SESSION_TICKET_KEYS_TYPE_NOT_SET: break; default: throw EnvoyException(fmt::format("Unexpected case for oneof session_ticket_keys: {}", @@ -163,7 +164,7 @@ ServerContextConfigImpl::ServerContextConfigImpl(const envoy::api::v2::Downstrea ServerContextConfigImpl::ServerContextConfigImpl(const Json::Object& config) : ServerContextConfigImpl([&config] { - envoy::api::v2::DownstreamTlsContext downstream_tls_context; + envoy::api::v2::auth::DownstreamTlsContext downstream_tls_context; Config::TlsContextJson::translateDownstreamTlsContext(config, downstream_tls_context); return downstream_tls_context; }()) {} diff --git a/source/common/ssl/context_config_impl.h b/source/common/ssl/context_config_impl.h index f213b387503bc..b0b8308ecbed7 100644 --- a/source/common/ssl/context_config_impl.h +++ b/source/common/ssl/context_config_impl.h @@ -3,12 +3,11 @@ #include #include +#include "envoy/api/v2/auth/cert.pb.h" #include "envoy/ssl/context_config.h" #include "common/json/json_loader.h" -#include "api/sds.pb.h" - namespace Envoy { namespace Ssl { @@ -49,15 +48,16 @@ class ContextConfigImpl : public virtual Ssl::ContextConfig { unsigned maxProtocolVersion() const override { return max_protocol_version_; }; protected: - ContextConfigImpl(const envoy::api::v2::CommonTlsContext& config); + ContextConfigImpl(const envoy::api::v2::auth::CommonTlsContext& config); static const std::string readDataSource(const envoy::api::v2::DataSource& source, bool allow_empty); static const std::string getDataSourcePath(const envoy::api::v2::DataSource& source); private: - static unsigned tlsVersionFromProto(const envoy::api::v2::TlsParameters_TlsProtocol& version, - unsigned default_version); + static unsigned + tlsVersionFromProto(const envoy::api::v2::auth::TlsParameters_TlsProtocol& version, + unsigned default_version); static const std::string DEFAULT_CIPHER_SUITES; static const std::string DEFAULT_ECDH_CURVES; @@ -82,7 +82,7 @@ class ContextConfigImpl : public virtual Ssl::ContextConfig { class ClientContextConfigImpl : public ContextConfigImpl, public ClientContextConfig { public: - explicit ClientContextConfigImpl(const envoy::api::v2::UpstreamTlsContext& config); + explicit ClientContextConfigImpl(const envoy::api::v2::auth::UpstreamTlsContext& config); explicit ClientContextConfigImpl(const Json::Object& config); // Ssl::ClientContextConfig @@ -94,7 +94,7 @@ class ClientContextConfigImpl : public ContextConfigImpl, public ClientContextCo class ServerContextConfigImpl : public ContextConfigImpl, public ServerContextConfig { public: - explicit ServerContextConfigImpl(const envoy::api::v2::DownstreamTlsContext& config); + explicit ServerContextConfigImpl(const envoy::api::v2::auth::DownstreamTlsContext& config); explicit ServerContextConfigImpl(const Json::Object& config); // Ssl::ServerContextConfig diff --git a/source/common/stats/BUILD b/source/common/stats/BUILD index 3a9511b4e77e8..5b1ad32e6fe58 100644 --- a/source/common/stats/BUILD +++ b/source/common/stats/BUILD @@ -14,7 +14,6 @@ envoy_cc_library( hdrs = ["stats_impl.h"], external_deps = [ "abseil_strings", - "envoy_stats", ], deps = [ "//include/envoy/common:time_interface", @@ -26,6 +25,7 @@ envoy_cc_library( "//source/common/config:well_known_names", "//source/common/protobuf", "//source/common/singleton:const_singleton", + "@envoy_api//envoy/config/metrics/v2:stats_cc", ], ) @@ -51,7 +51,6 @@ envoy_cc_library( name = "metrics_service_grpc_lib", srcs = ["grpc_metrics_service_impl.cc"], hdrs = ["grpc_metrics_service_impl.h"], - external_deps = ["envoy_metrics"], deps = [ "//include/envoy/grpc:async_client_interface", "//include/envoy/local_info:local_info_interface", @@ -60,6 +59,7 @@ envoy_cc_library( "//include/envoy/upstream:cluster_manager_interface", "//source/common/common:assert_lib", "//source/common/grpc:async_client_lib", + "@envoy_api//envoy/service/metrics/v2:metrics_service_cc", ], ) diff --git a/source/common/stats/grpc_metrics_service_impl.cc b/source/common/stats/grpc_metrics_service_impl.cc index e8f0bc86f5447..b408a85f9708a 100644 --- a/source/common/stats/grpc_metrics_service_impl.cc +++ b/source/common/stats/grpc_metrics_service_impl.cc @@ -42,7 +42,7 @@ GrpcMetricsStreamerImpl::ThreadLocalStreamer::ThreadLocalStreamer( : client_(shared_state->factory_->create()), shared_state_(shared_state) {} void GrpcMetricsStreamerImpl::ThreadLocalStreamer::send( - envoy::api::v2::StreamMetricsMessage& message) { + envoy::service::metrics::v2::StreamMetricsMessage& message) { if (thread_local_stream_ == nullptr) { thread_local_stream_ = std::make_shared(*this); } @@ -50,7 +50,7 @@ void GrpcMetricsStreamerImpl::ThreadLocalStreamer::send( if (thread_local_stream_->stream_ == nullptr) { thread_local_stream_->stream_ = client_->start(*Protobuf::DescriptorPool::generated_pool()->FindMethodByName( - "envoy.api.v2.MetricsService.StreamMetrics"), + "envoy.service.metrics.v2.MetricsService.StreamMetrics"), *thread_local_stream_); auto* identifier = message.mutable_identifier(); *identifier->mutable_node() = shared_state_->local_info_.node(); diff --git a/source/common/stats/grpc_metrics_service_impl.h b/source/common/stats/grpc_metrics_service_impl.h index 4cf823030933e..47c1b524559f6 100644 --- a/source/common/stats/grpc_metrics_service_impl.h +++ b/source/common/stats/grpc_metrics_service_impl.h @@ -7,6 +7,8 @@ #include "envoy/grpc/async_client.h" #include "envoy/local_info/local_info.h" #include "envoy/network/connection.h" +#include "envoy/service/metrics/v2/metrics_service.pb.h" +#include "envoy/service/metrics/v2/metrics_service.pb.validate.h" #include "envoy/singleton/instance.h" #include "envoy/stats/stats.h" #include "envoy/thread_local/thread_local.h" @@ -14,9 +16,6 @@ #include "common/buffer/buffer_impl.h" -#include "api/metrics_service.pb.h" -#include "api/metrics_service.pb.validate.h" - namespace Envoy { namespace Stats { namespace Metrics { @@ -35,7 +34,7 @@ class GrpcMetricsStreamer { * Send Metrics Message. * @param message supplies the metrics to send. */ - virtual void send(envoy::api::v2::StreamMetricsMessage& message) PURE; + virtual void send(envoy::service::metrics::v2::StreamMetricsMessage& message) PURE; }; typedef std::shared_ptr GrpcMetricsStreamerSharedPtr; @@ -50,7 +49,7 @@ class GrpcMetricsStreamerImpl : public Singleton::Instance, public GrpcMetricsSt const LocalInfo::LocalInfo& local_info); // GrpcMetricsStreamer - void send(envoy::api::v2::StreamMetricsMessage& message) override { + void send(envoy::service::metrics::v2::StreamMetricsMessage& message) override { tls_slot_->getTyped().send(message); } @@ -75,13 +74,14 @@ class GrpcMetricsStreamerImpl : public Singleton::Instance, public GrpcMetricsSt * Per-thread stream state. */ struct ThreadLocalStream - : public Grpc::TypedAsyncStreamCallbacks { + : public Grpc::TypedAsyncStreamCallbacks { ThreadLocalStream(ThreadLocalStreamer& parent) : parent_(parent) {} // Grpc::TypedAsyncStreamCallbacks void onCreateInitialMetadata(Http::HeaderMap&) override {} void onReceiveInitialMetadata(Http::HeaderMapPtr&&) override {} - void onReceiveMessage(std::unique_ptr&&) override {} + void onReceiveMessage( + std::unique_ptr&&) override {} void onReceiveTrailingMetadata(Http::HeaderMapPtr&&) override {} void onRemoteClose(Grpc::Status::GrpcStatus status, const std::string& message) override; @@ -96,7 +96,7 @@ class GrpcMetricsStreamerImpl : public Singleton::Instance, public GrpcMetricsSt */ struct ThreadLocalStreamer : public ThreadLocal::ThreadLocalObject { ThreadLocalStreamer(const SharedStateSharedPtr& shared_state); - void send(envoy::api::v2::StreamMetricsMessage& message); + void send(envoy::service::metrics::v2::StreamMetricsMessage& message); Grpc::AsyncClientPtr client_; ThreadLocalStreamSharedPtr thread_local_stream_ = nullptr; @@ -145,7 +145,7 @@ class MetricsServiceSink : public Sink { private: GrpcMetricsStreamerSharedPtr grpc_metrics_streamer_; - envoy::api::v2::StreamMetricsMessage message_; + envoy::service::metrics::v2::StreamMetricsMessage message_; }; } // namespace Metrics diff --git a/source/common/stats/stats_impl.cc b/source/common/stats/stats_impl.cc index fa2a4de0b80f4..59a56084b7857 100644 --- a/source/common/stats/stats_impl.cc +++ b/source/common/stats/stats_impl.cc @@ -122,7 +122,8 @@ RawStatData* HeapRawStatDataAllocator::alloc(const std::string& name) { return data; } -TagProducerImpl::TagProducerImpl(const envoy::api::v2::StatsConfig& config) : TagProducerImpl() { +TagProducerImpl::TagProducerImpl(const envoy::config::metrics::v2::StatsConfig& config) + : TagProducerImpl() { // To check name conflict. std::unordered_set names; reserveResources(config); @@ -134,12 +135,14 @@ TagProducerImpl::TagProducerImpl(const envoy::api::v2::StatsConfig& config) : Ta } // If no tag value is found, fallback to default regex to keep backward compatibility. - if (tag_specifier.tag_value_case() == envoy::api::v2::TagSpecifier::TAG_VALUE_NOT_SET || - tag_specifier.tag_value_case() == envoy::api::v2::TagSpecifier::kRegex) { + if (tag_specifier.tag_value_case() == + envoy::config::metrics::v2::TagSpecifier::TAG_VALUE_NOT_SET || + tag_specifier.tag_value_case() == envoy::config::metrics::v2::TagSpecifier::kRegex) { tag_extractors_.emplace_back(Stats::TagExtractorImpl::createTagExtractor( tag_specifier.tag_name(), tag_specifier.regex())); - } else if (tag_specifier.tag_value_case() == envoy::api::v2::TagSpecifier::kFixedValue) { + } else if (tag_specifier.tag_value_case() == + envoy::config::metrics::v2::TagSpecifier::kFixedValue) { default_tags_.emplace_back( Stats::Tag{.name_ = tag_specifier.tag_name(), .value_ = tag_specifier.fixed_value()}); } @@ -157,7 +160,7 @@ std::string TagProducerImpl::produceTags(const std::string& name, std::vector& names) { if (!config.has_use_all_default_tags() || config.use_all_default_tags().value()) { for (const auto& extractor : Config::TagNames::get().name_regex_pairs_) { diff --git a/source/common/stats/stats_impl.h b/source/common/stats/stats_impl.h index 905affdc32252..f4a7b01145256 100644 --- a/source/common/stats/stats_impl.h +++ b/source/common/stats/stats_impl.h @@ -12,6 +12,7 @@ #include #include "envoy/common/time.h" +#include "envoy/config/metrics/v2/stats.pb.h" #include "envoy/server/options.h" #include "envoy/stats/stats.h" @@ -20,7 +21,6 @@ #include "common/protobuf/protobuf.h" #include "absl/strings/string_view.h" -#include "api/stats.pb.h" namespace Envoy { namespace Stats { @@ -48,7 +48,7 @@ class TagExtractorImpl : public TagExtractor { class TagProducerImpl : public TagProducer { public: - TagProducerImpl(const envoy::api::v2::StatsConfig& config); + TagProducerImpl(const envoy::config::metrics::v2::StatsConfig& config); TagProducerImpl() {} /** @@ -60,8 +60,8 @@ class TagProducerImpl : public TagProducer { std::string produceTags(const std::string& metric_name, std::vector& tags) const override; private: - void reserveResources(const envoy::api::v2::StatsConfig& config); - void addDefaultExtractors(const envoy::api::v2::StatsConfig& config, + void reserveResources(const envoy::config::metrics::v2::StatsConfig& config); + void addDefaultExtractors(const envoy::config::metrics::v2::StatsConfig& config, std::unordered_set& names); std::vector tag_extractors_; diff --git a/source/common/upstream/BUILD b/source/common/upstream/BUILD index 2b9921d3d7518..7367a18bde1a1 100644 --- a/source/common/upstream/BUILD +++ b/source/common/upstream/BUILD @@ -13,7 +13,6 @@ envoy_cc_library( name = "cds_api_lib", srcs = ["cds_api_impl.cc"], hdrs = ["cds_api_impl.h"], - external_deps = ["envoy_cds"], deps = [ ":cds_subscription_lib", "//include/envoy/config:subscription_interface", @@ -25,6 +24,7 @@ envoy_cc_library( "//source/common/config:subscription_factory_lib", "//source/common/config:utility_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2:cds_cc", ], ) @@ -32,7 +32,6 @@ envoy_cc_library( name = "cds_subscription_lib", srcs = ["cds_subscription.cc"], hdrs = ["cds_subscription.h"], - external_deps = ["envoy_cds"], deps = [ "//include/envoy/config:subscription_interface", "//include/envoy/event:dispatcher_interface", @@ -46,6 +45,7 @@ envoy_cc_library( "//source/common/http:rest_api_fetcher_lib", "//source/common/json:config_schemas_lib", "//source/common/json:json_loader_lib", + "@envoy_api//envoy/api/v2:cds_cc", ], ) @@ -53,7 +53,6 @@ envoy_cc_library( name = "cluster_manager_lib", srcs = ["cluster_manager_impl.cc"], hdrs = ["cluster_manager_impl.h"], - external_deps = ["envoy_base"], deps = [ ":cds_api_lib", ":load_balancer_lib", @@ -83,6 +82,7 @@ envoy_cc_library( "//source/common/protobuf:utility_lib", "//source/common/router:shadow_writer_lib", "//source/common/upstream:upstream_lib", + "@envoy_api//envoy/api/v2:base_cc", ], ) @@ -91,7 +91,6 @@ envoy_cc_library( srcs = ["health_checker_impl.cc"], hdrs = ["health_checker_impl.h"], external_deps = [ - "envoy_health_check", "grpc_health_proto", ], deps = [ @@ -122,6 +121,7 @@ envoy_cc_library( "//source/common/network:filter_lib", "//source/common/protobuf:utility_lib", "//source/common/redis:conn_pool_lib", + "@envoy_api//envoy/api/v2:health_check_cc", ], ) @@ -149,13 +149,13 @@ envoy_cc_library( name = "load_stats_reporter_lib", srcs = ["load_stats_reporter.cc"], hdrs = ["load_stats_reporter.h"], - external_deps = ["envoy_eds"], deps = [ "//include/envoy/event:dispatcher_interface", "//include/envoy/stats:stats_macros", "//include/envoy/upstream:cluster_manager_interface", "//source/common/common:logger_lib", "//source/common/grpc:async_client_lib", + "@envoy_api//envoy/service/load_stats/v2:lrs_cc", ], ) @@ -191,7 +191,6 @@ envoy_cc_library( name = "outlier_detection_lib", srcs = ["outlier_detection_impl.cc"], hdrs = ["outlier_detection_impl.h"], - external_deps = ["envoy_cds"], deps = [ "//include/envoy/access_log:access_log_interface", "//include/envoy/event:dispatcher_interface", @@ -203,6 +202,7 @@ envoy_cc_library( "//source/common/common:utility_lib", "//source/common/http:codes_lib", "//source/common/protobuf", + "@envoy_api//envoy/api/v2:cds_cc", ], ) @@ -236,10 +236,6 @@ envoy_cc_library( name = "eds_lib", srcs = ["eds.cc"], hdrs = ["eds.h"], - external_deps = [ - "envoy_base", - "envoy_eds", - ], deps = [ ":sds_subscription_lib", ":upstream_includes", @@ -254,6 +250,9 @@ envoy_cc_library( "//source/common/network:resolver_lib", "//source/common/network:utility_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2:base_cc", + "@envoy_api//envoy/api/v2:eds_cc", + "@envoy_api//envoy/api/v2/endpoint:endpoint_cc", ], ) @@ -261,10 +260,6 @@ envoy_cc_library( name = "sds_subscription_lib", srcs = ["sds_subscription.cc"], hdrs = ["sds_subscription.h"], - external_deps = [ - "envoy_base", - "envoy_eds", - ], deps = [ "//include/envoy/config:subscription_interface", "//source/common/common:assert_lib", @@ -277,6 +272,9 @@ envoy_cc_library( "//source/common/json:json_loader_lib", "//source/common/protobuf", "//source/common/router:router_lib", + "@envoy_api//envoy/api/v2:base_cc", + "@envoy_api//envoy/api/v2:eds_cc", + "@envoy_api//envoy/api/v2/endpoint:endpoint_cc", ], ) @@ -302,7 +300,6 @@ envoy_cc_library( envoy_cc_library( name = "upstream_lib", srcs = ["upstream_impl.cc"], - external_deps = ["envoy_base"], deps = [ ":eds_lib", ":health_checker_lib", @@ -326,13 +323,13 @@ envoy_cc_library( "//source/common/protobuf:utility_lib", "//source/common/ssl:connection_lib", "//source/common/ssl:context_config_lib", + "@envoy_api//envoy/api/v2:base_cc", ], ) envoy_cc_library( name = "upstream_includes", hdrs = ["upstream_impl.h"], - external_deps = ["envoy_base"], deps = [ ":load_balancer_lib", ":outlier_detection_lib", @@ -354,5 +351,6 @@ envoy_cc_library( "//source/common/config:metadata_lib", "//source/common/config:well_known_names", "//source/common/stats:stats_lib", + "@envoy_api//envoy/api/v2:base_cc", ], ) diff --git a/source/common/upstream/cds_api_impl.cc b/source/common/upstream/cds_api_impl.cc index 40d17beab257c..a9d6e9c72daef 100644 --- a/source/common/upstream/cds_api_impl.cc +++ b/source/common/upstream/cds_api_impl.cc @@ -2,6 +2,9 @@ #include +#include "envoy/api/v2/cds.pb.validate.h" +#include "envoy/api/v2/cluster/outlier_detection.pb.validate.h" + #include "common/common/cleanup.h" #include "common/config/resources.h" #include "common/config/subscription_factory.h" @@ -9,8 +12,6 @@ #include "common/protobuf/utility.h" #include "common/upstream/cds_subscription.h" -#include "api/cds.pb.validate.h" - namespace Envoy { namespace Upstream { @@ -29,6 +30,7 @@ CdsApiImpl::CdsApiImpl(const envoy::api::v2::ConfigSource& cds_config, const LocalInfo::LocalInfo& local_info, Stats::Scope& scope) : cm_(cm), scope_(scope.createScope("cluster_manager.cds.")) { Config::Utility::checkLocalInfo("cds", local_info); + subscription_ = Config::SubscriptionFactory::subscriptionFromConfigSource( cds_config, local_info.node(), dispatcher, cm, random, *scope_, diff --git a/source/common/upstream/cds_api_impl.h b/source/common/upstream/cds_api_impl.h index 823f5b7de8f03..20571fe453e90 100644 --- a/source/common/upstream/cds_api_impl.h +++ b/source/common/upstream/cds_api_impl.h @@ -2,6 +2,7 @@ #include +#include "envoy/api/v2/cds.pb.h" #include "envoy/config/subscription.h" #include "envoy/event/dispatcher.h" #include "envoy/local_info/local_info.h" @@ -9,8 +10,6 @@ #include "common/common/logger.h" -#include "api/cds.pb.h" - namespace Envoy { namespace Upstream { diff --git a/source/common/upstream/cds_subscription.h b/source/common/upstream/cds_subscription.h index f0231ad3cb379..e29ac7d13531d 100644 --- a/source/common/upstream/cds_subscription.h +++ b/source/common/upstream/cds_subscription.h @@ -2,6 +2,7 @@ #include +#include "envoy/api/v2/cds.pb.h" #include "envoy/config/subscription.h" #include "envoy/event/dispatcher.h" #include "envoy/local_info/local_info.h" @@ -10,8 +11,6 @@ #include "common/common/logger.h" #include "common/http/rest_api_fetcher.h" -#include "api/cds.pb.h" - namespace Envoy { namespace Upstream { diff --git a/source/common/upstream/cluster_manager_impl.cc b/source/common/upstream/cluster_manager_impl.cc index f0d1eb337dd20..5c3739e432e18 100644 --- a/source/common/upstream/cluster_manager_impl.cc +++ b/source/common/upstream/cluster_manager_impl.cc @@ -163,7 +163,7 @@ void ClusterManagerInitHelper::setInitializedCb(std::function callback) } } -ClusterManagerImpl::ClusterManagerImpl(const envoy::api::v2::Bootstrap& bootstrap, +ClusterManagerImpl::ClusterManagerImpl(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, ClusterManagerFactory& factory, Stats::Store& stats, ThreadLocal::Instance& tls, Runtime::Loader& runtime, Runtime::RandomGenerator& random, @@ -265,7 +265,7 @@ ClusterManagerImpl::ClusterManagerImpl(const envoy::api::v2::Bootstrap& bootstra ->create(), primary_dispatcher, *Protobuf::DescriptorPool::generated_pool()->FindMethodByName( - "envoy.api.v2.AggregatedDiscoveryService.StreamAggregatedResources"))); + "envoy.service.discovery.v2.AggregatedDiscoveryService.StreamAggregatedResources"))); } else { ads_mux_.reset(new Config::NullGrpcMuxImpl()); } @@ -779,8 +779,8 @@ ClusterManagerImpl::ThreadLocalClusterManagerImpl::ClusterEntry::connPool( } ClusterManagerPtr ProdClusterManagerFactory::clusterManagerFromProto( - const envoy::api::v2::Bootstrap& bootstrap, Stats::Store& stats, ThreadLocal::Instance& tls, - Runtime::Loader& runtime, Runtime::RandomGenerator& random, + const envoy::config::bootstrap::v2::Bootstrap& bootstrap, Stats::Store& stats, + ThreadLocal::Instance& tls, Runtime::Loader& runtime, Runtime::RandomGenerator& random, const LocalInfo::LocalInfo& local_info, AccessLog::AccessLogManager& log_manager) { return ClusterManagerPtr{new ClusterManagerImpl(bootstrap, *this, stats, tls, runtime, random, local_info, log_manager, primary_dispatcher_)}; diff --git a/source/common/upstream/cluster_manager_impl.h b/source/common/upstream/cluster_manager_impl.h index 4f95a4a5dd045..6bf3177c84802 100644 --- a/source/common/upstream/cluster_manager_impl.h +++ b/source/common/upstream/cluster_manager_impl.h @@ -9,6 +9,7 @@ #include #include +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" #include "envoy/http/codes.h" #include "envoy/local_info/local_info.h" #include "envoy/runtime/runtime.h" @@ -21,8 +22,6 @@ #include "common/upstream/load_stats_reporter.h" #include "common/upstream/upstream_impl.h" -#include "api/bootstrap.pb.h" - namespace Envoy { namespace Upstream { @@ -42,12 +41,11 @@ class ProdClusterManagerFactory : public ClusterManagerFactory { local_info_(local_info) {} // Upstream::ClusterManagerFactory - ClusterManagerPtr clusterManagerFromProto(const envoy::api::v2::Bootstrap& bootstrap, - Stats::Store& stats, ThreadLocal::Instance& tls, - Runtime::Loader& runtime, - Runtime::RandomGenerator& random, - const LocalInfo::LocalInfo& local_info, - AccessLog::AccessLogManager& log_manager) override; + ClusterManagerPtr + clusterManagerFromProto(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, + Stats::Store& stats, ThreadLocal::Instance& tls, Runtime::Loader& runtime, + Runtime::RandomGenerator& random, const LocalInfo::LocalInfo& local_info, + AccessLog::AccessLogManager& log_manager) override; Http::ConnectionPool::InstancePtr allocateConnPool(Event::Dispatcher& dispatcher, HostConstSharedPtr host, ResourcePriority priority, @@ -146,8 +144,9 @@ struct ClusterManagerStats { */ class ClusterManagerImpl : public ClusterManager, Logger::Loggable { public: - ClusterManagerImpl(const envoy::api::v2::Bootstrap& bootstrap, ClusterManagerFactory& factory, - Stats::Store& stats, ThreadLocal::Instance& tls, Runtime::Loader& runtime, + ClusterManagerImpl(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, + ClusterManagerFactory& factory, Stats::Store& stats, + ThreadLocal::Instance& tls, Runtime::Loader& runtime, Runtime::RandomGenerator& random, const LocalInfo::LocalInfo& local_info, AccessLog::AccessLogManager& log_manager, Event::Dispatcher& primary_dispatcher); diff --git a/source/common/upstream/eds.cc b/source/common/upstream/eds.cc index 6fbed336867d4..a5f8a51883a08 100644 --- a/source/common/upstream/eds.cc +++ b/source/common/upstream/eds.cc @@ -1,5 +1,6 @@ #include "common/upstream/eds.h" +#include "envoy/api/v2/eds.pb.validate.h" #include "envoy/common/exception.h" #include "common/config/metadata.h" @@ -12,7 +13,6 @@ #include "common/protobuf/utility.h" #include "common/upstream/sds_subscription.h" -#include "api/eds.pb.validate.h" #include "fmt/format.h" namespace Envoy { @@ -30,6 +30,7 @@ EdsClusterImpl::EdsClusterImpl(const envoy::api::v2::Cluster& cluster, Runtime:: ? cluster.name() : cluster.eds_cluster_config().service_name()) { Config::Utility::checkLocalInfo("eds", local_info); + const auto& eds_config = cluster.eds_cluster_config().eds_config(); subscription_ = Config::SubscriptionFactory::subscriptionFromConfigSource< envoy::api::v2::ClusterLoadAssignment>( diff --git a/source/common/upstream/eds.h b/source/common/upstream/eds.h index 0e44ec4c13954..4b37cede994fd 100644 --- a/source/common/upstream/eds.h +++ b/source/common/upstream/eds.h @@ -1,13 +1,12 @@ #pragma once +#include "envoy/api/v2/base.pb.h" +#include "envoy/api/v2/eds.pb.h" #include "envoy/config/subscription.h" #include "envoy/local_info/local_info.h" #include "common/upstream/upstream_impl.h" -#include "api/base.pb.h" -#include "api/eds.pb.h" - namespace Envoy { namespace Upstream { diff --git a/source/common/upstream/health_checker_impl.h b/source/common/upstream/health_checker_impl.h index 1f7d5edc5d21c..b562a59852b81 100644 --- a/source/common/upstream/health_checker_impl.h +++ b/source/common/upstream/health_checker_impl.h @@ -8,6 +8,7 @@ #include #include +#include "envoy/api/v2/health_check.pb.h" #include "envoy/event/timer.h" #include "envoy/grpc/status.h" #include "envoy/http/codec.h" @@ -23,7 +24,6 @@ #include "common/network/filter_impl.h" #include "common/protobuf/protobuf.h" -#include "api/health_check.pb.h" #include "src/proto/grpc/health/v1/health.pb.h" namespace Envoy { diff --git a/source/common/upstream/load_balancer_impl.h b/source/common/upstream/load_balancer_impl.h index 4b0fc6f5e3999..024dbe6172e29 100644 --- a/source/common/upstream/load_balancer_impl.h +++ b/source/common/upstream/load_balancer_impl.h @@ -4,12 +4,11 @@ #include #include +#include "envoy/api/v2/cds.pb.h" #include "envoy/runtime/runtime.h" #include "envoy/upstream/load_balancer.h" #include "envoy/upstream/upstream.h" -#include "api/cds.pb.h" - namespace Envoy { namespace Upstream { diff --git a/source/common/upstream/load_stats_reporter.cc b/source/common/upstream/load_stats_reporter.cc index 40475df9a2780..9d90c88094861 100644 --- a/source/common/upstream/load_stats_reporter.cc +++ b/source/common/upstream/load_stats_reporter.cc @@ -13,7 +13,7 @@ LoadStatsReporter::LoadStatsReporter(const envoy::api::v2::Node& node, POOL_COUNTER_PREFIX(scope, "load_reporter."))}, async_client_(std::move(async_client)), service_method_(*Protobuf::DescriptorPool::generated_pool()->FindMethodByName( - "envoy.api.v2.EndpointDiscoveryService.StreamLoadStats")) { + "envoy.service.load_stats.v2.LoadReportingService.StreamLoadStats")) { request_.mutable_node()->MergeFrom(node); retry_timer_ = dispatcher.createTimer([this]() -> void { establishNewStream(); }); response_timer_ = dispatcher.createTimer([this]() -> void { sendLoadStatsRequest(); }); @@ -100,7 +100,7 @@ void LoadStatsReporter::onReceiveInitialMetadata(Http::HeaderMapPtr&& metadata) } void LoadStatsReporter::onReceiveMessage( - std::unique_ptr&& message) { + std::unique_ptr&& message) { ENVOY_LOG(debug, "New load report epoch: {}", message->DebugString()); stats_.requests_.inc(); message_ = std::move(message); diff --git a/source/common/upstream/load_stats_reporter.h b/source/common/upstream/load_stats_reporter.h index 4630bc68d6c15..03054d64e3831 100644 --- a/source/common/upstream/load_stats_reporter.h +++ b/source/common/upstream/load_stats_reporter.h @@ -1,14 +1,13 @@ #pragma once #include "envoy/event/dispatcher.h" +#include "envoy/service/load_stats/v2/lrs.pb.h" #include "envoy/stats/stats_macros.h" #include "envoy/upstream/cluster_manager.h" #include "common/common/logger.h" #include "common/grpc/async_client_impl.h" -#include "api/eds.pb.h" - namespace Envoy { namespace Upstream { @@ -29,8 +28,9 @@ struct LoadReporterStats { ALL_LOAD_REPORTER_STATS(GENERATE_COUNTER_STRUCT) }; -class LoadStatsReporter : Grpc::TypedAsyncStreamCallbacks, - Logger::Loggable { +class LoadStatsReporter + : Grpc::TypedAsyncStreamCallbacks, + Logger::Loggable { public: LoadStatsReporter(const envoy::api::v2::Node& node, ClusterManager& cluster_manager, Stats::Scope& scope, Grpc::AsyncClientPtr async_client, @@ -39,7 +39,8 @@ class LoadStatsReporter : Grpc::TypedAsyncStreamCallbacks&& message) override; + void onReceiveMessage( + std::unique_ptr&& message) override; void onReceiveTrailingMetadata(Http::HeaderMapPtr&& metadata) override; void onRemoteClose(Grpc::Status::GrpcStatus status, const std::string& message) override; @@ -60,8 +61,8 @@ class LoadStatsReporter : Grpc::TypedAsyncStreamCallbacks message_; + envoy::service::load_stats::v2::LoadStatsRequest request_; + std::unique_ptr message_; std::vector clusters_; }; diff --git a/source/common/upstream/outlier_detection_impl.cc b/source/common/upstream/outlier_detection_impl.cc index ae0708baa5bf7..71bfe8f453ee6 100644 --- a/source/common/upstream/outlier_detection_impl.cc +++ b/source/common/upstream/outlier_detection_impl.cc @@ -100,7 +100,7 @@ void DetectorHostMonitorImpl::putResult(Result result) { putHttpResponseCode(enumToInt(http_code)); } -DetectorConfig::DetectorConfig(const envoy::api::v2::Cluster::OutlierDetection& config) +DetectorConfig::DetectorConfig(const envoy::api::v2::cluster::OutlierDetection& config) : interval_ms_(static_cast(PROTOBUF_GET_MS_OR_DEFAULT(config, interval, 10000))), base_ejection_time_ms_( static_cast(PROTOBUF_GET_MS_OR_DEFAULT(config, base_ejection_time, 30000))), @@ -124,7 +124,7 @@ DetectorConfig::DetectorConfig(const envoy::api::v2::Cluster::OutlierDetection& PROTOBUF_GET_WRAPPED_OR_DEFAULT(config, enforcing_success_rate, 100))) {} DetectorImpl::DetectorImpl(const Cluster& cluster, - const envoy::api::v2::Cluster::OutlierDetection& config, + const envoy::api::v2::cluster::OutlierDetection& config, Event::Dispatcher& dispatcher, Runtime::Loader& runtime, MonotonicTimeSource& time_source, EventLoggerSharedPtr event_logger) : config_(config), dispatcher_(dispatcher), runtime_(runtime), time_source_(time_source), @@ -144,7 +144,7 @@ DetectorImpl::~DetectorImpl() { std::shared_ptr DetectorImpl::create(const Cluster& cluster, - const envoy::api::v2::Cluster::OutlierDetection& config, + const envoy::api::v2::cluster::OutlierDetection& config, Event::Dispatcher& dispatcher, Runtime::Loader& runtime, MonotonicTimeSource& time_source, EventLoggerSharedPtr event_logger) { std::shared_ptr detector( diff --git a/source/common/upstream/outlier_detection_impl.h b/source/common/upstream/outlier_detection_impl.h index f93781260cb5e..f868a087c2df8 100644 --- a/source/common/upstream/outlier_detection_impl.h +++ b/source/common/upstream/outlier_detection_impl.h @@ -10,13 +10,12 @@ #include #include "envoy/access_log/access_log.h" +#include "envoy/api/v2/cluster/outlier_detection.pb.h" #include "envoy/event/timer.h" #include "envoy/runtime/runtime.h" #include "envoy/upstream/outlier_detection.h" #include "envoy/upstream/upstream.h" -#include "api/cds.pb.h" - namespace Envoy { namespace Upstream { namespace Outlier { @@ -171,7 +170,7 @@ struct DetectionStats { */ class DetectorConfig { public: - DetectorConfig(const envoy::api::v2::Cluster::OutlierDetection& config); + DetectorConfig(const envoy::api::v2::cluster::OutlierDetection& config); uint64_t intervalMs() { return interval_ms_; } uint64_t baseEjectionTimeMs() { return base_ejection_time_ms_; } @@ -207,7 +206,7 @@ class DetectorConfig { class DetectorImpl : public Detector, public std::enable_shared_from_this { public: static std::shared_ptr - create(const Cluster& cluster, const envoy::api::v2::Cluster::OutlierDetection& config, + create(const Cluster& cluster, const envoy::api::v2::cluster::OutlierDetection& config, Event::Dispatcher& dispatcher, Runtime::Loader& runtime, MonotonicTimeSource& time_source, EventLoggerSharedPtr event_logger); ~DetectorImpl(); @@ -223,7 +222,7 @@ class DetectorImpl : public Detector, public std::enable_shared_from_this #include +#include "envoy/api/v2/endpoint/endpoint.pb.h" #include "envoy/common/exception.h" #include "common/config/metadata.h" @@ -14,8 +15,6 @@ #include "common/json/json_loader.h" #include "common/protobuf/protobuf.h" -#include "api/eds.pb.h" - namespace Envoy { namespace Upstream { @@ -42,7 +41,8 @@ void SdsSubscription::parseResponse(const Http::Message& response) { // Since in the v2 EDS API we place all the endpoints for a given zone in the same proto, we first // need to bin the returned hosts list so that we group them by zone. We use an ordered map here // to provide better determinism for debug/test behavior. - std::map> zone_lb_endpoints; + std::map> + zone_lb_endpoints; for (const Json::ObjectSharedPtr& host : json->getObjectArray("hosts")) { bool canary = false; uint32_t weight = 1; diff --git a/source/common/upstream/sds_subscription.h b/source/common/upstream/sds_subscription.h index 2dfc06cf0a99d..123c4ae0006f4 100644 --- a/source/common/upstream/sds_subscription.h +++ b/source/common/upstream/sds_subscription.h @@ -3,14 +3,13 @@ #include #include +#include "envoy/api/v2/base.pb.h" +#include "envoy/api/v2/eds.pb.h" #include "envoy/config/subscription.h" #include "common/common/assert.h" #include "common/http/rest_api_fetcher.h" -#include "api/base.pb.h" -#include "api/eds.pb.h" - namespace Envoy { namespace Upstream { diff --git a/source/common/upstream/subset_lb.cc b/source/common/upstream/subset_lb.cc index 1be714526e740..0be8468792412 100644 --- a/source/common/upstream/subset_lb.cc +++ b/source/common/upstream/subset_lb.cc @@ -2,6 +2,7 @@ #include +#include "envoy/api/v2/cds.pb.h" #include "envoy/runtime/runtime.h" #include "common/common/assert.h" @@ -11,8 +12,6 @@ #include "common/upstream/load_balancer_impl.h" #include "common/upstream/ring_hash_lb.h" -#include "api/cds.pb.h" - namespace Envoy { namespace Upstream { diff --git a/source/common/upstream/upstream_impl.cc b/source/common/upstream/upstream_impl.cc index 27b667e9733e7..e0cb492d01e0c 100644 --- a/source/common/upstream/upstream_impl.cc +++ b/source/common/upstream/upstream_impl.cc @@ -448,11 +448,11 @@ ClusterInfoImpl::ResourceManagers::load(const envoy::api::v2::Cluster& config, fmt::format("circuit_breakers.{}.{}.", cluster_name, priority_name); const auto& thresholds = config.circuit_breakers().thresholds(); - const auto it = - std::find_if(thresholds.cbegin(), thresholds.cend(), - [priority](const envoy::api::v2::CircuitBreakers::Thresholds& threshold) { - return threshold.priority() == priority; - }); + const auto it = std::find_if( + thresholds.cbegin(), thresholds.cend(), + [priority](const envoy::api::v2::cluster::CircuitBreakers::Thresholds& threshold) { + return threshold.priority() == priority; + }); if (it != thresholds.cend()) { max_connections = PROTOBUF_GET_WRAPPED_OR_DEFAULT(*it, max_connections, max_connections); max_pending_requests = diff --git a/source/common/upstream/upstream_impl.h b/source/common/upstream/upstream_impl.h index 7f6efaaddaa19..91162f7ca9fd5 100644 --- a/source/common/upstream/upstream_impl.h +++ b/source/common/upstream/upstream_impl.h @@ -11,6 +11,7 @@ #include #include +#include "envoy/api/v2/base.pb.h" #include "envoy/event/timer.h" #include "envoy/local_info/local_info.h" #include "envoy/network/dns.h" @@ -33,8 +34,6 @@ #include "common/upstream/outlier_detection_impl.h" #include "common/upstream/resource_manager_impl.h" -#include "api/base.pb.h" - namespace Envoy { namespace Upstream { diff --git a/source/docs/subset_load_balancer.md b/source/docs/subset_load_balancer.md index 8041eab8238b5..b7995e77ebb8e 100644 --- a/source/docs/subset_load_balancer.md +++ b/source/docs/subset_load_balancer.md @@ -165,7 +165,7 @@ After loading this configuration, the SLB's `LbSubsetMap` looks like this: ![LbSubsetMap Diagram](subset_load_balancer_diagram.svg) -Given these `envoy::api::v2::Route` entries: +Given these `envoy::api::v2::route::Route` entries: ``` json "routes": [ diff --git a/source/server/BUILD b/source/server/BUILD index 5e73eafb5eae2..ee6885628c3ef 100644 --- a/source/server/BUILD +++ b/source/server/BUILD @@ -21,11 +21,6 @@ envoy_cc_library( name = "configuration_lib", srcs = ["configuration_impl.cc"], hdrs = ["configuration_impl.h"], - external_deps = [ - "envoy_bootstrap", - "envoy_lds", - "envoy_trace", - ], deps = [ ":lds_api_lib", "//include/envoy/http:filter_interface", @@ -46,6 +41,9 @@ envoy_cc_library( "//source/common/protobuf:utility_lib", "//source/common/ratelimit:ratelimit_lib", "//source/common/tracing:http_tracer_lib", + "@envoy_api//envoy/api/v2:lds_cc", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", + "@envoy_api//envoy/config/trace/v2:trace_cc", ], ) @@ -161,7 +159,6 @@ envoy_cc_library( name = "lds_api_lib", srcs = ["lds_api.cc"], hdrs = ["lds_api.h"], - external_deps = ["envoy_lds"], deps = [ ":lds_subscription_lib", "//include/envoy/config:subscription_interface", @@ -172,6 +169,7 @@ envoy_cc_library( "//source/common/config:subscription_factory_lib", "//source/common/config:utility_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/api/v2:lds_cc", ], ) @@ -179,7 +177,6 @@ envoy_cc_library( name = "lds_subscription_lib", srcs = ["lds_subscription.cc"], hdrs = ["lds_subscription.h"], - external_deps = ["envoy_lds"], deps = [ "//include/envoy/config:subscription_interface", "//source/common/common:assert_lib", @@ -188,6 +185,7 @@ envoy_cc_library( "//source/common/http:rest_api_fetcher_lib", "//source/common/json:config_schemas_lib", "//source/common/json:json_validator_lib", + "@envoy_api//envoy/api/v2:lds_cc", ], ) @@ -195,7 +193,6 @@ envoy_cc_library( name = "listener_manager_lib", srcs = ["listener_manager_impl.cc"], hdrs = ["listener_manager_impl.h"], - external_deps = ["envoy_lds"], deps = [ ":configuration_lib", ":drain_manager_lib", @@ -211,6 +208,7 @@ envoy_cc_library( "//source/common/ssl:context_config_lib", "//source/server/config/listener:original_dst_lib", "//source/server/config/listener:proxy_protocol_lib", + "@envoy_api//envoy/api/v2:lds_cc", ], ) @@ -218,7 +216,6 @@ envoy_cc_library( name = "server_lib", srcs = ["server.cc"], hdrs = ["server.h"], - external_deps = ["envoy_bootstrap"], deps = [ ":configuration_lib", ":connection_handler_lib", @@ -254,6 +251,7 @@ envoy_cc_library( "//source/common/stats:thread_local_store_lib", "//source/common/upstream:cluster_manager_lib", "//source/server/http:admin_lib", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) diff --git a/source/server/config/access_log/file_access_log.cc b/source/server/config/access_log/file_access_log.cc index d380a00c5d96f..6df08a081ee13 100644 --- a/source/server/config/access_log/file_access_log.cc +++ b/source/server/config/access_log/file_access_log.cc @@ -1,5 +1,6 @@ #include "server/config/access_log/file_access_log.h" +#include "envoy/api/v2/filter/accesslog/accesslog.pb.validate.h" #include "envoy/registry/registry.h" #include "envoy/server/filter_config.h" @@ -9,8 +10,6 @@ #include "common/config/well_known_names.h" #include "common/protobuf/protobuf.h" -#include "api/filter/accesslog/accesslog.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/access_log/grpc_access_log.cc b/source/server/config/access_log/grpc_access_log.cc index 9bb28b5faf6c3..1adcbc108e65f 100644 --- a/source/server/config/access_log/grpc_access_log.cc +++ b/source/server/config/access_log/grpc_access_log.cc @@ -1,5 +1,7 @@ #include "server/config/access_log/grpc_access_log.h" +#include "envoy/api/v2/filter/accesslog/accesslog.pb.validate.h" +#include "envoy/config/accesslog/v2/als.pb.validate.h" #include "envoy/registry/registry.h" #include "envoy/server/filter_config.h" @@ -9,8 +11,6 @@ #include "common/grpc/async_client_impl.h" #include "common/protobuf/protobuf.h" -#include "api/filter/accesslog/accesslog.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { @@ -21,7 +21,7 @@ SINGLETON_MANAGER_REGISTRATION(grpc_access_log_streamer); AccessLog::InstanceSharedPtr HttpGrpcAccessLogFactory::createAccessLogInstance( const Protobuf::Message& config, AccessLog::FilterPtr&& filter, FactoryContext& context) { const auto& proto_config = MessageUtil::downcastAndValidate< - const envoy::api::v2::filter::accesslog::HttpGrpcAccessLogConfig&>(config); + const envoy::config::accesslog::v2::HttpGrpcAccessLogConfig&>(config); std::shared_ptr grpc_access_log_streamer = context.singletonManager().getTyped( SINGLETON_MANAGER_REGISTERED_NAME(grpc_access_log_streamer), @@ -37,8 +37,7 @@ AccessLog::InstanceSharedPtr HttpGrpcAccessLogFactory::createAccessLogInstance( } ProtobufTypes::MessagePtr HttpGrpcAccessLogFactory::createEmptyConfigProto() { - return ProtobufTypes::MessagePtr{ - new envoy::api::v2::filter::accesslog::HttpGrpcAccessLogConfig()}; + return ProtobufTypes::MessagePtr{new envoy::config::accesslog::v2::HttpGrpcAccessLogConfig()}; } std::string HttpGrpcAccessLogFactory::name() const { diff --git a/source/server/config/http/BUILD b/source/server/config/http/BUILD index f27222aa47ad6..0c118435a9047 100644 --- a/source/server/config/http/BUILD +++ b/source/server/config/http/BUILD @@ -167,7 +167,6 @@ envoy_cc_library( name = "router_lib", srcs = ["router.cc"], hdrs = ["router.h"], - external_deps = ["envoy_filter_http_router"], deps = [ "//include/envoy/registry", "//include/envoy/server:filter_config_interface", @@ -176,6 +175,7 @@ envoy_cc_library( "//source/common/json:config_schemas_lib", "//source/common/router:router_lib", "//source/common/router:shadow_writer_lib", + "@envoy_api//envoy/api/v2/filter/http:router_cc", ], ) diff --git a/source/server/config/http/buffer.cc b/source/server/config/http/buffer.cc index ea2a4309f0c25..241b2ae34c64e 100644 --- a/source/server/config/http/buffer.cc +++ b/source/server/config/http/buffer.cc @@ -4,14 +4,13 @@ #include #include +#include "envoy/api/v2/filter/http/buffer.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" #include "common/http/filter/buffer_filter.h" #include "common/protobuf/utility.h" -#include "api/filter/http/buffer.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/buffer.h b/source/server/config/http/buffer.h index c48bbc4ffb8fb..3359e3f5caa7a 100644 --- a/source/server/config/http/buffer.h +++ b/source/server/config/http/buffer.h @@ -2,12 +2,11 @@ #include +#include "envoy/api/v2/filter/http/buffer.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/http/buffer.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/fault.cc b/source/server/config/http/fault.cc index 7d2704c16f60e..95157366a8341 100644 --- a/source/server/config/http/fault.cc +++ b/source/server/config/http/fault.cc @@ -1,12 +1,11 @@ #include "server/config/http/fault.h" +#include "envoy/api/v2/filter/http/fault.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" #include "common/http/filter/fault_filter.h" -#include "api/filter/http/fault.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/fault.h b/source/server/config/http/fault.h index 7caecc5a66971..f9f40311c0ddc 100644 --- a/source/server/config/http/fault.h +++ b/source/server/config/http/fault.h @@ -2,12 +2,11 @@ #include +#include "envoy/api/v2/filter/http/fault.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/http/fault.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/grpc_json_transcoder.cc b/source/server/config/http/grpc_json_transcoder.cc index ba4e85b852845..cd03c8869f36c 100644 --- a/source/server/config/http/grpc_json_transcoder.cc +++ b/source/server/config/http/grpc_json_transcoder.cc @@ -1,13 +1,12 @@ #include "server/config/http/grpc_json_transcoder.h" +#include "envoy/api/v2/filter/http/transcoder.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" #include "common/grpc/json_transcoder_filter.h" #include "common/json/config_schemas.h" -#include "api/filter/http/transcoder.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/grpc_json_transcoder.h b/source/server/config/http/grpc_json_transcoder.h index 1b2a5eb50bd0a..cf2420db44530 100644 --- a/source/server/config/http/grpc_json_transcoder.h +++ b/source/server/config/http/grpc_json_transcoder.h @@ -2,14 +2,13 @@ #include +#include "envoy/api/v2/filter/http/transcoder.pb.h" #include "envoy/server/instance.h" #include "common/config/well_known_names.h" #include "server/config/network/http_connection_manager.h" -#include "api/filter/http/transcoder.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/lua.cc b/source/server/config/http/lua.cc index 280049b51bc12..38d69cbebdeb8 100644 --- a/source/server/config/http/lua.cc +++ b/source/server/config/http/lua.cc @@ -1,12 +1,11 @@ #include "server/config/http/lua.h" +#include "envoy/api/v2/filter/http/lua.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" #include "common/http/filter/lua/lua_filter.h" -#include "api/filter/http/lua.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/lua.h b/source/server/config/http/lua.h index 150b2b53eb1bf..8c47511e2852d 100644 --- a/source/server/config/http/lua.h +++ b/source/server/config/http/lua.h @@ -2,12 +2,11 @@ #include +#include "envoy/api/v2/filter/http/lua.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/http/lua.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/ratelimit.cc b/source/server/config/http/ratelimit.cc index 64fb8d7142733..007d454af8aee 100644 --- a/source/server/config/http/ratelimit.cc +++ b/source/server/config/http/ratelimit.cc @@ -3,14 +3,13 @@ #include #include +#include "envoy/api/v2/filter/http/rate_limit.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" #include "common/http/filter/ratelimit.h" #include "common/protobuf/utility.h" -#include "api/filter/http/rate_limit.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/ratelimit.h b/source/server/config/http/ratelimit.h index 832afa767dbb0..c5ab368e1784b 100644 --- a/source/server/config/http/ratelimit.h +++ b/source/server/config/http/ratelimit.h @@ -2,12 +2,11 @@ #include +#include "envoy/api/v2/filter/http/rate_limit.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/http/rate_limit.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/router.cc b/source/server/config/http/router.cc index 585db89ca6cb5..8356478960d1d 100644 --- a/source/server/config/http/router.cc +++ b/source/server/config/http/router.cc @@ -2,6 +2,7 @@ #include +#include "envoy/api/v2/filter/http/router.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" @@ -9,8 +10,6 @@ #include "common/router/router.h" #include "common/router/shadow_writer_impl.h" -#include "api/filter/http/router.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/router.h b/source/server/config/http/router.h index fe1459161468e..d22a429be698a 100644 --- a/source/server/config/http/router.h +++ b/source/server/config/http/router.h @@ -2,13 +2,12 @@ #include +#include "envoy/api/v2/filter/http/router.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" #include "common/protobuf/protobuf.h" -#include "api/filter/http/router.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/squash.cc b/source/server/config/http/squash.cc index 514be6d09d7ca..679d2a3661a3d 100644 --- a/source/server/config/http/squash.cc +++ b/source/server/config/http/squash.cc @@ -2,6 +2,7 @@ #include +#include "envoy/api/v2/filter/http/squash.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" @@ -11,8 +12,6 @@ #include "common/protobuf/protobuf.h" #include "common/protobuf/utility.h" -#include "api/filter/http/squash.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/http/squash.h b/source/server/config/http/squash.h index 903f2e6fca311..e03ce3b6fa60f 100644 --- a/source/server/config/http/squash.h +++ b/source/server/config/http/squash.h @@ -3,12 +3,11 @@ #include #include +#include "envoy/api/v2/filter/http/squash.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/http/squash.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/network/BUILD b/source/server/config/network/BUILD index 949b589c4262b..6f677e2fb8791 100644 --- a/source/server/config/network/BUILD +++ b/source/server/config/network/BUILD @@ -107,15 +107,13 @@ envoy_cc_library( name = "tcp_proxy_lib", srcs = ["tcp_proxy.cc"], hdrs = ["tcp_proxy.h"], - external_deps = [ - "envoy_filter_network_tcp_proxy", - ], deps = [ "//include/envoy/registry", "//include/envoy/server:filter_config_interface", "//source/common/config:filter_json_lib", "//source/common/config:well_known_names", "//source/common/filter:tcp_proxy_lib", + "@envoy_api//envoy/api/v2/filter/network:tcp_proxy_cc", ], ) @@ -136,9 +134,6 @@ envoy_cc_library( name = "ssl_socket_lib", srcs = ["ssl_socket.cc"], hdrs = ["ssl_socket.h"], - external_deps = [ - "envoy_sds", - ], deps = [ "//include/envoy/network:transport_socket_interface", "//include/envoy/registry", @@ -146,5 +141,6 @@ envoy_cc_library( "//source/common/config:well_known_names", "//source/common/network:raw_buffer_socket_lib", "//source/common/ssl:connection_lib", + "@envoy_api//envoy/api/v2/auth:cert_cc", ], ) diff --git a/source/server/config/network/client_ssl_auth.cc b/source/server/config/network/client_ssl_auth.cc index 5c3fc46be7ed5..bd0b2fb289741 100644 --- a/source/server/config/network/client_ssl_auth.cc +++ b/source/server/config/network/client_ssl_auth.cc @@ -2,14 +2,13 @@ #include +#include "envoy/api/v2/filter/network/client_ssl_auth.pb.validate.h" #include "envoy/network/connection.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" #include "common/filter/auth/client_ssl.h" -#include "api/filter/network/client_ssl_auth.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/network/client_ssl_auth.h b/source/server/config/network/client_ssl_auth.h index 91c494a5a452e..9a6abfe7c9739 100644 --- a/source/server/config/network/client_ssl_auth.h +++ b/source/server/config/network/client_ssl_auth.h @@ -2,12 +2,11 @@ #include +#include "envoy/api/v2/filter/network/client_ssl_auth.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/network/client_ssl_auth.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/network/http_connection_manager.cc b/source/server/config/network/http_connection_manager.cc index c3abdc8a63d59..0d9ebf0400b93 100644 --- a/source/server/config/network/http_connection_manager.cc +++ b/source/server/config/network/http_connection_manager.cc @@ -5,6 +5,7 @@ #include #include +#include "envoy/api/v2/filter/network/http_connection_manager.pb.validate.h" #include "envoy/filesystem/filesystem.h" #include "envoy/network/connection.h" #include "envoy/registry/registry.h" @@ -23,7 +24,6 @@ #include "common/protobuf/utility.h" #include "common/router/rds_impl.h" -#include "api/filter/network/http_connection_manager.pb.validate.h" #include "fmt/format.h" namespace Envoy { diff --git a/source/server/config/network/mongo_proxy.cc b/source/server/config/network/mongo_proxy.cc index 48f5c6f0a24dd..d748585635971 100644 --- a/source/server/config/network/mongo_proxy.cc +++ b/source/server/config/network/mongo_proxy.cc @@ -2,13 +2,13 @@ #include +#include "envoy/api/v2/filter/network/mongo_proxy.pb.validate.h" #include "envoy/network/connection.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" #include "common/mongo/proxy.h" -#include "api/filter/network/mongo_proxy.pb.validate.h" #include "fmt/format.h" namespace Envoy { diff --git a/source/server/config/network/mongo_proxy.h b/source/server/config/network/mongo_proxy.h index c05936e90bee9..5183c2fae304c 100644 --- a/source/server/config/network/mongo_proxy.h +++ b/source/server/config/network/mongo_proxy.h @@ -2,12 +2,11 @@ #include +#include "envoy/api/v2/filter/network/mongo_proxy.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/network/mongo_proxy.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/network/ratelimit.cc b/source/server/config/network/ratelimit.cc index 954e7e478e84c..bc950eeb57b04 100644 --- a/source/server/config/network/ratelimit.cc +++ b/source/server/config/network/ratelimit.cc @@ -3,6 +3,7 @@ #include #include +#include "envoy/api/v2/filter/network/rate_limit.pb.validate.h" #include "envoy/network/connection.h" #include "envoy/registry/registry.h" @@ -10,8 +11,6 @@ #include "common/filter/ratelimit.h" #include "common/protobuf/utility.h" -#include "api/filter/network/rate_limit.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/network/ratelimit.h b/source/server/config/network/ratelimit.h index c96de7e93640a..9a02a44948f4d 100644 --- a/source/server/config/network/ratelimit.h +++ b/source/server/config/network/ratelimit.h @@ -2,12 +2,11 @@ #include +#include "envoy/api/v2/filter/network/rate_limit.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/network/rate_limit.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/network/redis_proxy.cc b/source/server/config/network/redis_proxy.cc index 691d7e4474050..9c240cdfd916e 100644 --- a/source/server/config/network/redis_proxy.cc +++ b/source/server/config/network/redis_proxy.cc @@ -3,6 +3,7 @@ #include #include +#include "envoy/api/v2/filter/network/redis_proxy.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" @@ -11,8 +12,6 @@ #include "common/redis/conn_pool_impl.h" #include "common/redis/proxy_filter.h" -#include "api/filter/network/redis_proxy.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/network/redis_proxy.h b/source/server/config/network/redis_proxy.h index 2c71acbff8ab9..b73bbce6f789b 100644 --- a/source/server/config/network/redis_proxy.h +++ b/source/server/config/network/redis_proxy.h @@ -2,12 +2,11 @@ #include +#include "envoy/api/v2/filter/network/redis_proxy.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/network/redis_proxy.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/network/ssl_socket.cc b/source/server/config/network/ssl_socket.cc index 3c043f47e4990..e4916d7392d82 100644 --- a/source/server/config/network/ssl_socket.cc +++ b/source/server/config/network/ssl_socket.cc @@ -1,5 +1,7 @@ #include "server/config/network/ssl_socket.h" +#include "envoy/api/v2/auth/cert.pb.h" +#include "envoy/api/v2/auth/cert.pb.validate.h" #include "envoy/registry/registry.h" #include "common/network/raw_buffer_socket.h" @@ -7,9 +9,6 @@ #include "common/ssl/context_config_impl.h" #include "common/ssl/ssl_socket.h" -#include "api/sds.pb.h" -#include "api/sds.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { @@ -19,12 +18,13 @@ UpstreamSslSocketFactory::createTransportSocketFactory(const Protobuf::Message& TransportSocketFactoryContext& context) { return std::make_unique( Ssl::ClientContextConfigImpl( - MessageUtil::downcastAndValidate(message)), + MessageUtil::downcastAndValidate( + message)), context.sslContextManager(), context.statsScope()); } ProtobufTypes::MessagePtr UpstreamSslSocketFactory::createEmptyConfigProto() { - return std::make_unique(); + return std::make_unique(); } static Registry::RegisterFactory diff --git a/source/server/config/network/tcp_proxy.cc b/source/server/config/network/tcp_proxy.cc index 801fdee6c5573..e13976bf5c23a 100644 --- a/source/server/config/network/tcp_proxy.cc +++ b/source/server/config/network/tcp_proxy.cc @@ -2,14 +2,13 @@ #include +#include "envoy/api/v2/filter/network/tcp_proxy.pb.validate.h" #include "envoy/network/connection.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" #include "common/filter/tcp_proxy.h" -#include "api/filter/network/tcp_proxy.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/network/tcp_proxy.h b/source/server/config/network/tcp_proxy.h index cb9da1841fcf2..331d0cb2b9c35 100644 --- a/source/server/config/network/tcp_proxy.h +++ b/source/server/config/network/tcp_proxy.h @@ -1,11 +1,10 @@ #pragma once +#include "envoy/api/v2/filter/network/tcp_proxy.pb.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/network/tcp_proxy.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/config/stats/BUILD b/source/server/config/stats/BUILD index f6c67422ff38e..5d32031f9b88e 100644 --- a/source/server/config/stats/BUILD +++ b/source/server/config/stats/BUILD @@ -12,9 +12,6 @@ envoy_cc_library( name = "statsd_lib", srcs = ["statsd.cc"], hdrs = ["statsd.h"], - external_deps = [ - "envoy_stats", - ], deps = [ "//include/envoy/registry", "//source/common/config:well_known_names", @@ -22,6 +19,7 @@ envoy_cc_library( "//source/common/network:resolver_lib", "//source/common/stats:statsd_lib", "//source/server:configuration_lib", + "@envoy_api//envoy/config/metrics/v2:stats_cc", ], ) @@ -29,9 +27,6 @@ envoy_cc_library( name = "dog_statsd_lib", srcs = ["dog_statsd.cc"], hdrs = ["dog_statsd.h"], - external_deps = [ - "envoy_stats", - ], deps = [ "//include/envoy/registry", "//source/common/config:well_known_names", @@ -39,6 +34,7 @@ envoy_cc_library( "//source/common/network:resolver_lib", "//source/common/stats:statsd_lib", "//source/server:configuration_lib", + "@envoy_api//envoy/config/metrics/v2:stats_cc", ], ) @@ -46,14 +42,12 @@ envoy_cc_library( name = "metrics_service_lib", srcs = ["metrics_service.cc"], hdrs = ["metrics_service.h"], - external_deps = [ - "envoy_stats", - "envoy_metrics", - ], deps = [ "//include/envoy/registry", "//source/common/config:well_known_names", "//source/common/stats:metrics_service_grpc_lib", "//source/server:configuration_lib", + "@envoy_api//envoy/config/metrics/v2:stats_cc", + "@envoy_api//envoy/service/metrics/v2:metrics_service_cc", ], ) diff --git a/source/server/config/stats/dog_statsd.cc b/source/server/config/stats/dog_statsd.cc index da679c70eb8c6..f7b9436088116 100644 --- a/source/server/config/stats/dog_statsd.cc +++ b/source/server/config/stats/dog_statsd.cc @@ -2,15 +2,14 @@ #include +#include "envoy/config/metrics/v2/stats.pb.h" +#include "envoy/config/metrics/v2/stats.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/well_known_names.h" #include "common/network/resolver_impl.h" #include "common/stats/statsd.h" -#include "api/stats.pb.h" -#include "api/stats.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { @@ -18,7 +17,7 @@ namespace Configuration { Stats::SinkPtr DogStatsdSinkFactory::createStatsSink(const Protobuf::Message& config, Server::Instance& server) { const auto& sink_config = - MessageUtil::downcastAndValidate(config); + MessageUtil::downcastAndValidate(config); Network::Address::InstanceConstSharedPtr address = Network::Address::resolveProtoAddress(sink_config.address()); ENVOY_LOG(debug, "dog_statsd UDP ip address: {}", address->asString()); @@ -27,7 +26,8 @@ Stats::SinkPtr DogStatsdSinkFactory::createStatsSink(const Protobuf::Message& co } ProtobufTypes::MessagePtr DogStatsdSinkFactory::createEmptyConfigProto() { - return std::unique_ptr(new envoy::api::v2::DogStatsdSink()); + return std::unique_ptr( + new envoy::config::metrics::v2::DogStatsdSink()); } std::string DogStatsdSinkFactory::name() { return Config::StatsSinkNames::get().DOG_STATSD; } diff --git a/source/server/config/stats/metrics_service.cc b/source/server/config/stats/metrics_service.cc index a9208568c10ed..6f9c281a6dc19 100644 --- a/source/server/config/stats/metrics_service.cc +++ b/source/server/config/stats/metrics_service.cc @@ -2,6 +2,8 @@ #include +#include "envoy/config/metrics/v2/metrics_service.pb.h" +#include "envoy/config/metrics/v2/metrics_service.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/well_known_names.h" @@ -9,9 +11,6 @@ #include "common/network/resolver_impl.h" #include "common/stats/grpc_metrics_service_impl.h" -#include "api/metrics_service.pb.h" -#include "api/metrics_service.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { @@ -19,7 +18,8 @@ namespace Configuration { Stats::SinkPtr MetricsServiceSinkFactory::createStatsSink(const Protobuf::Message& config, Server::Instance& server) { const auto& sink_config = - MessageUtil::downcastAndValidate(config); + MessageUtil::downcastAndValidate( + config); const auto& grpc_service = sink_config.grpc_service(); ENVOY_LOG(debug, "Metrics Service gRPC service configuration: {}", grpc_service.DebugString()); @@ -34,8 +34,8 @@ Stats::SinkPtr MetricsServiceSinkFactory::createStatsSink(const Protobuf::Messag } ProtobufTypes::MessagePtr MetricsServiceSinkFactory::createEmptyConfigProto() { - return std::unique_ptr( - std::make_unique()); + return std::unique_ptr( + std::make_unique()); } std::string MetricsServiceSinkFactory::name() { diff --git a/source/server/config/stats/statsd.cc b/source/server/config/stats/statsd.cc index 13c890048c611..b7cd75164daff 100644 --- a/source/server/config/stats/statsd.cc +++ b/source/server/config/stats/statsd.cc @@ -2,15 +2,14 @@ #include +#include "envoy/config/metrics/v2/stats.pb.h" +#include "envoy/config/metrics/v2/stats.pb.validate.h" #include "envoy/registry/registry.h" #include "common/config/well_known_names.h" #include "common/network/resolver_impl.h" #include "common/stats/statsd.h" -#include "api/stats.pb.h" -#include "api/stats.pb.validate.h" - namespace Envoy { namespace Server { namespace Configuration { @@ -19,9 +18,9 @@ Stats::SinkPtr StatsdSinkFactory::createStatsSink(const Protobuf::Message& confi Server::Instance& server) { const auto& statsd_sink = - MessageUtil::downcastAndValidate(config); + MessageUtil::downcastAndValidate(config); switch (statsd_sink.statsd_specifier_case()) { - case envoy::api::v2::StatsdSink::kAddress: { + case envoy::config::metrics::v2::StatsdSink::kAddress: { Network::Address::InstanceConstSharedPtr address = Network::Address::resolveProtoAddress(statsd_sink.address()); ENVOY_LOG(debug, "statsd UDP ip address: {}", address->asString()); @@ -29,7 +28,7 @@ Stats::SinkPtr StatsdSinkFactory::createStatsSink(const Protobuf::Message& confi new Stats::Statsd::UdpStatsdSink(server.threadLocal(), std::move(address), false)); break; } - case envoy::api::v2::StatsdSink::kTcpClusterName: + case envoy::config::metrics::v2::StatsdSink::kTcpClusterName: ENVOY_LOG(debug, "statsd TCP cluster: {}", statsd_sink.tcp_cluster_name()); return Stats::SinkPtr(new Stats::Statsd::TcpStatsdSink( server.localInfo(), statsd_sink.tcp_cluster_name(), server.threadLocal(), @@ -42,7 +41,8 @@ Stats::SinkPtr StatsdSinkFactory::createStatsSink(const Protobuf::Message& confi } ProtobufTypes::MessagePtr StatsdSinkFactory::createEmptyConfigProto() { - return std::unique_ptr(new envoy::api::v2::StatsdSink()); + return std::unique_ptr( + new envoy::config::metrics::v2::StatsdSink()); } std::string StatsdSinkFactory::name() { return Config::StatsSinkNames::get().STATSD; } diff --git a/source/server/config_validation/BUILD b/source/server/config_validation/BUILD index d7418ae74a3d7..75789426b4a59 100644 --- a/source/server/config_validation/BUILD +++ b/source/server/config_validation/BUILD @@ -74,7 +74,6 @@ envoy_cc_library( name = "server_lib", srcs = ["server.cc"], hdrs = ["server.h"], - external_deps = ["envoy_bootstrap"], deps = [ ":admin_lib", ":api_lib", @@ -100,5 +99,6 @@ envoy_cc_library( "//source/server:configuration_lib", "//source/server:server_lib", "//source/server/http:admin_lib", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) diff --git a/source/server/config_validation/cluster_manager.cc b/source/server/config_validation/cluster_manager.cc index d63c1007b6722..8a202ab56f4aa 100644 --- a/source/server/config_validation/cluster_manager.cc +++ b/source/server/config_validation/cluster_manager.cc @@ -12,8 +12,8 @@ ValidationClusterManagerFactory::ValidationClusterManagerFactory( primary_dispatcher, local_info) {} ClusterManagerPtr ValidationClusterManagerFactory::clusterManagerFromProto( - const envoy::api::v2::Bootstrap& bootstrap, Stats::Store& stats, ThreadLocal::Instance& tls, - Runtime::Loader& runtime, Runtime::RandomGenerator& random, + const envoy::config::bootstrap::v2::Bootstrap& bootstrap, Stats::Store& stats, + ThreadLocal::Instance& tls, Runtime::Loader& runtime, Runtime::RandomGenerator& random, const LocalInfo::LocalInfo& local_info, AccessLog::AccessLogManager& log_manager) { return ClusterManagerPtr{new ValidationClusterManager( bootstrap, *this, stats, tls, runtime, random, local_info, log_manager, primary_dispatcher_)}; @@ -30,10 +30,10 @@ ValidationClusterManagerFactory::createCds(const envoy::api::v2::ConfigSource& c } ValidationClusterManager::ValidationClusterManager( - const envoy::api::v2::Bootstrap& bootstrap, ClusterManagerFactory& factory, Stats::Store& stats, - ThreadLocal::Instance& tls, Runtime::Loader& runtime, Runtime::RandomGenerator& random, - const LocalInfo::LocalInfo& local_info, AccessLog::AccessLogManager& log_manager, - Event::Dispatcher& primary_dispatcher) + const envoy::config::bootstrap::v2::Bootstrap& bootstrap, ClusterManagerFactory& factory, + Stats::Store& stats, ThreadLocal::Instance& tls, Runtime::Loader& runtime, + Runtime::RandomGenerator& random, const LocalInfo::LocalInfo& local_info, + AccessLog::AccessLogManager& log_manager, Event::Dispatcher& primary_dispatcher) : ClusterManagerImpl(bootstrap, factory, stats, tls, runtime, random, local_info, log_manager, primary_dispatcher) {} diff --git a/source/server/config_validation/cluster_manager.h b/source/server/config_validation/cluster_manager.h index b13a1a4847f52..9ca0cc941754a 100644 --- a/source/server/config_validation/cluster_manager.h +++ b/source/server/config_validation/cluster_manager.h @@ -22,12 +22,11 @@ class ValidationClusterManagerFactory : public ProdClusterManagerFactory { Event::Dispatcher& primary_dispatcher, const LocalInfo::LocalInfo& local_info); - ClusterManagerPtr clusterManagerFromProto(const envoy::api::v2::Bootstrap& bootstrap, - Stats::Store& stats, ThreadLocal::Instance& tls, - Runtime::Loader& runtime, - Runtime::RandomGenerator& random, - const LocalInfo::LocalInfo& local_info, - AccessLog::AccessLogManager& log_manager) override; + ClusterManagerPtr + clusterManagerFromProto(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, + Stats::Store& stats, ThreadLocal::Instance& tls, Runtime::Loader& runtime, + Runtime::RandomGenerator& random, const LocalInfo::LocalInfo& local_info, + AccessLog::AccessLogManager& log_manager) override; // Delegates to ProdClusterManagerFactory::createCds, but discards the result and returns nullptr // unconditionally. @@ -41,7 +40,7 @@ class ValidationClusterManagerFactory : public ProdClusterManagerFactory { */ class ValidationClusterManager : public ClusterManagerImpl { public: - ValidationClusterManager(const envoy::api::v2::Bootstrap& bootstrap, + ValidationClusterManager(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, ClusterManagerFactory& factory, Stats::Store& stats, ThreadLocal::Instance& tls, Runtime::Loader& runtime, Runtime::RandomGenerator& random, const LocalInfo::LocalInfo& local_info, diff --git a/source/server/config_validation/server.cc b/source/server/config_validation/server.cc index 13de23bcd9326..fad2908ea45cd 100644 --- a/source/server/config_validation/server.cc +++ b/source/server/config_validation/server.cc @@ -1,5 +1,8 @@ #include "server/config_validation/server.h" +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" +#include "envoy/config/bootstrap/v2/bootstrap.pb.validate.h" + #include "common/common/version.h" #include "common/config/bootstrap_json.h" #include "common/config/utility.h" @@ -9,9 +12,6 @@ #include "server/configuration_impl.h" -#include "api/bootstrap.pb.h" -#include "api/bootstrap.pb.validate.h" - namespace Envoy { namespace Server { @@ -64,7 +64,7 @@ void ValidationInstance::initialize(Options& options, // If we get all the way through that stripped-down initialization flow, to the point where we'd // be ready to serve, then the config has passed validation. // Handle configuration that needs to take place prior to the main configuration load. - envoy::api::v2::Bootstrap bootstrap; + envoy::config::bootstrap::v2::Bootstrap bootstrap; InstanceUtil::loadBootstrapConfig(bootstrap, options.configPath(), options.v2ConfigOnly()); Config::Utility::createTagProducer(bootstrap); diff --git a/source/server/config_validation/server.h b/source/server/config_validation/server.h index e09ffa24ad405..b9cec983ac0af 100644 --- a/source/server/config_validation/server.h +++ b/source/server/config_validation/server.h @@ -89,13 +89,13 @@ class ValidationInstance : Logger::Loggable, const LocalInfo::LocalInfo& localInfo() override { return *local_info_; } // Server::ListenerComponentFactory - std::vector - createNetworkFilterFactoryList(const Protobuf::RepeatedPtrField& filters, - Configuration::FactoryContext& context) override { + std::vector createNetworkFilterFactoryList( + const Protobuf::RepeatedPtrField& filters, + Configuration::FactoryContext& context) override { return ProdListenerComponentFactory::createNetworkFilterFactoryList_(filters, context); } std::vector createListenerFilterFactoryList( - const Protobuf::RepeatedPtrField& filters, + const Protobuf::RepeatedPtrField& filters, Configuration::FactoryContext& context) override { return ProdListenerComponentFactory::createListenerFilterFactoryList_(filters, context); } diff --git a/source/server/configuration_impl.cc b/source/server/configuration_impl.cc index 4d3933a777d97..b49d26f7dd1e6 100644 --- a/source/server/configuration_impl.cc +++ b/source/server/configuration_impl.cc @@ -6,6 +6,7 @@ #include #include +#include "envoy/config/trace/v2/trace.pb.h" #include "envoy/network/connection.h" #include "envoy/runtime/runtime.h" #include "envoy/server/instance.h" @@ -19,8 +20,6 @@ #include "common/ratelimit/ratelimit_impl.h" #include "common/tracing/http_tracer_impl.h" -#include "api/lds.pb.h" -#include "api/trace.pb.h" #include "fmt/format.h" namespace Envoy { @@ -45,7 +44,8 @@ bool FilterChainUtility::buildFilterChain(Network::ListenerFilterManager& filter return true; } -void MainImpl::initialize(const envoy::api::v2::Bootstrap& bootstrap, Instance& server, +void MainImpl::initialize(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, + Instance& server, Upstream::ClusterManagerFactory& cluster_manager_factory) { cluster_manager_ = cluster_manager_factory.clusterManagerFromProto( bootstrap, server.stats(), server.threadLocal(), server.runtime(), server.random(), @@ -90,7 +90,8 @@ void MainImpl::initialize(const envoy::api::v2::Bootstrap& bootstrap, Instance& initializeStatsSinks(bootstrap, server); } -void MainImpl::initializeTracers(const envoy::api::v2::Tracing& configuration, Instance& server) { +void MainImpl::initializeTracers(const envoy::config::trace::v2::Tracing& configuration, + Instance& server) { ENVOY_LOG(info, "loading tracing configuration"); if (!configuration.has_http()) { @@ -116,10 +117,11 @@ void MainImpl::initializeTracers(const envoy::api::v2::Tracing& configuration, I http_tracer_ = factory.createHttpTracer(*driver_config, server, *cluster_manager_); } -void MainImpl::initializeStatsSinks(const envoy::api::v2::Bootstrap& bootstrap, Instance& server) { +void MainImpl::initializeStatsSinks(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, + Instance& server) { ENVOY_LOG(info, "loading stats sink configuration"); - for (const envoy::api::v2::StatsSink& sink_object : bootstrap.stats_sinks()) { + for (const envoy::config::metrics::v2::StatsSink& sink_object : bootstrap.stats_sinks()) { // Generate factory and translate stats sink custom config auto& factory = Config::Utility::getAndCheckFactory(sink_object.name()); ProtobufTypes::MessagePtr message = @@ -129,7 +131,7 @@ void MainImpl::initializeStatsSinks(const envoy::api::v2::Bootstrap& bootstrap, } } -InitialImpl::InitialImpl(const envoy::api::v2::Bootstrap& bootstrap) { +InitialImpl::InitialImpl(const envoy::config::bootstrap::v2::Bootstrap& bootstrap) { const auto& admin = bootstrap.admin(); admin_.access_log_path_ = admin.access_log_path(); admin_.profile_path_ = diff --git a/source/server/configuration_impl.h b/source/server/configuration_impl.h index 2ba943f429754..3adf670e80469 100644 --- a/source/server/configuration_impl.h +++ b/source/server/configuration_impl.h @@ -9,6 +9,8 @@ #include #include +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" +#include "envoy/config/trace/v2/trace.pb.h" #include "envoy/http/filter.h" #include "envoy/network/filter.h" #include "envoy/server/configuration.h" @@ -23,9 +25,6 @@ #include "server/lds_api.h" -#include "api/bootstrap.pb.h" -#include "api/trace.pb.h" - namespace Envoy { namespace Server { namespace Configuration { @@ -121,7 +120,7 @@ class MainImpl : Logger::Loggable, public Main { * @param server supplies the owning server. * @param cluster_manager_factory supplies the cluster manager creation factory. */ - void initialize(const envoy::api::v2::Bootstrap& bootstrap, Instance& server, + void initialize(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, Instance& server, Upstream::ClusterManagerFactory& cluster_manager_factory); // Server::Configuration::Main @@ -143,9 +142,10 @@ class MainImpl : Logger::Loggable, public Main { /** * Initialize tracers and corresponding sinks. */ - void initializeTracers(const envoy::api::v2::Tracing& configuration, Instance& server); + void initializeTracers(const envoy::config::trace::v2::Tracing& configuration, Instance& server); - void initializeStatsSinks(const envoy::api::v2::Bootstrap& bootstrap, Instance& server); + void initializeStatsSinks(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, + Instance& server); std::unique_ptr cluster_manager_; std::unique_ptr lds_api_; @@ -164,7 +164,7 @@ class MainImpl : Logger::Loggable, public Main { */ class InitialImpl : public Initial { public: - InitialImpl(const envoy::api::v2::Bootstrap& bootstrap); + InitialImpl(const envoy::config::bootstrap::v2::Bootstrap& bootstrap); // Server::Configuration::Initial Admin& admin() override { return admin_; } diff --git a/source/server/http/BUILD b/source/server/http/BUILD index cf9e834745c3d..88988cc11c348 100644 --- a/source/server/http/BUILD +++ b/source/server/http/BUILD @@ -55,7 +55,6 @@ envoy_cc_library( name = "health_check_lib", srcs = ["health_check.cc"], hdrs = ["health_check.h"], - external_deps = ["envoy_filter_http_health_check"], deps = [ "//include/envoy/event:dispatcher_interface", "//include/envoy/event:timer_interface", @@ -72,5 +71,6 @@ envoy_cc_library( "//source/common/http:utility_lib", "//source/common/protobuf:utility_lib", "//source/server/config/network:http_connection_manager_lib", + "@envoy_api//envoy/api/v2/filter/http:health_check_cc", ], ) diff --git a/source/server/http/health_check.h b/source/server/http/health_check.h index a8f65dcd2dde2..e93b4ac61ab7b 100644 --- a/source/server/http/health_check.h +++ b/source/server/http/health_check.h @@ -5,14 +5,13 @@ #include #include +#include "envoy/api/v2/filter/http/health_check.pb.h" #include "envoy/http/codes.h" #include "envoy/http/filter.h" #include "envoy/server/filter_config.h" #include "common/config/well_known_names.h" -#include "api/filter/http/health_check.pb.h" - namespace Envoy { namespace Server { namespace Configuration { diff --git a/source/server/lds_api.cc b/source/server/lds_api.cc index 0031240b8ef75..73a16633722ff 100644 --- a/source/server/lds_api.cc +++ b/source/server/lds_api.cc @@ -2,6 +2,9 @@ #include +#include "envoy/api/v2/lds.pb.validate.h" +#include "envoy/api/v2/listener/listener.pb.validate.h" + #include "common/common/cleanup.h" #include "common/config/resources.h" #include "common/config/subscription_factory.h" @@ -10,8 +13,6 @@ #include "server/lds_subscription.h" -#include "api/lds.pb.validate.h" - namespace Envoy { namespace Server { diff --git a/source/server/lds_api.h b/source/server/lds_api.h index 6a2f78754cad5..df313cee75160 100644 --- a/source/server/lds_api.h +++ b/source/server/lds_api.h @@ -2,14 +2,13 @@ #include +#include "envoy/api/v2/lds.pb.h" #include "envoy/config/subscription.h" #include "envoy/init/init.h" #include "envoy/server/listener_manager.h" #include "common/common/logger.h" -#include "api/lds.pb.h" - namespace Envoy { namespace Server { diff --git a/source/server/lds_subscription.cc b/source/server/lds_subscription.cc index b3a3fce705786..c64cccafc3a56 100644 --- a/source/server/lds_subscription.cc +++ b/source/server/lds_subscription.cc @@ -1,12 +1,13 @@ #include "server/lds_subscription.h" +#include "envoy/api/v2/listener/listener.pb.h" + #include "common/config/lds_json.h" #include "common/config/utility.h" #include "common/http/headers.h" #include "common/json/config_schemas.h" #include "common/json/json_loader.h" -#include "api/lds.pb.h" #include "fmt/format.h" namespace Envoy { diff --git a/source/server/lds_subscription.h b/source/server/lds_subscription.h index de523df6ab81c..b2b7874868964 100644 --- a/source/server/lds_subscription.h +++ b/source/server/lds_subscription.h @@ -1,5 +1,7 @@ #pragma once +#include "envoy/api/v2/lds.pb.h" +#include "envoy/api/v2/listener/listener.pb.h" #include "envoy/config/subscription.h" #include "common/common/assert.h" @@ -7,8 +9,6 @@ #include "common/http/rest_api_fetcher.h" #include "common/json/json_validator.h" -#include "api/lds.pb.h" - namespace Envoy { namespace Server { diff --git a/source/server/listener_manager_impl.cc b/source/server/listener_manager_impl.cc index 26d2f4982fb3a..5c75227181d83 100644 --- a/source/server/listener_manager_impl.cc +++ b/source/server/listener_manager_impl.cc @@ -20,7 +20,7 @@ namespace Server { std::vector ProdListenerComponentFactory::createNetworkFilterFactoryList_( - const Protobuf::RepeatedPtrField& filters, + const Protobuf::RepeatedPtrField& filters, Configuration::FactoryContext& context) { std::vector ret; for (ssize_t i = 0; i < filters.size(); i++) { @@ -51,7 +51,7 @@ ProdListenerComponentFactory::createNetworkFilterFactoryList_( std::vector ProdListenerComponentFactory::createListenerFilterFactoryList_( - const Protobuf::RepeatedPtrField& filters, + const Protobuf::RepeatedPtrField& filters, Configuration::FactoryContext& context) { std::vector ret; for (ssize_t i = 0; i < filters.size(); i++) { diff --git a/source/server/listener_manager_impl.h b/source/server/listener_manager_impl.h index b8d638b01a258..3a35e27ae5718 100644 --- a/source/server/listener_manager_impl.h +++ b/source/server/listener_manager_impl.h @@ -1,5 +1,6 @@ #pragma once +#include "envoy/api/v2/listener/listener.pb.h" #include "envoy/server/filter_config.h" #include "envoy/server/instance.h" #include "envoy/server/listener_manager.h" @@ -9,8 +10,6 @@ #include "server/init_manager_impl.h" -#include "api/lds.pb.h" - namespace Envoy { namespace Server { @@ -27,24 +26,24 @@ class ProdListenerComponentFactory : public ListenerComponentFactory, /** * Static worker for createNetworkFilterFactoryList() that can be used directly in tests. */ - static std::vector - createNetworkFilterFactoryList_(const Protobuf::RepeatedPtrField& filters, - Configuration::FactoryContext& context); + static std::vector createNetworkFilterFactoryList_( + const Protobuf::RepeatedPtrField& filters, + Configuration::FactoryContext& context); /** * Static worker for createListenerFilterFactoryList() that can be used directly in tests. */ static std::vector createListenerFilterFactoryList_( - const Protobuf::RepeatedPtrField& filters, + const Protobuf::RepeatedPtrField& filters, Configuration::FactoryContext& context); // Server::ListenerComponentFactory - std::vector - createNetworkFilterFactoryList(const Protobuf::RepeatedPtrField& filters, - Configuration::FactoryContext& context) override { + std::vector createNetworkFilterFactoryList( + const Protobuf::RepeatedPtrField& filters, + Configuration::FactoryContext& context) override { return createNetworkFilterFactoryList_(filters, context); } std::vector createListenerFilterFactoryList( - const Protobuf::RepeatedPtrField& filters, + const Protobuf::RepeatedPtrField& filters, Configuration::FactoryContext& context) override { return createListenerFilterFactoryList_(filters, context); } diff --git a/source/server/server.cc b/source/server/server.cc index 448a9c23cbcd6..bd695f155ed62 100644 --- a/source/server/server.cc +++ b/source/server/server.cc @@ -7,6 +7,8 @@ #include #include +#include "envoy/config/bootstrap/v2//bootstrap.pb.validate.h" +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" #include "envoy/event/dispatcher.h" #include "envoy/event/signal.h" #include "envoy/event/timer.h" @@ -35,9 +37,6 @@ #include "server/guarddog_impl.h" #include "server/test_hooks.h" -#include "api/bootstrap.pb.h" -#include "api/bootstrap.pb.validate.h" - namespace Envoy { namespace Server { @@ -157,7 +156,7 @@ void InstanceImpl::getParentStats(HotRestart::GetParentStatsInfo& info) { bool InstanceImpl::healthCheckFailed() { return server_stats_->live_.value() == 0; } -void InstanceUtil::loadBootstrapConfig(envoy::api::v2::Bootstrap& bootstrap, +void InstanceUtil::loadBootstrapConfig(envoy::config::bootstrap::v2::Bootstrap& bootstrap, const std::string& config_path, bool v2_only) { bool v2_config_loaded = false; try { @@ -185,7 +184,7 @@ void InstanceImpl::initialize(Options& options, restarter_.version()); // Handle configuration that needs to take place prior to the main configuration load. - envoy::api::v2::Bootstrap bootstrap; + envoy::config::bootstrap::v2::Bootstrap bootstrap; InstanceUtil::loadBootstrapConfig(bootstrap, options.configPath(), options.v2ConfigOnly()); // Needs to happen as early as possible in the instantiation to preempt the objects that require diff --git a/source/server/server.h b/source/server/server.h index 02c8840d61d06..b742d5ac41550 100644 --- a/source/server/server.h +++ b/source/server/server.h @@ -93,7 +93,7 @@ class InstanceUtil : Logger::Loggable { * @param config_path supplies the config path. * @param v2_only supplies whether to attempt v1 fallback. */ - static void loadBootstrapConfig(envoy::api::v2::Bootstrap& bootstrap, + static void loadBootstrapConfig(envoy::config::bootstrap::v2::Bootstrap& bootstrap, const std::string& config_path, bool v2_only); }; diff --git a/test/common/access_log/grpc_access_log_impl_test.cc b/test/common/access_log/grpc_access_log_impl_test.cc index d06b739158e74..b73688114d625 100644 --- a/test/common/access_log/grpc_access_log_impl_test.cc +++ b/test/common/access_log/grpc_access_log_impl_test.cc @@ -20,8 +20,7 @@ namespace AccessLog { class GrpcAccessLogStreamerImplTest : public testing::Test { public: typedef Grpc::MockAsyncStream MockAccessLogStream; - typedef Grpc::TypedAsyncStreamCallbacks< - envoy::api::v2::filter::accesslog::StreamAccessLogsResponse> + typedef Grpc::TypedAsyncStreamCallbacks AccessLogCallbacks; GrpcAccessLogStreamerImplTest() { @@ -58,7 +57,7 @@ TEST_F(GrpcAccessLogStreamerImplTest, BasicFlow) { expectStreamStart(stream1, &callbacks1); EXPECT_CALL(local_info_, node()); EXPECT_CALL(stream1, sendMessage(_, false)); - envoy::api::v2::filter::accesslog::StreamAccessLogsMessage message_log1; + envoy::service::accesslog::v2::StreamAccessLogsMessage message_log1; streamer_->send(message_log1, "log1"); message_log1.Clear(); @@ -71,12 +70,12 @@ TEST_F(GrpcAccessLogStreamerImplTest, BasicFlow) { expectStreamStart(stream2, &callbacks2); EXPECT_CALL(local_info_, node()); EXPECT_CALL(stream2, sendMessage(_, false)); - envoy::api::v2::filter::accesslog::StreamAccessLogsMessage message_log2; + envoy::service::accesslog::v2::StreamAccessLogsMessage message_log2; streamer_->send(message_log2, "log2"); // Verify that sending an empty response message doesn't do anything bad. callbacks1->onReceiveMessage( - std::make_unique()); + std::make_unique()); // Close stream 2 and make sure we make a new one. callbacks2->onRemoteClose(Grpc::Status::Internal, "bad"); @@ -97,14 +96,14 @@ TEST_F(GrpcAccessLogStreamerImplTest, StreamFailure) { return nullptr; })); EXPECT_CALL(local_info_, node()); - envoy::api::v2::filter::accesslog::StreamAccessLogsMessage message_log1; + envoy::service::accesslog::v2::StreamAccessLogsMessage message_log1; streamer_->send(message_log1, "log1"); } class MockGrpcAccessLogStreamer : public GrpcAccessLogStreamer { public: // GrpcAccessLogStreamer - MOCK_METHOD2(send, void(envoy::api::v2::filter::accesslog::StreamAccessLogsMessage& message, + MOCK_METHOD2(send, void(envoy::service::accesslog::v2::StreamAccessLogsMessage& message, const std::string& log_name)); }; @@ -117,18 +116,18 @@ class HttpGrpcAccessLogTest : public testing::Test { } void expectLog(const std::string& expected_request_msg_yaml) { - envoy::api::v2::filter::accesslog::StreamAccessLogsMessage expected_request_msg; + envoy::service::accesslog::v2::StreamAccessLogsMessage expected_request_msg; MessageUtil::loadFromYaml(expected_request_msg_yaml, expected_request_msg); EXPECT_CALL(*streamer_, send(_, "hello_log")) - .WillOnce(Invoke([expected_request_msg]( - envoy::api::v2::filter::accesslog::StreamAccessLogsMessage& message, - const std::string&) { - EXPECT_EQ(message.DebugString(), expected_request_msg.DebugString()); - })); + .WillOnce(Invoke( + [expected_request_msg](envoy::service::accesslog::v2::StreamAccessLogsMessage& message, + const std::string&) { + EXPECT_EQ(message.DebugString(), expected_request_msg.DebugString()); + })); } MockFilter* filter_{new NiceMock()}; - envoy::api::v2::filter::accesslog::HttpGrpcAccessLogConfig config_; + envoy::config::accesslog::v2::HttpGrpcAccessLogConfig config_; std::shared_ptr streamer_{new MockGrpcAccessLogStreamer()}; std::unique_ptr access_log_; }; diff --git a/test/common/config/BUILD b/test/common/config/BUILD index 75e9115bde61c..972a027b5fa96 100644 --- a/test/common/config/BUILD +++ b/test/common/config/BUILD @@ -20,7 +20,6 @@ envoy_cc_test( envoy_cc_test_library( name = "filesystem_subscription_test_harness", srcs = ["filesystem_subscription_test_harness.h"], - external_deps = ["envoy_eds"], deps = [ ":subscription_test_harness", "//source/common/config:filesystem_subscription_lib", @@ -29,16 +28,13 @@ envoy_cc_test_library( "//test/mocks/config:config_mocks", "//test/test_common:environment_lib", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:eds_cc", ], ) envoy_cc_test( name = "grpc_mux_impl_test", srcs = ["grpc_mux_impl_test.cc"], - external_deps = [ - "envoy_discovery", - "envoy_eds", - ], deps = [ "//source/common/config:grpc_mux_lib", "//source/common/config:resources_lib", @@ -47,6 +43,9 @@ envoy_cc_test( "//test/mocks/event:event_mocks", "//test/mocks/grpc:grpc_mocks", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:discovery_cc", + "@envoy_api//envoy/api/v2:eds_cc", + "@envoy_api//envoy/service/discovery/v2:ads_cc", ], ) @@ -61,7 +60,6 @@ envoy_cc_test( envoy_cc_test_library( name = "grpc_subscription_test_harness", hdrs = ["grpc_subscription_test_harness.h"], - external_deps = ["envoy_eds"], deps = [ ":subscription_test_harness", "//source/common/common:hash_lib", @@ -72,6 +70,7 @@ envoy_cc_test_library( "//test/mocks/grpc:grpc_mocks", "//test/mocks/upstream:upstream_mocks", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:eds_cc", ], ) @@ -86,7 +85,6 @@ envoy_cc_test( envoy_cc_test_library( name = "http_subscription_test_harness", srcs = ["http_subscription_test_harness.h"], - external_deps = ["envoy_eds"], deps = [ ":subscription_test_harness", "//include/envoy/http:async_client_interface", @@ -99,16 +97,13 @@ envoy_cc_test_library( "//test/mocks/runtime:runtime_mocks", "//test/mocks/upstream:upstream_mocks", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:eds_cc", ], ) envoy_cc_test( name = "subscription_factory_test", srcs = ["subscription_factory_test.cc"], - external_deps = [ - "envoy_base", - "envoy_eds", - ], deps = [ "//source/common/config:subscription_factory_lib", "//test/mocks/config:config_mocks", @@ -119,6 +114,8 @@ envoy_cc_test( "//test/mocks/upstream:upstream_mocks", "//test/test_common:environment_lib", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:base_cc", + "@envoy_api//envoy/api/v2:eds_cc", ], ) @@ -154,7 +151,6 @@ envoy_cc_test( envoy_cc_test( name = "utility_test", srcs = ["utility_test.cc"], - external_deps = ["envoy_eds"], deps = [ "//source/common/config:cds_json_lib", "//source/common/config:lds_json_lib", @@ -168,6 +164,7 @@ envoy_cc_test( "//test/mocks/upstream:upstream_mocks", "//test/test_common:environment_lib", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:eds_cc", ], ) diff --git a/test/common/config/filesystem_subscription_test_harness.h b/test/common/config/filesystem_subscription_test_harness.h index d18fbc694a820..9f970e9d3087d 100644 --- a/test/common/config/filesystem_subscription_test_harness.h +++ b/test/common/config/filesystem_subscription_test_harness.h @@ -1,5 +1,7 @@ #include +#include "envoy/api/v2/eds.pb.h" + #include "common/config/filesystem_subscription_impl.h" #include "common/config/utility.h" #include "common/event/dispatcher_impl.h" @@ -9,7 +11,6 @@ #include "test/test_common/environment.h" #include "test/test_common/utility.h" -#include "api/eds.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/test/common/config/filter_json_test.cc b/test/common/config/filter_json_test.cc index e72863c5a1419..25bbf475f6061 100644 --- a/test/common/config/filter_json_test.cc +++ b/test/common/config/filter_json_test.cc @@ -1,7 +1,8 @@ +#include "envoy/api/v2/filter/http/router.pb.h" + #include "common/config/filter_json.h" #include "common/json/json_loader.h" -#include "api/filter/http/router.pb.h" #include "gtest/gtest.h" namespace Envoy { diff --git a/test/common/config/grpc_mux_impl_test.cc b/test/common/config/grpc_mux_impl_test.cc index f3af1f317ed0d..78bb7d8c68b51 100644 --- a/test/common/config/grpc_mux_impl_test.cc +++ b/test/common/config/grpc_mux_impl_test.cc @@ -1,3 +1,7 @@ +#include "envoy/api/v2/discovery.pb.h" +#include "envoy/api/v2/eds.pb.h" +#include "envoy/service/discovery/v2/ads.pb.h" + #include "common/config/grpc_mux_impl.h" #include "common/config/resources.h" #include "common/protobuf/protobuf.h" @@ -7,8 +11,6 @@ #include "test/mocks/grpc/mocks.h" #include "test/test_common/utility.h" -#include "api/discovery.pb.h" -#include "api/eds.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -32,10 +34,13 @@ class GrpcMuxImplTest : public testing::Test { timer_cb_ = timer_cb; return timer_; })); + + envoy::service::discovery::v2::AdsDummy dummy; + grpc_mux_.reset(new GrpcMuxImpl( envoy::api::v2::Node(), std::unique_ptr(async_client_), dispatcher_, *Protobuf::DescriptorPool::generated_pool()->FindMethodByName( - "envoy.api.v2.AggregatedDiscoveryService.StreamAggregatedResources"))); + "envoy.service.discovery.v2.AggregatedDiscoveryService.StreamAggregatedResources"))); } void expectSendMessage(const std::string& type_url, diff --git a/test/common/config/grpc_subscription_test_harness.h b/test/common/config/grpc_subscription_test_harness.h index 707c19ae68849..4513d69fcc260 100644 --- a/test/common/config/grpc_subscription_test_harness.h +++ b/test/common/config/grpc_subscription_test_harness.h @@ -1,5 +1,7 @@ #pragma once +#include "envoy/api/v2/eds.pb.h" + #include "common/common/hash.h" #include "common/config/grpc_subscription_impl.h" #include "common/config/resources.h" @@ -11,7 +13,6 @@ #include "test/mocks/upstream/mocks.h" #include "test/test_common/utility.h" -#include "api/eds.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/test/common/config/http_subscription_test_harness.h b/test/common/config/http_subscription_test_harness.h index 270fbcacdc683..3f7d4a5ef125d 100644 --- a/test/common/config/http_subscription_test_harness.h +++ b/test/common/config/http_subscription_test_harness.h @@ -1,3 +1,4 @@ +#include "envoy/api/v2/eds.pb.h" #include "envoy/http/async_client.h" #include "common/common/utility.h" @@ -13,7 +14,6 @@ #include "test/mocks/upstream/mocks.h" #include "test/test_common/utility.h" -#include "api/eds.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/test/common/config/subscription_factory_test.cc b/test/common/config/subscription_factory_test.cc index 06a260e79a91f..7d7abd87dce1e 100644 --- a/test/common/config/subscription_factory_test.cc +++ b/test/common/config/subscription_factory_test.cc @@ -1,3 +1,4 @@ +#include "envoy/api/v2/eds.pb.h" #include "envoy/common/exception.h" #include "common/config/subscription_factory.h" @@ -11,7 +12,6 @@ #include "test/test_common/environment.h" #include "test/test_common/utility.h" -#include "api/eds.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/test/common/config/utility_test.cc b/test/common/config/utility_test.cc index 70521f80436a9..428fbbe470655 100644 --- a/test/common/config/utility_test.cc +++ b/test/common/config/utility_test.cc @@ -1,3 +1,4 @@ +#include "envoy/api/v2/eds.pb.h" #include "envoy/common/exception.h" #include "common/config/cds_json.h" @@ -15,7 +16,6 @@ #include "test/test_common/environment.h" #include "test/test_common/utility.h" -#include "api/eds.pb.h" #include "fmt/format.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -85,7 +85,7 @@ TEST(UtilityTest, TranslateApiConfigSource) { } TEST(UtilityTest, createTagProducer) { - envoy::api::v2::Bootstrap bootstrap; + envoy::config::bootstrap::v2::Bootstrap bootstrap; auto producer = Utility::createTagProducer(bootstrap); ASSERT(producer != nullptr); std::vector tags; @@ -121,7 +121,7 @@ TEST(UtilityTest, ObjNameLength) { err_prefix = "Invalid virtual host name"; std::string json = R"EOF({ "name": ")EOF" + name + R"EOF(", "domains": [], "routes": []})EOF"; auto json_object_ptr = Json::Factory::loadFromString(json); - envoy::api::v2::VirtualHost vhost; + envoy::api::v2::route::VirtualHost vhost; EXPECT_THROW_WITH_MESSAGE(Config::RdsJson::translateVirtualHost(*json_object_ptr, vhost), EnvoyException, err_prefix + err_suffix); } diff --git a/test/common/mongo/proxy_test.cc b/test/common/mongo/proxy_test.cc index a6d2e647b8e8b..1b2b5151b8322 100644 --- a/test/common/mongo/proxy_test.cc +++ b/test/common/mongo/proxy_test.cc @@ -3,6 +3,8 @@ #include #include +#include "envoy/api/v2/filter/fault.pb.h" + #include "common/mongo/bson_impl.h" #include "common/mongo/codec_impl.h" #include "common/mongo/proxy.h" @@ -15,7 +17,6 @@ #include "test/mocks/runtime/mocks.h" #include "test/test_common/printers.h" -#include "api/filter/fault.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/test/common/network/resolver_impl_test.cc b/test/common/network/resolver_impl_test.cc index 248015ed6f042..bc1bd39b1e351 100644 --- a/test/common/network/resolver_impl_test.cc +++ b/test/common/network/resolver_impl_test.cc @@ -2,6 +2,7 @@ #include #include +#include "envoy/api/v2/address.pb.h" #include "envoy/common/exception.h" #include "envoy/network/resolver.h" #include "envoy/registry/registry.h" @@ -15,7 +16,6 @@ #include "test/test_common/registry.h" #include "test/test_common/utility.h" -#include "api/address.pb.h" #include "gtest/gtest.h" namespace Envoy { diff --git a/test/common/protobuf/BUILD b/test/common/protobuf/BUILD index 526f49ec6aa65..95a59961695a7 100644 --- a/test/common/protobuf/BUILD +++ b/test/common/protobuf/BUILD @@ -11,10 +11,10 @@ envoy_package() envoy_cc_test( name = "utility_test", srcs = ["utility_test.cc"], - external_deps = ["envoy_bootstrap"], deps = [ "//source/common/protobuf:utility_lib", "//test/test_common:environment_lib", "//test/test_common:utility_lib", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) diff --git a/test/common/protobuf/utility_test.cc b/test/common/protobuf/utility_test.cc index 5237c3e8b2bcd..766d3936da6fa 100644 --- a/test/common/protobuf/utility_test.cc +++ b/test/common/protobuf/utility_test.cc @@ -1,26 +1,28 @@ #include +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" +#include "envoy/config/bootstrap/v2/bootstrap.pb.validate.h" + #include "common/protobuf/protobuf.h" #include "common/protobuf/utility.h" #include "test/test_common/environment.h" #include "test/test_common/utility.h" -#include "api/bootstrap.pb.h" -#include "api/bootstrap.pb.validate.h" #include "gtest/gtest.h" namespace Envoy { TEST(UtilityTest, DowncastAndValidate) { - envoy::api::v2::Bootstrap bootstrap; + envoy::config::bootstrap::v2::Bootstrap bootstrap; EXPECT_THROW(MessageUtil::validate(bootstrap), ProtoValidationException); - EXPECT_THROW(MessageUtil::downcastAndValidate(bootstrap), - ProtoValidationException); + EXPECT_THROW( + MessageUtil::downcastAndValidate(bootstrap), + ProtoValidationException); } TEST(UtilityTest, LoadBinaryProtoFromFile) { - envoy::api::v2::Bootstrap bootstrap; + envoy::config::bootstrap::v2::Bootstrap bootstrap; bootstrap.mutable_cluster_manager() ->mutable_upstream_bind_config() ->mutable_source_address() @@ -29,13 +31,13 @@ TEST(UtilityTest, LoadBinaryProtoFromFile) { const std::string filename = TestEnvironment::writeStringToFileForTest("proto.pb", bootstrap.SerializeAsString()); - envoy::api::v2::Bootstrap proto_from_file; + envoy::config::bootstrap::v2::Bootstrap proto_from_file; MessageUtil::loadFromFile(filename, proto_from_file); EXPECT_TRUE(TestUtility::protoEqual(bootstrap, proto_from_file)); } TEST(UtilityTest, LoadTextProtoFromFile) { - envoy::api::v2::Bootstrap bootstrap; + envoy::config::bootstrap::v2::Bootstrap bootstrap; bootstrap.mutable_cluster_manager() ->mutable_upstream_bind_config() ->mutable_source_address() @@ -46,7 +48,7 @@ TEST(UtilityTest, LoadTextProtoFromFile) { const std::string filename = TestEnvironment::writeStringToFileForTest("proto.pb_text", bootstrap_text); - envoy::api::v2::Bootstrap proto_from_file; + envoy::config::bootstrap::v2::Bootstrap proto_from_file; MessageUtil::loadFromFile(filename, proto_from_file); EXPECT_TRUE(TestUtility::protoEqual(bootstrap, proto_from_file)); } @@ -55,10 +57,10 @@ TEST(UtilityTest, LoadTextProtoFromFile_Failure) { const std::string filename = TestEnvironment::writeStringToFileForTest("proto.pb_text", "invalid {"); - envoy::api::v2::Bootstrap proto_from_file; + envoy::config::bootstrap::v2::Bootstrap proto_from_file; EXPECT_THROW_WITH_MESSAGE(MessageUtil::loadFromFile(filename, proto_from_file), EnvoyException, "Unable to parse file \"" + filename + - "\" as a text protobuf (type envoy.api.v2.Bootstrap)"); + "\" as a text protobuf (type envoy.config.bootstrap.v2.Bootstrap)"); } TEST(UtilityTest, ValueUtilEqual_NullValues) { diff --git a/test/common/ratelimit/ratelimit_impl_test.cc b/test/common/ratelimit/ratelimit_impl_test.cc index 5aa2aadfd6c17..846356b00f91a 100644 --- a/test/common/ratelimit/ratelimit_impl_test.cc +++ b/test/common/ratelimit/ratelimit_impl_test.cc @@ -120,7 +120,7 @@ TEST_F(RateLimitGrpcClientTest, Cancel) { } TEST(RateLimitGrpcFactoryTest, Create) { - envoy::api::v2::RateLimitServiceConfig config; + envoy::config::ratelimit::v2::RateLimitServiceConfig config; config.mutable_grpc_service()->mutable_envoy_grpc()->set_cluster_name("foo"); Grpc::MockAsyncClientManager async_client_manager; Stats::MockStore scope; @@ -135,7 +135,7 @@ TEST(RateLimitGrpcFactoryTest, Create) { // TODO(htuch): cluster_name is deprecated, remove after 1.6.0. TEST(RateLimitGrpcFactoryTest, CreateLegacy) { - envoy::api::v2::RateLimitServiceConfig config; + envoy::config::ratelimit::v2::RateLimitServiceConfig config; config.set_cluster_name("foo"); Grpc::MockAsyncClientManager async_client_manager; Stats::MockStore scope; diff --git a/test/common/router/BUILD b/test/common/router/BUILD index 80d924b43f42b..791b6dfadc1e7 100644 --- a/test/common/router/BUILD +++ b/test/common/router/BUILD @@ -61,7 +61,6 @@ envoy_cc_test( envoy_cc_test( name = "router_ratelimit_test", srcs = ["router_ratelimit_test.cc"], - external_deps = ["envoy_rds"], deps = [ "//source/common/http:header_map_lib", "//source/common/json:json_loader_lib", @@ -72,6 +71,7 @@ envoy_cc_test( "//test/mocks/router:router_mocks", "//test/mocks/upstream:upstream_mocks", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:rds_cc", ], ) @@ -100,7 +100,6 @@ envoy_cc_test( envoy_cc_test( name = "router_upstream_log_test", srcs = ["router_upstream_log_test.cc"], - external_deps = ["envoy_filter_http_router"], deps = [ "//include/envoy/common:optional", "//source/common/buffer:buffer_lib", @@ -122,6 +121,7 @@ envoy_cc_test( "//test/mocks/ssl:ssl_mocks", "//test/mocks/upstream:upstream_mocks", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2/filter/http:router_cc", ], ) diff --git a/test/common/router/config_impl_test.cc b/test/common/router/config_impl_test.cc index 3828d1ecd311e..092ed540f1ae7 100644 --- a/test/common/router/config_impl_test.cc +++ b/test/common/router/config_impl_test.cc @@ -1231,7 +1231,7 @@ class RouterMatcherHashPolicyTest : public testing::Test { route_config_ = parseRouteConfigurationFromJson(json); } - envoy::api::v2::RouteAction_HashPolicy* firstRouteHashPolicy() { + envoy::api::v2::route::RouteAction_HashPolicy* firstRouteHashPolicy() { auto hash_policies = route_config_.mutable_virtual_hosts(0) ->mutable_routes(0) ->mutable_route() @@ -1490,7 +1490,7 @@ TEST_F(RouterMatcherHashPolicyTest, InvalidHashPolicies) { NiceMock cm; { auto hash_policy = firstRouteHashPolicy(); - EXPECT_EQ(envoy::api::v2::RouteAction::HashPolicy::POLICY_SPECIFIER_NOT_SET, + EXPECT_EQ(envoy::api::v2::route::RouteAction::HashPolicy::POLICY_SPECIFIER_NOT_SET, hash_policy->policy_specifier_case()); EXPECT_THROW(config(), EnvoyException); } @@ -1499,7 +1499,7 @@ TEST_F(RouterMatcherHashPolicyTest, InvalidHashPolicies) { route->add_hash_policy()->mutable_header()->set_header_name("foo_header"); route->add_hash_policy()->mutable_connection_properties()->set_source_ip(true); auto hash_policy = route->add_hash_policy(); - EXPECT_EQ(envoy::api::v2::RouteAction::HashPolicy::POLICY_SPECIFIER_NOT_SET, + EXPECT_EQ(envoy::api::v2::route::RouteAction::HashPolicy::POLICY_SPECIFIER_NOT_SET, hash_policy->policy_specifier_case()); EXPECT_THROW(config(), EnvoyException); } @@ -3590,15 +3590,17 @@ TEST(RouteEntryMetadataMatchTest, ParsesMetadata) { } TEST(ConfigUtility, ParseResponseCode) { - const std::vector> - test_set = {std::make_pair(envoy::api::v2::RedirectAction::MOVED_PERMANENTLY, - Http::Code::MovedPermanently), - std::make_pair(envoy::api::v2::RedirectAction::FOUND, Http::Code::Found), - std::make_pair(envoy::api::v2::RedirectAction::SEE_OTHER, Http::Code::SeeOther), - std::make_pair(envoy::api::v2::RedirectAction::TEMPORARY_REDIRECT, - Http::Code::TemporaryRedirect), - std::make_pair(envoy::api::v2::RedirectAction::PERMANENT_REDIRECT, - Http::Code::PermanentRedirect)}; + const std::vector< + std::pair> + test_set = { + std::make_pair(envoy::api::v2::route::RedirectAction::MOVED_PERMANENTLY, + Http::Code::MovedPermanently), + std::make_pair(envoy::api::v2::route::RedirectAction::FOUND, Http::Code::Found), + std::make_pair(envoy::api::v2::route::RedirectAction::SEE_OTHER, Http::Code::SeeOther), + std::make_pair(envoy::api::v2::route::RedirectAction::TEMPORARY_REDIRECT, + Http::Code::TemporaryRedirect), + std::make_pair(envoy::api::v2::route::RedirectAction::PERMANENT_REDIRECT, + Http::Code::PermanentRedirect)}; for (const auto& test_case : test_set) { EXPECT_EQ(test_case.second, ConfigUtility::parseRedirectResponseCode(test_case.first)); } diff --git a/test/common/router/header_formatter_test.cc b/test/common/router/header_formatter_test.cc index 68a6536dd75ba..bd1d51d69bbad 100644 --- a/test/common/router/header_formatter_test.cc +++ b/test/common/router/header_formatter_test.cc @@ -1,5 +1,6 @@ #include +#include "envoy/api/v2/base.pb.h" #include "envoy/http/protocol.h" #include "common/config/metadata.h" @@ -20,15 +21,15 @@ using testing::ReturnRef; namespace Envoy { namespace Router { -static envoy::api::v2::Route parseRouteFromJson(const std::string& json_string) { - envoy::api::v2::Route route; +static envoy::api::v2::route::Route parseRouteFromJson(const std::string& json_string) { + envoy::api::v2::route::Route route; auto json_object_ptr = Json::Factory::loadFromString(json_string); Envoy::Config::RdsJson::translateRoute(*json_object_ptr, route); return route; } -static envoy::api::v2::Route parseRouteFromV2Yaml(const std::string& yaml) { - envoy::api::v2::Route route; +static envoy::api::v2::route::Route parseRouteFromV2Yaml(const std::string& yaml) { + envoy::api::v2::route::Route route; MessageUtil::loadFromYaml(yaml, route); return route; } @@ -589,7 +590,7 @@ TEST(HeaderParserTest, EvaluateHeadersWithAppendFalse) { )EOF"; // Disable append mode. - envoy::api::v2::RouteAction route_action = parseRouteFromJson(json).route(); + envoy::api::v2::route::RouteAction route_action = parseRouteFromJson(json).route(); route_action.mutable_request_headers_to_add(0)->mutable_append()->set_value(false); route_action.mutable_request_headers_to_add(1)->mutable_append()->set_value(false); diff --git a/test/common/router/router_ratelimit_test.cc b/test/common/router/router_ratelimit_test.cc index 9b9583092d0d3..069f939fcd344 100644 --- a/test/common/router/router_ratelimit_test.cc +++ b/test/common/router/router_ratelimit_test.cc @@ -27,8 +27,8 @@ namespace Envoy { namespace Router { namespace { -envoy::api::v2::RateLimit parseRateLimitFromJson(const std::string& json_string) { - envoy::api::v2::RateLimit rate_limit; +envoy::api::v2::route::RateLimit parseRateLimitFromJson(const std::string& json_string) { + envoy::api::v2::route::RateLimit rate_limit; auto json_object_ptr = Json::Factory::loadFromString(json_string); Envoy::Config::RdsJson::translateRateLimit(*json_object_ptr, rate_limit); return rate_limit; diff --git a/test/common/ssl/context_impl_test.cc b/test/common/ssl/context_impl_test.cc index cd1d73a8c625f..bded5be55ecfb 100644 --- a/test/common/ssl/context_impl_test.cc +++ b/test/common/ssl/context_impl_test.cc @@ -178,9 +178,9 @@ class SslServerContextImplTicketTest : public SslContextImplTest { ServerContextPtr server_ctx(manager.createSslServerContext("", {}, store, cfg, true)); } - static void loadConfigV2(envoy::api::v2::DownstreamTlsContext& cfg) { + static void loadConfigV2(envoy::api::v2::auth::DownstreamTlsContext& cfg) { // Must add a certificate for the config to be considered valid. - envoy::api::v2::TlsCertificate* server_cert = + envoy::api::v2::auth::TlsCertificate* server_cert = cfg.mutable_common_tls_context()->add_tls_certificates(); server_cert->mutable_certificate_chain()->set_filename( TestEnvironment::substitute("{{ test_tmpdir }}/unittestcert.pem")); @@ -245,42 +245,42 @@ TEST_F(SslServerContextImplTicketTest, TicketKeyInvalidCannotRead) { } TEST_F(SslServerContextImplTicketTest, TicketKeyNone) { - envoy::api::v2::DownstreamTlsContext cfg; + envoy::api::v2::auth::DownstreamTlsContext cfg; EXPECT_NO_THROW(loadConfigV2(cfg)); } TEST_F(SslServerContextImplTicketTest, TicketKeyInlineBytesSuccess) { - envoy::api::v2::DownstreamTlsContext cfg; + envoy::api::v2::auth::DownstreamTlsContext cfg; cfg.mutable_session_ticket_keys()->add_keys()->set_inline_bytes(std::string(80, '\0')); EXPECT_NO_THROW(loadConfigV2(cfg)); } TEST_F(SslServerContextImplTicketTest, TicketKeyInlineStringSuccess) { - envoy::api::v2::DownstreamTlsContext cfg; + envoy::api::v2::auth::DownstreamTlsContext cfg; cfg.mutable_session_ticket_keys()->add_keys()->set_inline_string(std::string(80, '\0')); EXPECT_NO_THROW(loadConfigV2(cfg)); } TEST_F(SslServerContextImplTicketTest, TicketKeyInlineBytesFailTooBig) { - envoy::api::v2::DownstreamTlsContext cfg; + envoy::api::v2::auth::DownstreamTlsContext cfg; cfg.mutable_session_ticket_keys()->add_keys()->set_inline_bytes(std::string(81, '\0')); EXPECT_THROW(loadConfigV2(cfg), EnvoyException); } TEST_F(SslServerContextImplTicketTest, TicketKeyInlineStringFailTooBig) { - envoy::api::v2::DownstreamTlsContext cfg; + envoy::api::v2::auth::DownstreamTlsContext cfg; cfg.mutable_session_ticket_keys()->add_keys()->set_inline_string(std::string(81, '\0')); EXPECT_THROW(loadConfigV2(cfg), EnvoyException); } TEST_F(SslServerContextImplTicketTest, TicketKeyInlineBytesFailTooSmall) { - envoy::api::v2::DownstreamTlsContext cfg; + envoy::api::v2::auth::DownstreamTlsContext cfg; cfg.mutable_session_ticket_keys()->add_keys()->set_inline_bytes(std::string(79, '\0')); EXPECT_THROW(loadConfigV2(cfg), EnvoyException); } TEST_F(SslServerContextImplTicketTest, TicketKeyInlineStringFailTooSmall) { - envoy::api::v2::DownstreamTlsContext cfg; + envoy::api::v2::auth::DownstreamTlsContext cfg; cfg.mutable_session_ticket_keys()->add_keys()->set_inline_string(std::string(79, '\0')); EXPECT_THROW(loadConfigV2(cfg), EnvoyException); } diff --git a/test/common/ssl/ssl_socket_test.cc b/test/common/ssl/ssl_socket_test.cc index f1bde2f0fe41e..e5f321e79cc61 100644 --- a/test/common/ssl/ssl_socket_test.cc +++ b/test/common/ssl/ssl_socket_test.cc @@ -118,7 +118,7 @@ void testUtil(const std::string& client_ctx_json, const std::string& server_ctx_ } const std::string testUtilV2(const envoy::api::v2::Listener& server_proto, - const envoy::api::v2::UpstreamTlsContext& client_ctx_proto, + const envoy::api::v2::auth::UpstreamTlsContext& client_ctx_proto, const std::string& client_session, bool expect_success, const std::string& expected_protocol_version, const std::string& expected_server_cert_digest, @@ -274,8 +274,8 @@ TEST_P(SslSocketTest, GetCertDigest) { TEST_P(SslSocketTest, GetCertDigestInline) { envoy::api::v2::Listener listener; - envoy::api::v2::FilterChain* filter_chain = listener.add_filter_chains(); - envoy::api::v2::TlsCertificate* server_cert = + envoy::api::v2::listener::FilterChain* filter_chain = listener.add_filter_chains(); + envoy::api::v2::auth::TlsCertificate* server_cert = filter_chain->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); // From test/common/ssl/test_data/san_dns_cert.pem. @@ -360,8 +360,8 @@ TEST_P(SslSocketTest, GetCertDigestInline) { "SA==\n" "-----END CERTIFICATE-----"); - envoy::api::v2::UpstreamTlsContext client_ctx; - envoy::api::v2::TlsCertificate* client_cert = + envoy::api::v2::auth::UpstreamTlsContext client_ctx; + envoy::api::v2::auth::TlsCertificate* client_cert = client_ctx.mutable_common_tls_context()->add_tls_certificates(); // From test/common/ssl/test_data/san_uri_cert.pem. @@ -1284,18 +1284,18 @@ TEST_P(SslSocketTest, SslError) { TEST_P(SslSocketTest, ProtocolVersions) { envoy::api::v2::Listener listener; - envoy::api::v2::FilterChain* filter_chain = listener.add_filter_chains(); - envoy::api::v2::TlsCertificate* server_cert = + envoy::api::v2::listener::FilterChain* filter_chain = listener.add_filter_chains(); + envoy::api::v2::auth::TlsCertificate* server_cert = filter_chain->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert->mutable_certificate_chain()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_cert.pem")); server_cert->mutable_private_key()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_key.pem")); - envoy::api::v2::TlsParameters* server_params = + envoy::api::v2::auth::TlsParameters* server_params = filter_chain->mutable_tls_context()->mutable_common_tls_context()->mutable_tls_params(); - envoy::api::v2::UpstreamTlsContext client_ctx; - envoy::api::v2::TlsParameters* client_params = + envoy::api::v2::auth::UpstreamTlsContext client_ctx; + envoy::api::v2::auth::TlsParameters* client_params = client_ctx.mutable_common_tls_context()->mutable_tls_params(); // Connection using defaults (client & server) succeeds, negotiating TLSv1.2. @@ -1303,64 +1303,64 @@ TEST_P(SslSocketTest, ProtocolVersions) { // Connection using TLSv1.0 (client) and defaults (server) succeeds. // ssl.handshake logged by both: client & server. - client_params->set_tls_minimum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_0); - client_params->set_tls_maximum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_0); + client_params->set_tls_minimum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_0); + client_params->set_tls_maximum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_0); testUtilV2(listener, client_ctx, "", true, "TLSv1", "", "", "", "ssl.handshake", 2, GetParam()); // Connection using TLSv1.1 (client) and defaults (server) succeeds. // ssl.handshake logged by both: client & server. - client_params->set_tls_minimum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_1); - client_params->set_tls_maximum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_1); + client_params->set_tls_minimum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_1); + client_params->set_tls_maximum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_1); testUtilV2(listener, client_ctx, "", true, "TLSv1.1", "", "", "", "ssl.handshake", 2, GetParam()); // Connection using TLSv1.2 (client) and defaults (server) succeeds. // ssl.handshake logged by both: client & server. - client_params->set_tls_minimum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_2); - client_params->set_tls_maximum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_2); + client_params->set_tls_minimum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_2); + client_params->set_tls_maximum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_2); testUtilV2(listener, client_ctx, "", true, "TLSv1.2", "", "", "", "ssl.handshake", 2, GetParam()); // Connection using TLSv1.3 (client) and defaults (server) fails. - client_params->set_tls_minimum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_3); - client_params->set_tls_maximum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_3); + client_params->set_tls_minimum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_3); + client_params->set_tls_maximum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_3); testUtilV2(listener, client_ctx, "", false, "", "", "", "", "ssl.connection_error", 1, GetParam()); // Connection using TLSv1.3 (client) and TLSv1.0-1.3 (server) succeeds. // ssl.handshake logged by both: client & server. - server_params->set_tls_minimum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_0); - server_params->set_tls_maximum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_3); + server_params->set_tls_minimum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_0); + server_params->set_tls_maximum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_3); testUtilV2(listener, client_ctx, "", true, "TLSv1.3", "", "", "", "ssl.handshake", 2, GetParam()); // Connection using defaults (client) and TLSv1.0 (server) succeeds. // ssl.handshake logged by both: client & server. client_params->clear_tls_minimum_protocol_version(); client_params->clear_tls_maximum_protocol_version(); - server_params->set_tls_minimum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_0); - server_params->set_tls_maximum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_0); + server_params->set_tls_minimum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_0); + server_params->set_tls_maximum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_0); testUtilV2(listener, client_ctx, "", true, "TLSv1", "", "", "", "ssl.handshake", 2, GetParam()); // Connection using defaults (client) and TLSv1.1 (server) succeeds. // ssl.handshake logged by both: client & server. - server_params->set_tls_minimum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_1); - server_params->set_tls_maximum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_1); + server_params->set_tls_minimum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_1); + server_params->set_tls_maximum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_1); testUtilV2(listener, client_ctx, "", true, "TLSv1.1", "", "", "", "ssl.handshake", 2, GetParam()); // Connection using defaults (client) and TLSv1.2 (server) succeeds. // ssl.handshake logged by both: client & server. - server_params->set_tls_minimum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_2); - server_params->set_tls_maximum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_2); + server_params->set_tls_minimum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_2); + server_params->set_tls_maximum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_2); testUtilV2(listener, client_ctx, "", true, "TLSv1.2", "", "", "", "ssl.handshake", 2, GetParam()); // Connection using defaults (client) and TLSv1.3 (server) succeeds. - server_params->set_tls_minimum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_3); - server_params->set_tls_maximum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_3); + server_params->set_tls_minimum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_3); + server_params->set_tls_maximum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_3); testUtilV2(listener, client_ctx, "", false, "", "", "", "", "ssl.connection_error", 1, GetParam()); // Connection using TLSv1.0-TLSv1.3 (client) and TLSv1.3 (server) succeeds. // ssl.handshake logged by both: client & server. - client_params->set_tls_minimum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_0); - client_params->set_tls_maximum_protocol_version(envoy::api::v2::TlsParameters::TLSv1_3); + client_params->set_tls_minimum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_0); + client_params->set_tls_maximum_protocol_version(envoy::api::v2::auth::TlsParameters::TLSv1_3); testUtilV2(listener, client_ctx, "", true, "TLSv1.3", "", "", "", "ssl.handshake", 2, GetParam()); } @@ -1368,9 +1368,9 @@ TEST_P(SslSocketTest, SniCertificate) { envoy::api::v2::Listener listener; // san_dns_cert.pem: server1.example.com - envoy::api::v2::FilterChain* filter_chain1 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain1 = listener.add_filter_chains(); filter_chain1->mutable_filter_chain_match()->add_sni_domains("server1.example.com"); - envoy::api::v2::TlsCertificate* server_cert1 = + envoy::api::v2::auth::TlsCertificate* server_cert1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert1->mutable_certificate_chain()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_cert.pem")); @@ -1378,17 +1378,17 @@ TEST_P(SslSocketTest, SniCertificate) { TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_key.pem")); // san_multiple_dns_cert.pem: server2.example.com, *.example.com - envoy::api::v2::FilterChain* filter_chain2 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain2 = listener.add_filter_chains(); filter_chain2->mutable_filter_chain_match()->add_sni_domains("server2.example.com"); filter_chain2->mutable_filter_chain_match()->add_sni_domains("*.example.com"); - envoy::api::v2::TlsCertificate* server_cert2 = + envoy::api::v2::auth::TlsCertificate* server_cert2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert2->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_cert.pem")); server_cert2->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_key.pem")); - envoy::api::v2::UpstreamTlsContext client_ctx; + envoy::api::v2::auth::UpstreamTlsContext client_ctx; // Connection to server1.example.com succeeds, client receives san_dns_cert.pem (exact match). // ssl.handshake logged by both: client & server. @@ -1416,8 +1416,8 @@ TEST_P(SslSocketTest, SniCertificate) { GetParam()); // no_san_cert.pem: * (no SNI restrictions) - envoy::api::v2::FilterChain* filter_chain3 = listener.add_filter_chains(); - envoy::api::v2::TlsCertificate* server_cert3 = + envoy::api::v2::listener::FilterChain* filter_chain3 = listener.add_filter_chains(); + envoy::api::v2::auth::TlsCertificate* server_cert3 = filter_chain3->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert3->mutable_certificate_chain()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/no_san_cert.pem")); @@ -1443,10 +1443,10 @@ TEST_P(SslSocketTest, SniSessionResumption) { envoy::api::v2::Listener listener; // san_dns_cert.pem: server1.example.com, * - envoy::api::v2::FilterChain* filter_chain1 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain1 = listener.add_filter_chains(); filter_chain1->mutable_filter_chain_match()->add_sni_domains("server1.example.com"); filter_chain1->mutable_filter_chain_match()->add_sni_domains(""); // Catch-all, no SNI. - envoy::api::v2::TlsCertificate* server_cert1 = + envoy::api::v2::auth::TlsCertificate* server_cert1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert1->mutable_certificate_chain()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_cert.pem")); @@ -1456,10 +1456,10 @@ TEST_P(SslSocketTest, SniSessionResumption) { TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/ticket_key_a")); // san_multiple_dns_cert.pem: server2.example.com, *.example.com - envoy::api::v2::FilterChain* filter_chain2 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain2 = listener.add_filter_chains(); filter_chain2->mutable_filter_chain_match()->add_sni_domains("server2.example.com"); filter_chain2->mutable_filter_chain_match()->add_sni_domains("*.example.com"); - envoy::api::v2::TlsCertificate* server_cert2 = + envoy::api::v2::auth::TlsCertificate* server_cert2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert2->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_cert.pem")); @@ -1469,9 +1469,9 @@ TEST_P(SslSocketTest, SniSessionResumption) { TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/ticket_key_a")); // san_multiple_dns_cert.pem: protected.example.com (same certificate as #2, but different SNI) - envoy::api::v2::FilterChain* filter_chain3 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain3 = listener.add_filter_chains(); filter_chain3->mutable_filter_chain_match()->add_sni_domains("protected.example.com"); - envoy::api::v2::TlsCertificate* server_cert3 = + envoy::api::v2::auth::TlsCertificate* server_cert3 = filter_chain3->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert3->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_cert.pem")); @@ -1480,7 +1480,7 @@ TEST_P(SslSocketTest, SniSessionResumption) { filter_chain3->mutable_tls_context()->mutable_session_ticket_keys()->add_keys()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/ticket_key_a")); - envoy::api::v2::UpstreamTlsContext client_ctx; + envoy::api::v2::auth::UpstreamTlsContext client_ctx; // Connection to www.example.com succeeds, new session established. client_ctx.set_sni("www.example.com"); @@ -1522,9 +1522,9 @@ TEST_P(SslSocketTest, SniClientCertificate) { envoy::api::v2::Listener listener; // san_multiple_dns_cert.pem: *.example.com - envoy::api::v2::FilterChain* filter_chain1 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain1 = listener.add_filter_chains(); filter_chain1->mutable_filter_chain_match()->add_sni_domains("*.example.com"); - envoy::api::v2::TlsCertificate* server_cert1 = + envoy::api::v2::auth::TlsCertificate* server_cert1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert1->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_cert.pem")); @@ -1535,9 +1535,9 @@ TEST_P(SslSocketTest, SniClientCertificate) { // san_multiple_dns_cert.pem: protected.example.com // (same certificate as #1, but requires Client Certificate) - envoy::api::v2::FilterChain* filter_chain2 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain2 = listener.add_filter_chains(); filter_chain2->mutable_filter_chain_match()->add_sni_domains("protected.example.com"); - envoy::api::v2::TlsCertificate* server_cert2 = + envoy::api::v2::auth::TlsCertificate* server_cert2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert2->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_cert.pem")); @@ -1546,7 +1546,7 @@ TEST_P(SslSocketTest, SniClientCertificate) { filter_chain2->mutable_tls_context()->mutable_session_ticket_keys()->add_keys()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/ticket_key_a")); filter_chain2->mutable_tls_context()->mutable_require_client_certificate()->set_value(true); - envoy::api::v2::CertificateValidationContext* validation_ctx2 = + envoy::api::v2::auth::CertificateValidationContext* validation_ctx2 = filter_chain2->mutable_tls_context() ->mutable_common_tls_context() ->mutable_validation_context(); @@ -1554,7 +1554,7 @@ TEST_P(SslSocketTest, SniClientCertificate) { validation_ctx2->mutable_trusted_ca()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/ca_cert.pem")); - envoy::api::v2::UpstreamTlsContext client_ctx; + envoy::api::v2::auth::UpstreamTlsContext client_ctx; // Connection to www.example.com succeeds. // ssl.handshake logged by both: client & server. @@ -1570,7 +1570,7 @@ TEST_P(SslSocketTest, SniClientCertificate) { // Connection to protected.example.com with a valid client certificate fails, beacuse its SAN // is not whitelisted. - envoy::api::v2::TlsCertificate* client_cert = + envoy::api::v2::auth::TlsCertificate* client_cert = client_ctx.mutable_common_tls_context()->add_tls_certificates(); client_cert->mutable_certificate_chain()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_uri_cert.pem")); @@ -1597,9 +1597,9 @@ TEST_P(SslSocketTest, SniALPN) { envoy::api::v2::Listener listener; // san_dns_cert.pem: server1.example.com - envoy::api::v2::FilterChain* filter_chain1 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain1 = listener.add_filter_chains(); filter_chain1->mutable_filter_chain_match()->add_sni_domains("server1.example.com"); - envoy::api::v2::TlsCertificate* server_cert1 = + envoy::api::v2::auth::TlsCertificate* server_cert1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert1->mutable_certificate_chain()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_cert.pem")); @@ -1607,20 +1607,20 @@ TEST_P(SslSocketTest, SniALPN) { TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_key.pem")); // san_multiple_dns_cert.pem: server2.example.com - envoy::api::v2::FilterChain* filter_chain2 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain2 = listener.add_filter_chains(); filter_chain2->mutable_filter_chain_match()->add_sni_domains("server2.example.com"); - envoy::api::v2::TlsCertificate* server_cert2 = + envoy::api::v2::auth::TlsCertificate* server_cert2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert2->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_cert.pem")); server_cert2->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_key.pem")); - envoy::api::v2::CommonTlsContext* server_ctx1 = + envoy::api::v2::auth::CommonTlsContext* server_ctx1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context(); - envoy::api::v2::CommonTlsContext* server_ctx2 = + envoy::api::v2::auth::CommonTlsContext* server_ctx2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context(); - envoy::api::v2::UpstreamTlsContext client_ctx; + envoy::api::v2::auth::UpstreamTlsContext client_ctx; // Test ALPN. server_ctx1->add_alpn_protocols("srv1"); @@ -1647,9 +1647,9 @@ TEST_P(SslSocketTest, SniCipherSuites) { envoy::api::v2::Listener listener; // san_dns_cert.pem: server1.example.com - envoy::api::v2::FilterChain* filter_chain1 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain1 = listener.add_filter_chains(); filter_chain1->mutable_filter_chain_match()->add_sni_domains("server1.example.com"); - envoy::api::v2::TlsCertificate* server_cert1 = + envoy::api::v2::auth::TlsCertificate* server_cert1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert1->mutable_certificate_chain()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_cert.pem")); @@ -1657,20 +1657,20 @@ TEST_P(SslSocketTest, SniCipherSuites) { TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_key.pem")); // san_multiple_dns_cert.pem: server2.example.com - envoy::api::v2::FilterChain* filter_chain2 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain2 = listener.add_filter_chains(); filter_chain2->mutable_filter_chain_match()->add_sni_domains("server2.example.com"); - envoy::api::v2::TlsCertificate* server_cert2 = + envoy::api::v2::auth::TlsCertificate* server_cert2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert2->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_cert.pem")); server_cert2->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_key.pem")); - envoy::api::v2::CommonTlsContext* server_ctx1 = + envoy::api::v2::auth::CommonTlsContext* server_ctx1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context(); - envoy::api::v2::CommonTlsContext* server_ctx2 = + envoy::api::v2::auth::CommonTlsContext* server_ctx2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context(); - envoy::api::v2::UpstreamTlsContext client_ctx; + envoy::api::v2::auth::UpstreamTlsContext client_ctx; // Test cipher suites. server_ctx1->mutable_tls_params()->add_cipher_suites("ECDHE-RSA-CHACHA20-POLY1305"); @@ -1710,9 +1710,9 @@ TEST_P(SslSocketTest, SniEcdhCurves) { envoy::api::v2::Listener listener; // san_dns_cert.pem: server1.example.com - envoy::api::v2::FilterChain* filter_chain1 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain1 = listener.add_filter_chains(); filter_chain1->mutable_filter_chain_match()->add_sni_domains("server1.example.com"); - envoy::api::v2::TlsCertificate* server_cert1 = + envoy::api::v2::auth::TlsCertificate* server_cert1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert1->mutable_certificate_chain()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_cert.pem")); @@ -1720,20 +1720,20 @@ TEST_P(SslSocketTest, SniEcdhCurves) { TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_key.pem")); // san_multiple_dns_cert.pem: server2.example.com - envoy::api::v2::FilterChain* filter_chain2 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain2 = listener.add_filter_chains(); filter_chain2->mutable_filter_chain_match()->add_sni_domains("server2.example.com"); - envoy::api::v2::TlsCertificate* server_cert2 = + envoy::api::v2::auth::TlsCertificate* server_cert2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert2->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_cert.pem")); server_cert2->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_key.pem")); - envoy::api::v2::CommonTlsContext* server_ctx1 = + envoy::api::v2::auth::CommonTlsContext* server_ctx1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context(); - envoy::api::v2::CommonTlsContext* server_ctx2 = + envoy::api::v2::auth::CommonTlsContext* server_ctx2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context(); - envoy::api::v2::UpstreamTlsContext client_ctx; + envoy::api::v2::auth::UpstreamTlsContext client_ctx; // Test ECDH curves. server_ctx1->mutable_tls_params()->add_cipher_suites("ECDHE-RSA-AES128-GCM-SHA256"); @@ -1773,9 +1773,9 @@ TEST_P(SslSocketTest, SniProtocolVersions) { envoy::api::v2::Listener listener; // san_dns_cert.pem: server1.example.com - envoy::api::v2::FilterChain* filter_chain1 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain1 = listener.add_filter_chains(); filter_chain1->mutable_filter_chain_match()->add_sni_domains("server1.example.com"); - envoy::api::v2::TlsCertificate* server_cert1 = + envoy::api::v2::auth::TlsCertificate* server_cert1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert1->mutable_certificate_chain()->set_filename( TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_cert.pem")); @@ -1783,39 +1783,39 @@ TEST_P(SslSocketTest, SniProtocolVersions) { TestEnvironment::substitute("{{ test_rundir }}/test/common/ssl/test_data/san_dns_key.pem")); // san_multiple_dns_cert.pem: server2.example.com - envoy::api::v2::FilterChain* filter_chain2 = listener.add_filter_chains(); + envoy::api::v2::listener::FilterChain* filter_chain2 = listener.add_filter_chains(); filter_chain2->mutable_filter_chain_match()->add_sni_domains("server2.example.com"); - envoy::api::v2::TlsCertificate* server_cert2 = + envoy::api::v2::auth::TlsCertificate* server_cert2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context()->add_tls_certificates(); server_cert2->mutable_certificate_chain()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_cert.pem")); server_cert2->mutable_private_key()->set_filename(TestEnvironment::substitute( "{{ test_rundir }}/test/common/ssl/test_data/san_multiple_dns_key.pem")); - envoy::api::v2::CommonTlsContext* server_ctx1 = + envoy::api::v2::auth::CommonTlsContext* server_ctx1 = filter_chain1->mutable_tls_context()->mutable_common_tls_context(); - envoy::api::v2::CommonTlsContext* server_ctx2 = + envoy::api::v2::auth::CommonTlsContext* server_ctx2 = filter_chain2->mutable_tls_context()->mutable_common_tls_context(); - envoy::api::v2::UpstreamTlsContext client_ctx; + envoy::api::v2::auth::UpstreamTlsContext client_ctx; // Test protocol versions. server_ctx1->mutable_tls_params()->set_tls_minimum_protocol_version( - envoy::api::v2::TlsParameters::TLSv1_2); + envoy::api::v2::auth::TlsParameters::TLSv1_2); server_ctx1->mutable_tls_params()->set_tls_maximum_protocol_version( - envoy::api::v2::TlsParameters::TLSv1_3); + envoy::api::v2::auth::TlsParameters::TLSv1_3); server_ctx2->mutable_tls_params()->set_tls_minimum_protocol_version( - envoy::api::v2::TlsParameters::TLSv1_0); + envoy::api::v2::auth::TlsParameters::TLSv1_0); server_ctx2->mutable_tls_params()->set_tls_maximum_protocol_version( - envoy::api::v2::TlsParameters::TLSv1_2); + envoy::api::v2::auth::TlsParameters::TLSv1_2); // Connection to server1.example.com using TLSv1.3 succeeds. // ssl.handshake logged by both: client & server. client_ctx.set_sni("server1.example.com"); client_ctx.mutable_common_tls_context()->mutable_tls_params()->set_tls_minimum_protocol_version( - envoy::api::v2::TlsParameters::TLSv1_3); + envoy::api::v2::auth::TlsParameters::TLSv1_3); client_ctx.mutable_common_tls_context()->mutable_tls_params()->set_tls_maximum_protocol_version( - envoy::api::v2::TlsParameters::TLSv1_3); + envoy::api::v2::auth::TlsParameters::TLSv1_3); testUtilV2(listener, client_ctx, "", true, "TLSv1.3", "1406294e80c818158697d65d2aaca16748ff132442ab0e2f28bc1109f1d47a2e", "", "", "ssl.handshake", 2, GetParam()); @@ -1828,9 +1828,9 @@ TEST_P(SslSocketTest, SniProtocolVersions) { // Connection to server1.example.com using TLSv1.0 fails. client_ctx.set_sni("server1.example.com"); client_ctx.mutable_common_tls_context()->mutable_tls_params()->set_tls_minimum_protocol_version( - envoy::api::v2::TlsParameters::TLSv1_0); + envoy::api::v2::auth::TlsParameters::TLSv1_0); client_ctx.mutable_common_tls_context()->mutable_tls_params()->set_tls_maximum_protocol_version( - envoy::api::v2::TlsParameters::TLSv1_0); + envoy::api::v2::auth::TlsParameters::TLSv1_0); testUtilV2(listener, client_ctx, "", false, "", "", "", "", "ssl.connection_error", 1, GetParam()); diff --git a/test/common/stats/BUILD b/test/common/stats/BUILD index 822c200268c8f..64f69c29f30a3 100644 --- a/test/common/stats/BUILD +++ b/test/common/stats/BUILD @@ -11,10 +11,10 @@ envoy_package() envoy_cc_test( name = "stats_impl_test", srcs = ["stats_impl_test.cc"], - external_deps = ["envoy_stats"], deps = [ "//source/common/stats:stats_lib", "//test/test_common:utility_lib", + "@envoy_api//envoy/config/metrics/v2:stats_cc", ], ) diff --git a/test/common/stats/grpc_metrics_service_impl_test.cc b/test/common/stats/grpc_metrics_service_impl_test.cc index a6315ab3ac53d..67026f8724aa8 100644 --- a/test/common/stats/grpc_metrics_service_impl_test.cc +++ b/test/common/stats/grpc_metrics_service_impl_test.cc @@ -19,7 +19,7 @@ namespace Metrics { class GrpcMetricsStreamerImplTest : public testing::Test { public: typedef Grpc::MockAsyncStream MockMetricsStream; - typedef Grpc::TypedAsyncStreamCallbacks + typedef Grpc::TypedAsyncStreamCallbacks MetricsServiceCallbacks; GrpcMetricsStreamerImplTest() { @@ -56,10 +56,11 @@ TEST_F(GrpcMetricsStreamerImplTest, BasicFlow) { expectStreamStart(stream1, &callbacks1); EXPECT_CALL(local_info_, node()); EXPECT_CALL(stream1, sendMessage(_, false)); - envoy::api::v2::StreamMetricsMessage message_metrics1; + envoy::service::metrics::v2::StreamMetricsMessage message_metrics1; streamer_->send(message_metrics1); // Verify that sending an empty response message doesn't do anything bad. - callbacks1->onReceiveMessage(std::make_unique()); + callbacks1->onReceiveMessage( + std::make_unique()); } // Test that stream failure is handled correctly. @@ -73,21 +74,21 @@ TEST_F(GrpcMetricsStreamerImplTest, StreamFailure) { return nullptr; })); EXPECT_CALL(local_info_, node()); - envoy::api::v2::StreamMetricsMessage message_metrics1; + envoy::service::metrics::v2::StreamMetricsMessage message_metrics1; streamer_->send(message_metrics1); } class MockGrpcMetricsStreamer : public GrpcMetricsStreamer { public: // GrpcMetricsStreamer - MOCK_METHOD1(send, void(envoy::api::v2::StreamMetricsMessage& message)); + MOCK_METHOD1(send, void(envoy::service::metrics::v2::StreamMetricsMessage& message)); }; class TestGrpcMetricsStreamer : public GrpcMetricsStreamer { public: int metric_count; // GrpcMetricsStreamer - void send(envoy::api::v2::StreamMetricsMessage& message) { + void send(envoy::service::metrics::v2::StreamMetricsMessage& message) { metric_count = message.envoy_metrics_size(); } }; diff --git a/test/common/stats/stats_impl_test.cc b/test/common/stats/stats_impl_test.cc index e79147888b737..c0ce225f60b06 100644 --- a/test/common/stats/stats_impl_test.cc +++ b/test/common/stats/stats_impl_test.cc @@ -1,6 +1,7 @@ #include #include +#include "envoy/config/metrics/v2/stats.pb.h" #include "envoy/stats/stats_macros.h" #include "common/config/well_known_names.h" @@ -8,7 +9,6 @@ #include "test/test_common/utility.h" -#include "api/stats.pb.h" #include "gtest/gtest.h" namespace Envoy { @@ -368,7 +368,7 @@ TEST(TagExtractorTest, DefaultTagExtractors) { } TEST(TagProducerTest, CheckConstructor) { - envoy::api::v2::StatsConfig stats_config; + envoy::config::metrics::v2::StatsConfig stats_config; // Should pass there were no tag name conflict. auto& tag_specifier1 = *stats_config.mutable_stats_tags()->Add(); diff --git a/test/common/upstream/BUILD b/test/common/upstream/BUILD index a43ad05814079..ea35d78a06237 100644 --- a/test/common/upstream/BUILD +++ b/test/common/upstream/BUILD @@ -53,7 +53,6 @@ envoy_cc_test( envoy_cc_test( name = "eds_test", srcs = ["eds_test.cc"], - external_deps = ["envoy_eds"], deps = [ ":utility_lib", "//source/common/config:utility_lib", @@ -65,6 +64,7 @@ envoy_cc_test( "//test/mocks/ssl:ssl_mocks", "//test/mocks/upstream:upstream_mocks", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:eds_cc", ], ) @@ -135,7 +135,6 @@ envoy_cc_test( envoy_cc_test( name = "load_stats_reporter_test", srcs = ["load_stats_reporter_test.cc"], - external_deps = ["envoy_eds"], deps = [ "//source/common/stats:stats_lib", "//source/common/upstream:load_stats_reporter_lib", @@ -143,6 +142,9 @@ envoy_cc_test( "//test/mocks/grpc:grpc_mocks", "//test/mocks/upstream:upstream_mocks", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:eds_cc", + "@envoy_api//envoy/api/v2/endpoint:endpoint_cc", + "@envoy_api//envoy/api/v2/endpoint:load_report_cc", ], ) @@ -233,7 +235,6 @@ envoy_cc_test( name = "sds_test", srcs = ["sds_test.cc"], data = glob(["test_data/**"]), - external_deps = ["envoy_base"], deps = [ ":utility_lib", "//source/common/config:utility_lib", @@ -249,6 +250,7 @@ envoy_cc_test( "//test/mocks/upstream:upstream_mocks", "//test/test_common:environment_lib", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:base_cc", ], ) diff --git a/test/common/upstream/cluster_manager_impl_test.cc b/test/common/upstream/cluster_manager_impl_test.cc index 8803aec6d9ce4..983dfff265e8d 100644 --- a/test/common/upstream/cluster_manager_impl_test.cc +++ b/test/common/upstream/cluster_manager_impl_test.cc @@ -70,20 +70,19 @@ class TestClusterManagerFactory : public ClusterManagerFactory { return CdsApiPtr{createCds_()}; } - ClusterManagerPtr clusterManagerFromProto(const envoy::api::v2::Bootstrap& bootstrap, - Stats::Store& stats, ThreadLocal::Instance& tls, - Runtime::Loader& runtime, - Runtime::RandomGenerator& random, - const LocalInfo::LocalInfo& local_info, - AccessLog::AccessLogManager& log_manager) override { + ClusterManagerPtr + clusterManagerFromProto(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, + Stats::Store& stats, ThreadLocal::Instance& tls, Runtime::Loader& runtime, + Runtime::RandomGenerator& random, const LocalInfo::LocalInfo& local_info, + AccessLog::AccessLogManager& log_manager) override { return ClusterManagerPtr{ clusterManagerFromProto_(bootstrap, stats, tls, runtime, random, local_info, log_manager)}; } MOCK_METHOD7(clusterManagerFromProto_, - ClusterManager*(const envoy::api::v2::Bootstrap& bootstrap, Stats::Store& stats, - ThreadLocal::Instance& tls, Runtime::Loader& runtime, - Runtime::RandomGenerator& random, + ClusterManager*(const envoy::config::bootstrap::v2::Bootstrap& bootstrap, + Stats::Store& stats, ThreadLocal::Instance& tls, + Runtime::Loader& runtime, Runtime::RandomGenerator& random, const LocalInfo::LocalInfo& local_info, AccessLog::AccessLogManager& log_manager)); MOCK_METHOD1(allocateConnPool_, Http::ConnectionPool::Instance*(HostConstSharedPtr host)); @@ -106,7 +105,7 @@ class TestClusterManagerFactory : public ClusterManagerFactory { class ClusterManagerImplTest : public testing::Test { public: - void create(const envoy::api::v2::Bootstrap& bootstrap) { + void create(const envoy::config::bootstrap::v2::Bootstrap& bootstrap) { cluster_manager_.reset(new ClusterManagerImpl( bootstrap, factory_, factory_.stats_, factory_.tls_, factory_.runtime_, factory_.random_, factory_.local_info_, log_manager_, factory_.dispatcher_)); @@ -117,15 +116,15 @@ class ClusterManagerImplTest : public testing::Test { AccessLog::MockAccessLogManager log_manager_; }; -envoy::api::v2::Bootstrap parseBootstrapFromJson(const std::string& json_string) { - envoy::api::v2::Bootstrap bootstrap; +envoy::config::bootstrap::v2::Bootstrap parseBootstrapFromJson(const std::string& json_string) { + envoy::config::bootstrap::v2::Bootstrap bootstrap; auto json_object_ptr = Json::Factory::loadFromString(json_string); Config::BootstrapJson::translateClusterManagerBootstrap(*json_object_ptr, bootstrap); return bootstrap; } -envoy::api::v2::Bootstrap parseBootstrapFromV2Yaml(const std::string& yaml) { - envoy::api::v2::Bootstrap bootstrap; +envoy::config::bootstrap::v2::Bootstrap parseBootstrapFromV2Yaml(const std::string& yaml) { + envoy::config::bootstrap::v2::Bootstrap bootstrap; MessageUtil::loadFromYaml(yaml, bootstrap); return bootstrap; } @@ -375,7 +374,7 @@ TEST_F(ClusterManagerImplTest, SubsetLoadBalancerInitialization) { } )EOF"; - envoy::api::v2::Bootstrap bootstrap = parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = parseBootstrapFromJson(json); envoy::api::v2::Cluster::LbSubsetConfig* subset_config = bootstrap.mutable_static_resources()->mutable_clusters(0)->mutable_lb_subset_config(); subset_config->set_fallback_policy(envoy::api::v2::Cluster::LbSubsetConfig::ANY_ENDPOINT); @@ -401,7 +400,7 @@ TEST_F(ClusterManagerImplTest, SubsetLoadBalancerRestriction) { } )EOF"; - envoy::api::v2::Bootstrap bootstrap = parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = parseBootstrapFromJson(json); envoy::api::v2::Cluster::LbSubsetConfig* subset_config = bootstrap.mutable_static_resources()->mutable_clusters(0)->mutable_lb_subset_config(); subset_config->set_fallback_policy(envoy::api::v2::Cluster::LbSubsetConfig::ANY_ENDPOINT); diff --git a/test/common/upstream/eds_test.cc b/test/common/upstream/eds_test.cc index fda40b967b466..4df715b2e7f40 100644 --- a/test/common/upstream/eds_test.cc +++ b/test/common/upstream/eds_test.cc @@ -1,3 +1,5 @@ +#include "envoy/api/v2/eds.pb.h" + #include "common/config/utility.h" #include "common/upstream/eds.h" @@ -8,7 +10,6 @@ #include "test/mocks/upstream/mocks.h" #include "test/test_common/utility.h" -#include "api/eds.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/test/common/upstream/load_stats_reporter_test.cc b/test/common/upstream/load_stats_reporter_test.cc index 6a22d075708ab..631240c4084df 100644 --- a/test/common/upstream/load_stats_reporter_test.cc +++ b/test/common/upstream/load_stats_reporter_test.cc @@ -1,3 +1,6 @@ +#include "envoy/api/v2/eds.pb.h" +#include "envoy/api/v2/endpoint/load_report.pb.h" + #include "common/stats/stats_impl.h" #include "common/upstream/load_stats_reporter.h" @@ -6,7 +9,6 @@ #include "test/mocks/upstream/mocks.h" #include "test/test_common/utility.h" -#include "api/eds.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -43,8 +45,9 @@ class LoadStatsReporterTest : public testing::Test { node_, cm_, stats_store_, Grpc::AsyncClientPtr(async_client_), dispatcher_)); } - void expectSendMessage(const std::vector& expected_cluster_stats) { - envoy::api::v2::LoadStatsRequest expected_request; + void expectSendMessage( + const std::vector& expected_cluster_stats) { + envoy::service::load_stats::v2::LoadStatsRequest expected_request; expected_request.mutable_node()->MergeFrom(node_); std::copy(expected_cluster_stats.begin(), expected_cluster_stats.end(), Protobuf::RepeatedPtrFieldBackInserter(expected_request.mutable_cluster_stats())); @@ -52,8 +55,8 @@ class LoadStatsReporterTest : public testing::Test { } void deliverLoadStatsResponse(const std::vector& cluster_names) { - std::unique_ptr response( - new envoy::api::v2::LoadStatsResponse()); + std::unique_ptr response( + new envoy::service::load_stats::v2::LoadStatsResponse()); response->mutable_load_reporting_interval()->set_seconds(42); std::copy(cluster_names.begin(), cluster_names.end(), Protobuf::RepeatedPtrFieldBackInserter(response->mutable_clusters())); diff --git a/test/common/upstream/outlier_detection_impl_test.cc b/test/common/upstream/outlier_detection_impl_test.cc index d4c2e00963d39..5e4f6e6973853 100644 --- a/test/common/upstream/outlier_detection_impl_test.cc +++ b/test/common/upstream/outlier_detection_impl_test.cc @@ -92,7 +92,7 @@ class OutlierDetectorImplTest : public testing::Test { CallbackChecker checker_; MockMonotonicTimeSource time_source_; std::shared_ptr event_logger_{new MockEventLogger()}; - envoy::api::v2::Cluster::OutlierDetection empty_outlier_detection_; + envoy::api::v2::cluster::OutlierDetection empty_outlier_detection_; }; TEST_F(OutlierDetectorImplTest, DetectorStaticConfig) { @@ -110,7 +110,7 @@ TEST_F(OutlierDetectorImplTest, DetectorStaticConfig) { } )EOF"; - envoy::api::v2::Cluster::OutlierDetection outlier_detection; + envoy::api::v2::cluster::OutlierDetection outlier_detection; Json::ObjectSharedPtr custom_config = Json::Factory::loadFromString(json); Config::CdsJson::translateOutlierDetection(*custom_config, outlier_detection); EXPECT_CALL(*interval_timer_, enableTimer(std::chrono::milliseconds(100))); diff --git a/test/common/upstream/sds_test.cc b/test/common/upstream/sds_test.cc index b2bb7606ab8ac..b8b792bf2b661 100644 --- a/test/common/upstream/sds_test.cc +++ b/test/common/upstream/sds_test.cc @@ -4,6 +4,8 @@ #include #include +#include "envoy/api/v2/base.pb.h" + #include "common/config/utility.h" #include "common/filesystem/filesystem_impl.h" #include "common/http/message_impl.h" @@ -20,7 +22,6 @@ #include "test/test_common/printers.h" #include "test/test_common/utility.h" -#include "api/base.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/test/common/upstream/subset_lb_test.cc b/test/common/upstream/subset_lb_test.cc index 5968432ccb0a0..555031217eb52 100644 --- a/test/common/upstream/subset_lb_test.cc +++ b/test/common/upstream/subset_lb_test.cc @@ -5,6 +5,7 @@ #include #include +#include "envoy/api/v2/cds.pb.h" #include "envoy/common/optional.h" #include "common/config/metadata.h" @@ -15,7 +16,6 @@ #include "test/mocks/runtime/mocks.h" #include "test/mocks/upstream/mocks.h" -#include "api/cds.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/test/config/BUILD b/test/config/BUILD index 9b5e14c095c4c..e7b7d1089235f 100644 --- a/test/config/BUILD +++ b/test/config/BUILD @@ -19,12 +19,12 @@ envoy_cc_test_library( hdrs = [ "utility.h", ], - external_deps = ["envoy_bootstrap"], deps = [ "//source/common/network:address_lib", "//source/common/protobuf:utility_lib", "//test/test_common:environment_lib", "//test/test_common:network_utility_lib", "//test/test_common:utility_lib", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) diff --git a/test/config/utility.cc b/test/config/utility.cc index 44f1e088aa2b0..63bfe8425319c 100644 --- a/test/config/utility.cc +++ b/test/config/utility.cc @@ -1,5 +1,6 @@ #include "test/config/utility.h" +#include "envoy/api/v2/filter/network/http_connection_manager.pb.h" #include "envoy/http/codec.h" #include "common/common/assert.h" @@ -8,8 +9,6 @@ #include "test/test_common/environment.h" #include "test/test_common/network_utility.h" -#include "api/filter/network/http_connection_manager.pb.h" - namespace Envoy { const std::string ConfigHelper::BASE_CONFIG = R"EOF( @@ -228,8 +227,8 @@ void ConfigHelper::setConnectTimeout(std::chrono::milliseconds timeout) { void ConfigHelper::addRoute(const std::string& domains, const std::string& prefix, const std::string& cluster, bool validate_clusters, - envoy::api::v2::RouteAction::ClusterNotFoundResponseCode code, - envoy::api::v2::VirtualHost::TlsRequirementType type) { + envoy::api::v2::route::RouteAction::ClusterNotFoundResponseCode code, + envoy::api::v2::route::VirtualHost::TlsRequirementType type) { RELEASE_ASSERT(!finalized_); envoy::api::v2::filter::network::HttpConnectionManager hcm_config; loadHttpConnectionManager(hcm_config); @@ -298,7 +297,7 @@ void ConfigHelper::addSslConfig() { TestEnvironment::runfilesPath("/test/config/integration/certs/serverkey.pem")); } -envoy::api::v2::Filter* ConfigHelper::getFilterFromListener() { +envoy::api::v2::listener::Filter* ConfigHelper::getFilterFromListener() { RELEASE_ASSERT(!finalized_); if (bootstrap_.mutable_static_resources()->listeners_size() == 0) { return nullptr; @@ -339,7 +338,7 @@ void ConfigHelper::addConfigModifier(ConfigModifierFunction function) { } void ConfigHelper::addConfigModifier(HttpModifierFunction function) { - addConfigModifier([function, this](envoy::api::v2::Bootstrap&) -> void { + addConfigModifier([function, this](envoy::config::bootstrap::v2::Bootstrap&) -> void { envoy::api::v2::filter::network::HttpConnectionManager hcm_config; loadHttpConnectionManager(hcm_config); function(hcm_config); diff --git a/test/config/utility.h b/test/config/utility.h index 615bfbe25c837..2f3c3d214f092 100644 --- a/test/config/utility.h +++ b/test/config/utility.h @@ -5,17 +5,16 @@ #include #include +#include "envoy/api/v2/base.pb.h" +#include "envoy/api/v2/cds.pb.h" +#include "envoy/api/v2/filter/network/http_connection_manager.pb.h" +#include "envoy/api/v2/protocol.pb.h" +#include "envoy/api/v2/route/route.pb.h" +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" #include "envoy/http/codes.h" #include "common/network/address_impl.h" -#include "api/base.pb.h" -#include "api/bootstrap.pb.h" -#include "api/cds.pb.h" -#include "api/filter/network/http_connection_manager.pb.h" -#include "api/protocol.pb.h" -#include "api/rds.pb.h" - namespace Envoy { class ConfigHelper { @@ -28,7 +27,7 @@ class ConfigHelper { ConfigHelper(const Network::Address::IpVersion version, const std::string& config = HTTP_PROXY_CONFIG); - typedef std::function ConfigModifierFunction; + typedef std::function ConfigModifierFunction; typedef std::function HttpModifierFunction; @@ -66,10 +65,11 @@ class ConfigHelper { void setConnectTimeout(std::chrono::milliseconds timeout); // Add an additional route to the configuration. - void addRoute( - const std::string& host, const std::string& route, const std::string& cluster, - bool validate_clusters, envoy::api::v2::RouteAction::ClusterNotFoundResponseCode code, - envoy::api::v2::VirtualHost::TlsRequirementType type = envoy::api::v2::VirtualHost::NONE); + void addRoute(const std::string& host, const std::string& route, const std::string& cluster, + bool validate_clusters, + envoy::api::v2::route::RouteAction::ClusterNotFoundResponseCode code, + envoy::api::v2::route::VirtualHost::TlsRequirementType type = + envoy::api::v2::route::VirtualHost::NONE); // Add an HTTP filter prior to existing filters. void addFilter(const std::string& filter_yaml); @@ -89,7 +89,7 @@ class ConfigHelper { void addConfigModifier(HttpModifierFunction function); // Return the bootstrap configuration for hand-off to Envoy. - const envoy::api::v2::Bootstrap& bootstrap() { return bootstrap_; } + const envoy::config::bootstrap::v2::Bootstrap& bootstrap() { return bootstrap_; } private: // Load the first HCM struct from the first listener into a parsed proto. @@ -100,10 +100,10 @@ class ConfigHelper { storeHttpConnectionManager(const envoy::api::v2::filter::network::HttpConnectionManager& hcm); // Snags the first filter from the first filter chain from the first listener. - envoy::api::v2::Filter* getFilterFromListener(); + envoy::api::v2::listener::Filter* getFilterFromListener(); // The bootstrap proto Envoy will start up with. - envoy::api::v2::Bootstrap bootstrap_; + envoy::config::bootstrap::v2::Bootstrap bootstrap_; // The config modifiers added via addConfigModifier() which will be applied in finalize() std::vector config_modifiers_; diff --git a/test/config_test/config_test.cc b/test/config_test/config_test.cc index 282ee33445a5a..fd3eac263bbf2 100644 --- a/test/config_test/config_test.cc +++ b/test/config_test/config_test.cc @@ -35,7 +35,7 @@ class ConfigTest { ON_CALL(server_.api_, fileReadToEnd("lightstep_access_token")) .WillByDefault(Return("access_token")); - envoy::api::v2::Bootstrap bootstrap; + envoy::config::bootstrap::v2::Bootstrap bootstrap; Server::InstanceUtil::loadBootstrapConfig(bootstrap, options_.configPath(), options_.v2ConfigOnly()); Server::Configuration::InitialImpl initial_config(bootstrap); @@ -50,17 +50,18 @@ class ConfigTest { })); ON_CALL(server_, listenerManager()).WillByDefault(ReturnRef(listener_manager_)); ON_CALL(component_factory_, createNetworkFilterFactoryList(_, _)) - .WillByDefault(Invoke([&](const Protobuf::RepeatedPtrField& filters, - Server::Configuration::FactoryContext& context) - -> std::vector { - return Server::ProdListenerComponentFactory::createNetworkFilterFactoryList_(filters, - context); - })); - ON_CALL(component_factory_, createListenerFilterFactoryList(_, _)) .WillByDefault( - Invoke([&](const Protobuf::RepeatedPtrField& filters, + Invoke([&](const Protobuf::RepeatedPtrField& filters, Server::Configuration::FactoryContext& context) - -> std::vector { + -> std::vector { + return Server::ProdListenerComponentFactory::createNetworkFilterFactoryList_(filters, + context); + })); + ON_CALL(component_factory_, createListenerFilterFactoryList(_, _)) + .WillByDefault(Invoke( + [&](const Protobuf::RepeatedPtrField& filters, + Server::Configuration::FactoryContext& context) + -> std::vector { return Server::ProdListenerComponentFactory::createListenerFilterFactoryList_( filters, context); })); diff --git a/test/integration/BUILD b/test/integration/BUILD index 40045782f42e9..71eb9ad684d97 100644 --- a/test/integration/BUILD +++ b/test/integration/BUILD @@ -27,13 +27,6 @@ envoy_cc_test( name = "ads_integration_test", srcs = ["ads_integration_test.cc"], data = ["//test/config/integration:server_ads.yaml"], - external_deps = [ - "envoy_cds", - "envoy_discovery", - "envoy_eds", - "envoy_lds", - "envoy_rds", - ], deps = [ ":http_integration_lib", "//source/common/config:resources_lib", @@ -41,6 +34,12 @@ envoy_cc_test( "//test/common/grpc:grpc_client_integration_lib", "//test/test_common:network_utility_lib", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:cds_cc", + "@envoy_api//envoy/api/v2:discovery_cc", + "@envoy_api//envoy/api/v2:eds_cc", + "@envoy_api//envoy/api/v2:lds_cc", + "@envoy_api//envoy/api/v2:rds_cc", + "@envoy_api//envoy/service/discovery/v2:ads_cc", ], ) @@ -105,10 +104,10 @@ envoy_cc_test( srcs = [ "header_integration_test.cc", ], - external_deps = ["envoy_filter_network_http_connection_manager"], deps = [ ":http_integration_lib", "//source/common/protobuf", + "@envoy_api//envoy/api/v2/filter/network:http_connection_manager_cc", ], ) @@ -332,31 +331,28 @@ envoy_cc_test( envoy_cc_test( name = "stats_integration_test", srcs = ["stats_integration_test.cc"], - external_deps = [ - "envoy_bootstrap", - "envoy_stats", - ], deps = [ ":integration_lib", "//test/test_common:network_utility_lib", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", + "@envoy_api//envoy/config/metrics/v2:stats_cc", ], ) envoy_cc_test( name = "load_stats_integration_test", srcs = ["load_stats_integration_test.cc"], - external_deps = ["envoy_eds"], deps = [ ":http_integration_lib", "//source/common/config:resources_lib", "//test/test_common:network_utility_lib", + "@envoy_api//envoy/api/v2:eds_cc", ], ) envoy_cc_test( name = "metrics_service_integration_test", srcs = ["metrics_service_integration_test.cc"], - external_deps = ["envoy_metrics"], deps = [ ":http_integration_lib", "//source/common/buffer:zero_copy_input_stream_lib", @@ -364,6 +360,7 @@ envoy_cc_test( "//source/common/grpc:common_lib", "//source/server/config/stats:metrics_service_lib", "//test/common/grpc:grpc_client_integration_lib", + "@envoy_api//envoy/service/metrics/v2:metrics_service_cc", ], ) diff --git a/test/integration/README.md b/test/integration/README.md index 408abe4817fe3..e8bc49942b1a2 100644 --- a/test/integration/README.md +++ b/test/integration/README.md @@ -70,7 +70,7 @@ config, and then change the first `HttpConnectionManager` to be different from t An example of modifying the bootstrap proto to overwrite runtime defaults: ```c++ TestEnvironment::writeStringToFileForTest("runtime/ssl.alt_alpn", "100"); -config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { +config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { bootstrap.mutable_runtime()->set_symlink_root(TestEnvironment::temporaryPath("runtime"); }); ``` @@ -86,7 +86,7 @@ config_helper_.addConfigModifier([&](envoy::api::v2::filter::HttpConnectionManag An example of modifying `HttpConnectionManager` to add an additional upstream cluster: ```c++ - config_helper_.addConfigModifier([](envoy::api::v2::Bootstrap& bootstrap) { + config_helper_.addConfigModifier([](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { bootstrap.mutable_rate_limit_service()->set_cluster_name("ratelimit"); auto* ratelimit_cluster = bootstrap.mutable_static_resources()->add_clusters(); ratelimit_cluster->MergeFrom(bootstrap.static_resources().clusters()[0]); diff --git a/test/integration/access_log_integration_test.cc b/test/integration/access_log_integration_test.cc index dbd1c48c99e91..1fe5a89dffb61 100644 --- a/test/integration/access_log_integration_test.cc +++ b/test/integration/access_log_integration_test.cc @@ -1,3 +1,6 @@ +#include "envoy/config/accesslog/v2/als.pb.h" +#include "envoy/service/accesslog/v2/als.pb.h" + #include "common/buffer/zero_copy_input_stream_impl.h" #include "common/common/version.h" #include "common/grpc/codec.h" @@ -22,7 +25,7 @@ class AccessLogIntegrationTest : public HttpIntegrationTest, } void initialize() override { - config_helper_.addConfigModifier([](envoy::api::v2::Bootstrap& bootstrap) { + config_helper_.addConfigModifier([](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { auto* accesslog_cluster = bootstrap.mutable_static_resources()->add_clusters(); accesslog_cluster->MergeFrom(bootstrap.static_resources().clusters()[0]); accesslog_cluster->set_name("accesslog"); @@ -34,7 +37,7 @@ class AccessLogIntegrationTest : public HttpIntegrationTest, auto* access_log = hcm.add_access_log(); access_log->set_name("envoy.http_grpc_access_log"); - envoy::api::v2::filter::accesslog::HttpGrpcAccessLogConfig config; + envoy::config::accesslog::v2::HttpGrpcAccessLogConfig config; auto* common_config = config.mutable_common_config(); common_config->set_log_name("foo"); setGrpcService(*common_config->mutable_grpc_service(), "accesslog", @@ -54,14 +57,14 @@ class AccessLogIntegrationTest : public HttpIntegrationTest, } void waitForAccessLogRequest(const std::string& expected_request_msg_yaml) { - envoy::api::v2::filter::accesslog::StreamAccessLogsMessage request_msg; + envoy::service::accesslog::v2::StreamAccessLogsMessage request_msg; access_log_request_->waitForGrpcMessage(*dispatcher_, request_msg); EXPECT_STREQ("POST", access_log_request_->headers().Method()->value().c_str()); - EXPECT_STREQ("/envoy.api.v2.filter.accesslog.AccessLogService/StreamAccessLogs", + EXPECT_STREQ("/envoy.service.accesslog.v2.AccessLogService/StreamAccessLogs", access_log_request_->headers().Path()->value().c_str()); EXPECT_STREQ("application/grpc", access_log_request_->headers().ContentType()->value().c_str()); - envoy::api::v2::filter::accesslog::StreamAccessLogsMessage expected_request_msg; + envoy::service::accesslog::v2::StreamAccessLogsMessage expected_request_msg; MessageUtil::loadFromYaml(expected_request_msg_yaml, expected_request_msg); // Clear fields which are not deterministic. @@ -143,7 +146,7 @@ TEST_P(AccessLogIntegrationTest, BasicAccessLogFlow) { // Send an empty response and end the stream. This should never happen but make sure nothing // breaks and we make a new stream on a follow up request. access_log_request_->startGrpcStream(); - envoy::api::v2::filter::accesslog::StreamAccessLogsResponse response_msg; + envoy::service::accesslog::v2::StreamAccessLogsResponse response_msg; access_log_request_->sendGrpcMessage(response_msg); access_log_request_->finishGrpcStream(Grpc::Status::Ok); test_server_->waitForGaugeEq("cluster.accesslog.upstream_rq_active", 0); diff --git a/test/integration/ads_integration_test.cc b/test/integration/ads_integration_test.cc index 1fdb5649454e0..6c34922272c2d 100644 --- a/test/integration/ads_integration_test.cc +++ b/test/integration/ads_integration_test.cc @@ -1,3 +1,11 @@ +#include "envoy/api/v2/cds.pb.h" +#include "envoy/api/v2/discovery.pb.h" +#include "envoy/api/v2/eds.pb.h" +#include "envoy/api/v2/lds.pb.h" +#include "envoy/api/v2/rds.pb.h" +#include "envoy/api/v2/route/route.pb.h" +#include "envoy/service/discovery/v2/ads.pb.h" + #include "common/config/resources.h" #include "common/protobuf/utility.h" @@ -7,11 +15,6 @@ #include "test/test_common/network_utility.h" #include "test/test_common/utility.h" -#include "api/cds.pb.h" -#include "api/discovery.pb.h" -#include "api/eds.pb.h" -#include "api/lds.pb.h" -#include "api/rds.pb.h" #include "gtest/gtest.h" using testing::AssertionFailure; @@ -167,7 +170,7 @@ class AdsIntegrationTest : public HttpIntegrationTest, public Grpc::GrpcClientIn } void initialize() override { - config_helper_.addConfigModifier([this](envoy::api::v2::Bootstrap& bootstrap) { + config_helper_.addConfigModifier([this](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { setGrpcService( *bootstrap.mutable_dynamic_resources()->mutable_ads_config()->add_grpc_services(), "ads_cluster", fake_upstreams_.back()->localAddress()); @@ -177,6 +180,7 @@ class AdsIntegrationTest : public HttpIntegrationTest, public Grpc::GrpcClientIn ads_connection_ = fake_upstreams_[0]->waitForHttpConnection(*dispatcher_); ads_stream_ = ads_connection_->waitForNewStream(*dispatcher_); ads_stream_->startGrpcStream(); + envoy::service::discovery::v2::AdsDummy dummy; } FakeHttpConnectionPtr ads_connection_; diff --git a/test/integration/header_integration_test.cc b/test/integration/header_integration_test.cc index 5e3d84496d4eb..b2e248062cdcd 100644 --- a/test/integration/header_integration_test.cc +++ b/test/integration/header_integration_test.cc @@ -1,3 +1,6 @@ +#include "envoy/api/v2/eds.pb.h" +#include "envoy/api/v2/filter/network/http_connection_manager.pb.h" + #include "common/config/metadata.h" #include "common/config/resources.h" #include "common/protobuf/protobuf.h" @@ -5,8 +8,6 @@ #include "test/integration/http_integration.h" #include "test/test_common/network_utility.h" -#include "api/eds.pb.h" -#include "api/filter/network/http_connection_manager.pb.h" #include "gtest/gtest.h" namespace Envoy { @@ -100,7 +101,7 @@ class HeaderIntegrationTest : public HttpIntegrationTest, } void prepareEDS() { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { auto* static_resources = bootstrap.mutable_static_resources(); ASSERT(static_resources->clusters_size() == 1); diff --git a/test/integration/http2_integration_test.cc b/test/integration/http2_integration_test.cc index 39078a973c78c..12bf7e96fe759 100644 --- a/test/integration/http2_integration_test.cc +++ b/test/integration/http2_integration_test.cc @@ -260,7 +260,7 @@ TEST_P(Http2IntegrationTest, SimultaneousRequestWithBufferLimits) { } Http2RingHashIntegrationTest::Http2RingHashIntegrationTest() { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { auto* cluster = bootstrap.mutable_static_resources()->mutable_clusters(0); cluster->clear_hosts(); cluster->set_lb_policy(envoy::api::v2::Cluster_LbPolicy_RING_HASH); diff --git a/test/integration/http_integration.cc b/test/integration/http_integration.cc index d7f6ea65c1d2a..e58880ee0220c 100644 --- a/test/integration/http_integration.cc +++ b/test/integration/http_integration.cc @@ -293,8 +293,8 @@ void HttpIntegrationTest::testRouterNotFoundWithBody() { // Add a route that uses unknown cluster (expect 404 Not Found). void HttpIntegrationTest::testRouterClusterNotFound404() { config_helper_.addRoute("foo.com", "/unknown", "unknown_cluster", false, - envoy::api::v2::RouteAction::NOT_FOUND, - envoy::api::v2::VirtualHost::NONE); + envoy::api::v2::route::RouteAction::NOT_FOUND, + envoy::api::v2::route::VirtualHost::NONE); initialize(); BufferingStreamDecoderPtr response = IntegrationUtil::makeSingleRequest( @@ -306,8 +306,8 @@ void HttpIntegrationTest::testRouterClusterNotFound404() { // Add a route that uses unknown cluster (expect 503 Service Unavailable). void HttpIntegrationTest::testRouterClusterNotFound503() { config_helper_.addRoute("foo.com", "/unknown", "unknown_cluster", false, - envoy::api::v2::RouteAction::SERVICE_UNAVAILABLE, - envoy::api::v2::VirtualHost::NONE); + envoy::api::v2::route::RouteAction::SERVICE_UNAVAILABLE, + envoy::api::v2::route::VirtualHost::NONE); initialize(); BufferingStreamDecoderPtr response = IntegrationUtil::makeSingleRequest( @@ -319,8 +319,8 @@ void HttpIntegrationTest::testRouterClusterNotFound503() { // Add a route which redirects HTTP to HTTPS, and verify Envoy sends a 301 void HttpIntegrationTest::testRouterRedirect() { config_helper_.addRoute("www.redirect.com", "/", "cluster_0", true, - envoy::api::v2::RouteAction::SERVICE_UNAVAILABLE, - envoy::api::v2::VirtualHost::ALL); + envoy::api::v2::route::RouteAction::SERVICE_UNAVAILABLE, + envoy::api::v2::route::VirtualHost::ALL); initialize(); BufferingStreamDecoderPtr response = IntegrationUtil::makeSingleRequest( @@ -805,8 +805,8 @@ void HttpIntegrationTest::testAbsolutePath() { // Configure www.redirect.com to send a redirect, and ensure the redirect is // encountered via absolute URL. config_helper_.addRoute("www.redirect.com", "/", "cluster_0", true, - envoy::api::v2::RouteAction::SERVICE_UNAVAILABLE, - envoy::api::v2::VirtualHost::ALL); + envoy::api::v2::route::RouteAction::SERVICE_UNAVAILABLE, + envoy::api::v2::route::VirtualHost::ALL); config_helper_.addConfigModifier(&setAllowAbsoluteUrl); initialize(); @@ -828,8 +828,8 @@ void HttpIntegrationTest::testAbsolutePathWithPort() { // Configure www.namewithport.com:1234 to send a redirect, and ensure the redirect is // encountered via absolute URL with a port. config_helper_.addRoute("www.namewithport.com:1234", "/", "cluster_0", true, - envoy::api::v2::RouteAction::SERVICE_UNAVAILABLE, - envoy::api::v2::VirtualHost::ALL); + envoy::api::v2::route::RouteAction::SERVICE_UNAVAILABLE, + envoy::api::v2::route::VirtualHost::ALL); config_helper_.addConfigModifier(&setAllowAbsoluteUrl); initialize(); Buffer::OwnedImpl buffer("GET http://www.namewithport.com:1234 HTTP/1.1\r\nHost: host\r\n\r\n"); @@ -851,8 +851,8 @@ void HttpIntegrationTest::testAbsolutePathWithoutPort() { config_helper_.setDefaultHostAndRoute("foo.com", "/found"); // Set a matcher for namewithport:1234 and verify http://namewithport does not match config_helper_.addRoute("www.namewithport.com:1234", "/", "cluster_0", true, - envoy::api::v2::RouteAction::SERVICE_UNAVAILABLE, - envoy::api::v2::VirtualHost::ALL); + envoy::api::v2::route::RouteAction::SERVICE_UNAVAILABLE, + envoy::api::v2::route::VirtualHost::ALL); config_helper_.addConfigModifier(&setAllowAbsoluteUrl); initialize(); Buffer::OwnedImpl buffer("GET http://www.namewithport.com HTTP/1.1\r\nHost: host\r\n\r\n"); @@ -881,7 +881,7 @@ void HttpIntegrationTest::testConnect() { } void HttpIntegrationTest::testEquivalent(const std::string& request) { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { // Clone the whole listener. auto static_resources = bootstrap.mutable_static_resources(); auto* old_listener = static_resources->mutable_listeners(0); diff --git a/test/integration/integration.cc b/test/integration/integration.cc index 950091cf29038..942606f62b2c0 100644 --- a/test/integration/integration.cc +++ b/test/integration/integration.cc @@ -235,11 +235,12 @@ void BaseIntegrationTest::createEnvoy() { void BaseIntegrationTest::setUpstreamProtocol(FakeHttpConnection::Type protocol) { upstream_protocol_ = protocol; if (upstream_protocol_ == FakeHttpConnection::Type::HTTP2) { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { - RELEASE_ASSERT(bootstrap.mutable_static_resources()->clusters_size() == 1); - auto* cluster = bootstrap.mutable_static_resources()->mutable_clusters(0); - cluster->mutable_http2_protocol_options(); - }); + config_helper_.addConfigModifier( + [&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { + RELEASE_ASSERT(bootstrap.mutable_static_resources()->clusters_size() == 1); + auto* cluster = bootstrap.mutable_static_resources()->mutable_clusters(0); + cluster->mutable_http2_protocol_options(); + }); } else { RELEASE_ASSERT(protocol == FakeHttpConnection::Type::HTTP1); } diff --git a/test/integration/integration_admin_test.cc b/test/integration/integration_admin_test.cc index 46416a710abb9..3f065b6b8e268 100644 --- a/test/integration/integration_admin_test.cc +++ b/test/integration/integration_admin_test.cc @@ -248,7 +248,7 @@ TEST_P(IntegrationAdminTest, Admin) { #ifdef TCMALLOC TEST_P(IntegrationAdminTest, AdminCpuProfilerStart) { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { auto* admin = bootstrap.mutable_admin(); admin->set_profile_path(TestEnvironment::temporaryPath("/envoy.prof")); }); @@ -272,11 +272,13 @@ class IntegrationAdminIpv4Ipv6Test : public HttpIntegrationTest, public testing: : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, Network::Address::IpVersion::v4) {} void initialize() override { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { - auto* socket_address = bootstrap.mutable_admin()->mutable_address()->mutable_socket_address(); - socket_address->set_ipv4_compat(true); - socket_address->set_address("::"); - }); + config_helper_.addConfigModifier( + [&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { + auto* socket_address = + bootstrap.mutable_admin()->mutable_address()->mutable_socket_address(); + socket_address->set_ipv4_compat(true); + socket_address->set_address("::"); + }); HttpIntegrationTest::initialize(); } }; diff --git a/test/integration/load_stats_integration_test.cc b/test/integration/load_stats_integration_test.cc index b9234d82708cc..d67ac6b3c7fb6 100644 --- a/test/integration/load_stats_integration_test.cc +++ b/test/integration/load_stats_integration_test.cc @@ -1,9 +1,13 @@ +#include "envoy/api/v2/eds.pb.h" +#include "envoy/api/v2/endpoint/endpoint.pb.h" +#include "envoy/api/v2/endpoint/load_report.pb.h" +#include "envoy/service/load_stats/v2/lrs.pb.h" + #include "common/config/resources.h" #include "test/integration/http_integration.h" #include "test/test_common/network_utility.h" -#include "api/eds.pb.h" #include "gtest/gtest.h" namespace Envoy { @@ -14,8 +18,8 @@ class LoadStatsIntegrationTest : public HttpIntegrationTest, public: LoadStatsIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) {} - void addEndpoint(envoy::api::v2::LocalityLbEndpoints& locality_lb_endpoints, uint32_t index, - uint32_t& num_endpoints) { + void addEndpoint(envoy::api::v2::endpoint::LocalityLbEndpoints& locality_lb_endpoints, + uint32_t index, uint32_t& num_endpoints) { auto* socket_address = locality_lb_endpoints.add_lb_endpoints() ->mutable_endpoint() ->mutable_address() @@ -102,7 +106,7 @@ class LoadStatsIntegrationTest : public HttpIntegrationTest, void initialize() override { updateClusterLoadAssignment({}, {}, {}, {}); - config_helper_.addConfigModifier([this](envoy::api::v2::Bootstrap& bootstrap) { + config_helper_.addConfigModifier([this](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { // Setup load reporting and corresponding gRPC cluster. auto* loadstats_config = bootstrap.mutable_cluster_manager()->mutable_load_stats_config(); loadstats_config->set_api_type(envoy::api::v2::ApiConfigSource::GRPC); @@ -148,8 +152,9 @@ class LoadStatsIntegrationTest : public HttpIntegrationTest, loadstats_stream_ = fake_loadstats_connection_->waitForNewStream(*dispatcher_); } - void mergeLoadStats(envoy::api::v2::LoadStatsRequest& loadstats_request, - const envoy::api::v2::LoadStatsRequest& local_loadstats_request) { + void + mergeLoadStats(envoy::service::load_stats::v2::LoadStatsRequest& loadstats_request, + const envoy::service::load_stats::v2::LoadStatsRequest& local_loadstats_request) { ASSERT(loadstats_request.cluster_stats_size() <= 1); ASSERT(local_loadstats_request.cluster_stats_size() <= 1); @@ -195,9 +200,9 @@ class LoadStatsIntegrationTest : public HttpIntegrationTest, } void waitForLoadStatsRequest( - const std::vector& expected_locality_stats, + const std::vector& expected_locality_stats, uint64_t dropped = 0) { - Protobuf::RepeatedPtrField expected_cluster_stats; + Protobuf::RepeatedPtrField expected_cluster_stats; if (!expected_locality_stats.empty() || dropped != 0) { auto* cluster_stats = expected_cluster_stats.Add(); cluster_stats->set_cluster_name("cluster_0"); @@ -209,17 +214,17 @@ class LoadStatsIntegrationTest : public HttpIntegrationTest, Protobuf::RepeatedPtrFieldBackInserter(cluster_stats->mutable_upstream_locality_stats())); } - envoy::api::v2::LoadStatsRequest loadstats_request; + envoy::service::load_stats::v2::LoadStatsRequest loadstats_request; // Because multiple load stats may be sent while load in being sent (on slow machines), loop and // merge until all the expected load has been reported. do { - envoy::api::v2::LoadStatsRequest local_loadstats_request; + envoy::service::load_stats::v2::LoadStatsRequest local_loadstats_request; loadstats_stream_->waitForGrpcMessage(*dispatcher_, local_loadstats_request); mergeLoadStats(loadstats_request, local_loadstats_request); EXPECT_STREQ("POST", loadstats_stream_->headers().Method()->value().c_str()); - EXPECT_STREQ("/envoy.api.v2.EndpointDiscoveryService/StreamLoadStats", + EXPECT_STREQ("/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats", loadstats_stream_->headers().Path()->value().c_str()); EXPECT_STREQ("application/grpc", loadstats_stream_->headers().ContentType()->value().c_str()); } while (!TestUtility::assertRepeatedPtrFieldEqual(expected_cluster_stats, @@ -247,7 +252,7 @@ class LoadStatsIntegrationTest : public HttpIntegrationTest, } void requestLoadStatsResponse(const std::vector& clusters) { - envoy::api::v2::LoadStatsResponse loadstats_response; + envoy::service::load_stats::v2::LoadStatsResponse loadstats_response; loadstats_response.mutable_load_reporting_interval()->set_nanos(500000000); // 500ms for (const auto& cluster : clusters) { loadstats_response.add_clusters(cluster); @@ -257,10 +262,11 @@ class LoadStatsIntegrationTest : public HttpIntegrationTest, test_server_->waitForCounterGe("load_reporter.requests", ++load_requests_); } - envoy::api::v2::UpstreamLocalityStats localityStats(const std::string& sub_zone, uint64_t success, - uint64_t error, uint64_t active, - uint32_t priority = 0) { - envoy::api::v2::UpstreamLocalityStats locality_stats; + envoy::api::v2::endpoint::UpstreamLocalityStats localityStats(const std::string& sub_zone, + uint64_t success, uint64_t error, + uint64_t active, + uint32_t priority = 0) { + envoy::api::v2::endpoint::UpstreamLocalityStats locality_stats; auto* locality = locality_stats.mutable_locality(); locality->set_region("some_region"); locality->set_zone("zone_name"); @@ -450,7 +456,7 @@ TEST_P(LoadStatsIntegrationTest, InProgress) { // Validate the load reports for dropped requests make sense. TEST_P(LoadStatsIntegrationTest, Dropped) { - config_helper_.addConfigModifier([](envoy::api::v2::Bootstrap& bootstrap) { + config_helper_.addConfigModifier([](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { auto* cluster_0 = bootstrap.mutable_static_resources()->mutable_clusters(0); auto* thresholds = cluster_0->mutable_circuit_breakers()->add_thresholds(); thresholds->mutable_max_pending_requests()->set_value(0); diff --git a/test/integration/lua_integration_test.cc b/test/integration/lua_integration_test.cc index f401c5fa8fe35..a1594fb91bcfe 100644 --- a/test/integration/lua_integration_test.cc +++ b/test/integration/lua_integration_test.cc @@ -18,7 +18,7 @@ class LuaIntegrationTest : public HttpIntegrationTest, void initializeFilter(const std::string& filter_config) { config_helper_.addFilter(filter_config); - config_helper_.addConfigModifier([](envoy::api::v2::Bootstrap& bootstrap) { + config_helper_.addConfigModifier([](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { auto* lua_cluster = bootstrap.mutable_static_resources()->add_clusters(); lua_cluster->MergeFrom(bootstrap.static_resources().clusters()[0]); lua_cluster->set_name("lua_cluster"); diff --git a/test/integration/metrics_service_integration_test.cc b/test/integration/metrics_service_integration_test.cc index da114e126c0b2..05faba3877e02 100644 --- a/test/integration/metrics_service_integration_test.cc +++ b/test/integration/metrics_service_integration_test.cc @@ -1,10 +1,12 @@ +#include "envoy/config/metrics/v2/metrics_service.pb.h" +#include "envoy/service/metrics/v2/metrics_service.pb.h" + #include "common/common/version.h" #include "common/grpc/codec.h" #include "common/grpc/common.h" #include "test/integration/http_integration.h" -#include "api/metrics_service.pb.h" #include "gtest/gtest.h" namespace Envoy { @@ -25,7 +27,7 @@ class MetricsServiceIntegrationTest : public HttpIntegrationTest, } void initialize() override { - config_helper_.addConfigModifier([](envoy::api::v2::Bootstrap& bootstrap) { + config_helper_.addConfigModifier([](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { auto* metrics_service_cluster = bootstrap.mutable_static_resources()->add_clusters(); metrics_service_cluster->MergeFrom(bootstrap.static_resources().clusters()[0]); metrics_service_cluster->set_name("metrics_service"); @@ -33,7 +35,7 @@ class MetricsServiceIntegrationTest : public HttpIntegrationTest, auto* metrics_sink = bootstrap.add_stats_sinks(); metrics_sink->set_name("envoy.metrics_service"); - envoy::api::v2::MetricsServiceConfig config; + envoy::config::metrics::v2::MetricsServiceConfig config; config.mutable_grpc_service()->mutable_envoy_grpc()->set_cluster_name("metrics_service"); MessageUtil::jsonConvert(config, *metrics_sink->mutable_config()); }); @@ -51,10 +53,10 @@ class MetricsServiceIntegrationTest : public HttpIntegrationTest, } void waitForMetricsRequest() { - envoy::api::v2::StreamMetricsMessage request_msg; + envoy::service::metrics::v2::StreamMetricsMessage request_msg; metrics_service_request_->waitForGrpcMessage(*dispatcher_, request_msg); EXPECT_STREQ("POST", metrics_service_request_->headers().Method()->value().c_str()); - EXPECT_STREQ("/envoy.api.v2.MetricsService/StreamMetrics", + EXPECT_STREQ("/envoy.service.metrics.v2.MetricsService/StreamMetrics", metrics_service_request_->headers().Path()->value().c_str()); EXPECT_STREQ("application/grpc", metrics_service_request_->headers().ContentType()->value().c_str()); @@ -105,7 +107,7 @@ TEST_P(MetricsServiceIntegrationTest, BasicFlow) { // Send an empty response and end the stream. This should never happen but make sure nothing // breaks and we make a new stream on a follow up request. metrics_service_request_->startGrpcStream(); - envoy::api::v2::StreamMetricsResponse response_msg; + envoy::service::metrics::v2::StreamMetricsResponse response_msg; metrics_service_request_->sendGrpcMessage(response_msg); metrics_service_request_->finishGrpcStream(Grpc::Status::Ok); test_server_->waitForGaugeEq("cluster.metrics_service.upstream_rq_active", 0); diff --git a/test/integration/proxy_proto_integration_test.h b/test/integration/proxy_proto_integration_test.h index e62aa22ac9c1b..1d91bdb4ef79a 100644 --- a/test/integration/proxy_proto_integration_test.h +++ b/test/integration/proxy_proto_integration_test.h @@ -14,11 +14,12 @@ class ProxyProtoIntegrationTest : public HttpIntegrationTest, public testing::TestWithParam { public: ProxyProtoIntegrationTest() : HttpIntegrationTest(Http::CodecClient::Type::HTTP1, GetParam()) { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { - auto* listener = bootstrap.mutable_static_resources()->mutable_listeners(0); - auto* filter_chain = listener->mutable_filter_chains(0); - filter_chain->mutable_use_proxy_proto()->set_value(true); - }); + config_helper_.addConfigModifier( + [&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { + auto* listener = bootstrap.mutable_static_resources()->mutable_listeners(0); + auto* filter_chain = listener->mutable_filter_chains(0); + filter_chain->mutable_use_proxy_proto()->set_value(true); + }); } }; } // namespace Envoy diff --git a/test/integration/ratelimit_integration_test.cc b/test/integration/ratelimit_integration_test.cc index b106b28c872b5..b155b58a49000 100644 --- a/test/integration/ratelimit_integration_test.cc +++ b/test/integration/ratelimit_integration_test.cc @@ -27,7 +27,7 @@ class RatelimitIntegrationTest : public HttpIntegrationTest, void initialize() override { config_helper_.addFilter( "{ name: envoy.rate_limit, config: { domain: some_domain, timeout: 0.5s } }"); - config_helper_.addConfigModifier([this](envoy::api::v2::Bootstrap& bootstrap) { + config_helper_.addConfigModifier([this](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { auto* ratelimit_cluster = bootstrap.mutable_static_resources()->add_clusters(); ratelimit_cluster->MergeFrom(bootstrap.static_resources().clusters()[0]); ratelimit_cluster->set_name("ratelimit"); diff --git a/test/integration/squash_filter_integration_test.cc b/test/integration/squash_filter_integration_test.cc index fb371ba5a9512..3d14316026eef 100644 --- a/test/integration/squash_filter_integration_test.cc +++ b/test/integration/squash_filter_integration_test.cc @@ -76,7 +76,7 @@ class SquashFilterIntegrationTest : public HttpIntegrationTest, config_helper_.addFilter(ConfigHelper::DEFAULT_SQUASH_FILTER); - config_helper_.addConfigModifier([](envoy::api::v2::Bootstrap& bootstrap) { + config_helper_.addConfigModifier([](envoy::config::bootstrap::v2::Bootstrap& bootstrap) { auto* squash_cluster = bootstrap.mutable_static_resources()->add_clusters(); squash_cluster->MergeFrom(bootstrap.static_resources().clusters()[0]); squash_cluster->set_name("squash"); diff --git a/test/integration/ssl_integration_test.cc b/test/integration/ssl_integration_test.cc index fa3c18d9c21bb..6d73741f79618 100644 --- a/test/integration/ssl_integration_test.cc +++ b/test/integration/ssl_integration_test.cc @@ -178,7 +178,7 @@ TEST_P(SslIntegrationTest, AdminCertEndpoint) { TEST_P(SslIntegrationTest, AltAlpn) { // Write the runtime file to turn alt_alpn on. TestEnvironment::writeStringToFileForTest("runtime/ssl.alt_alpn", "100"); - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { // Configure the runtime directory. bootstrap.mutable_runtime()->set_symlink_root(TestEnvironment::temporaryPath("runtime")); }); diff --git a/test/integration/stats_integration_test.cc b/test/integration/stats_integration_test.cc index 1b53d210e16eb..682622828f605 100644 --- a/test/integration/stats_integration_test.cc +++ b/test/integration/stats_integration_test.cc @@ -1,8 +1,9 @@ +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" +#include "envoy/config/metrics/v2/stats.pb.h" + #include "test/integration/integration.h" #include "test/test_common/network_utility.h" -#include "api/bootstrap.pb.h" -#include "api/stats.pb.h" #include "gtest/gtest.h" namespace Envoy { @@ -38,7 +39,7 @@ TEST_P(StatsIntegrationTest, WithDefaultConfig) { } TEST_P(StatsIntegrationTest, WithoutDefaultTagExtractors) { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { bootstrap.mutable_stats_config()->mutable_use_all_default_tags()->set_value(false); }); initialize(); @@ -48,7 +49,7 @@ TEST_P(StatsIntegrationTest, WithoutDefaultTagExtractors) { } TEST_P(StatsIntegrationTest, WithDefaultTagExtractors) { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { bootstrap.mutable_stats_config()->mutable_use_all_default_tags()->set_value(true); }); initialize(); @@ -66,7 +67,7 @@ TEST_P(StatsIntegrationTest, WithDefaultTagExtractors) { // specifier having use defined regex. TEST_P(StatsIntegrationTest, WithDefaultTagExtractorNameWithUserDefinedRegex) { std::string tag_name = Config::TagNames::get().HTTP_CONN_MANAGER_PREFIX; - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { bootstrap.mutable_stats_config()->mutable_use_all_default_tags()->set_value(false); auto tag_specifier = bootstrap.mutable_stats_config()->mutable_stats_tags()->Add(); tag_specifier->set_tag_name(tag_name); @@ -81,7 +82,7 @@ TEST_P(StatsIntegrationTest, WithDefaultTagExtractorNameWithUserDefinedRegex) { } TEST_P(StatsIntegrationTest, WithTagSpecifierMissingTagValue) { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { bootstrap.mutable_stats_config()->mutable_use_all_default_tags()->set_value(false); auto tag_specifier = bootstrap.mutable_stats_config()->mutable_stats_tags()->Add(); tag_specifier->set_tag_name("envoy.http_conn_manager_prefix"); @@ -95,7 +96,7 @@ TEST_P(StatsIntegrationTest, WithTagSpecifierMissingTagValue) { } TEST_P(StatsIntegrationTest, WithTagSpecifierWithRegex) { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { bootstrap.mutable_stats_config()->mutable_use_all_default_tags()->set_value(false); auto tag_specifier = bootstrap.mutable_stats_config()->mutable_stats_tags()->Add(); tag_specifier->set_tag_name("my.http_conn_manager_prefix"); @@ -110,7 +111,7 @@ TEST_P(StatsIntegrationTest, WithTagSpecifierWithRegex) { } TEST_P(StatsIntegrationTest, WithTagSpecifierWithFixedValue) { - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { auto tag_specifier = bootstrap.mutable_stats_config()->mutable_stats_tags()->Add(); tag_specifier->set_tag_name("test.x"); tag_specifier->set_fixed_value("xxx"); diff --git a/test/integration/tcp_proxy_integration_test.cc b/test/integration/tcp_proxy_integration_test.cc index 78f64195401cd..d944ce5f8688f 100644 --- a/test/integration/tcp_proxy_integration_test.cc +++ b/test/integration/tcp_proxy_integration_test.cc @@ -1,5 +1,7 @@ #include "test/integration/tcp_proxy_integration_test.h" +#include "envoy/api/v2/filter/accesslog/accesslog.pb.h" + #include "common/filesystem/filesystem_impl.h" #include "common/network/utility.h" #include "common/ssl/context_manager_impl.h" @@ -8,7 +10,6 @@ #include "test/integration/utility.h" #include "test/mocks/runtime/mocks.h" -#include "api/filter/accesslog/accesslog.pb.h" #include "gtest/gtest.h" using testing::Invoke; @@ -176,7 +177,7 @@ TEST_P(TcpProxyIntegrationTest, LargeBidirectionalTlsWrites) { TEST_P(TcpProxyIntegrationTest, AccessLog) { std::string access_log_path = TestEnvironment::temporaryPath( fmt::format("access_log{}.txt", GetParam() == Network::Address::IpVersion::v4 ? "v4" : "v6")); - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { auto* listener = bootstrap.mutable_static_resources()->mutable_listeners(0); auto* filter_chain = listener->mutable_filter_chains(0); auto* config_blob = filter_chain->mutable_filters(0)->mutable_config(); diff --git a/test/integration/uds_integration_test.h b/test/integration/uds_integration_test.h index bf29bb8967af2..4557de425390e 100644 --- a/test/integration/uds_integration_test.h +++ b/test/integration/uds_integration_test.h @@ -20,17 +20,18 @@ class UdsIntegrationTest : public HttpIntegrationTest, fake_upstreams_.emplace_back(new FakeUpstream( TestEnvironment::unixDomainSocketPath("udstest.1.sock"), FakeHttpConnection::Type::HTTP1)); - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { - auto* static_resources = bootstrap.mutable_static_resources(); - for (int i = 0; i < static_resources->clusters_size(); ++i) { - auto* cluster = static_resources->mutable_clusters(i); - for (int j = 0; j < cluster->hosts_size(); ++j) { - cluster->mutable_hosts(j)->clear_socket_address(); - cluster->mutable_hosts(j)->mutable_pipe()->set_path( - TestEnvironment::unixDomainSocketPath("udstest.1.sock")); - } - } - }); + config_helper_.addConfigModifier( + [&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { + auto* static_resources = bootstrap.mutable_static_resources(); + for (int i = 0; i < static_resources->clusters_size(); ++i) { + auto* cluster = static_resources->mutable_clusters(i); + for (int j = 0; j < cluster->hosts_size(); ++j) { + cluster->mutable_hosts(j)->clear_socket_address(); + cluster->mutable_hosts(j)->mutable_pipe()->set_path( + TestEnvironment::unixDomainSocketPath("udstest.1.sock")); + } + } + }); } }; } // namespace Envoy diff --git a/test/integration/xfcc_integration_test.cc b/test/integration/xfcc_integration_test.cc index 358b506a0a808..905036e50baa8 100644 --- a/test/integration/xfcc_integration_test.cc +++ b/test/integration/xfcc_integration_test.cc @@ -3,6 +3,8 @@ #include #include +#include "envoy/api/v2/filter/network/http_connection_manager.pb.h" + #include "common/event/dispatcher_impl.h" #include "common/http/header_map_impl.h" #include "common/network/utility.h" @@ -14,7 +16,6 @@ #include "test/test_common/printers.h" #include "test/test_common/utility.h" -#include "api/filter/network/http_connection_manager.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" #include "integration.h" @@ -106,7 +107,7 @@ void XfccIntegrationTest::initialize() { hcm.mutable_set_current_client_cert_details()->CopyFrom(sccd_); }); - config_helper_.addConfigModifier([&](envoy::api::v2::Bootstrap& bootstrap) -> void { + config_helper_.addConfigModifier([&](envoy::config::bootstrap::v2::Bootstrap& bootstrap) -> void { auto context = bootstrap.mutable_static_resources()->mutable_clusters(0)->mutable_tls_context(); auto* validation_context = context->mutable_common_tls_context()->mutable_validation_context(); validation_context->mutable_trusted_ca()->set_filename( diff --git a/test/mocks/server/mocks.h b/test/mocks/server/mocks.h index 5bdcd460c7450..ddffec3f13d82 100644 --- a/test/mocks/server/mocks.h +++ b/test/mocks/server/mocks.h @@ -148,11 +148,11 @@ class MockListenerComponentFactory : public ListenerComponentFactory { MOCK_METHOD2(createNetworkFilterFactoryList, std::vector( - const Protobuf::RepeatedPtrField& filters, + const Protobuf::RepeatedPtrField& filters, Configuration::FactoryContext& context)); MOCK_METHOD2(createListenerFilterFactoryList, std::vector( - const Protobuf::RepeatedPtrField&, + const Protobuf::RepeatedPtrField&, Configuration::FactoryContext& context)); MOCK_METHOD2(createListenSocket, Network::ListenSocketSharedPtr(Network::Address::InstanceConstSharedPtr address, diff --git a/test/proto/BUILD b/test/proto/BUILD index 7e8947a233f47..afaf499e04185 100644 --- a/test/proto/BUILD +++ b/test/proto/BUILD @@ -20,8 +20,8 @@ envoy_proto_library( name = "bookstore_proto", srcs = [":bookstore.proto"], external_deps = [ - "http_api_protos", "well_known_protos", + "http_api_protos", ], ) diff --git a/test/server/BUILD b/test/server/BUILD index 23d919ae66692..1096fde1d094f 100644 --- a/test/server/BUILD +++ b/test/server/BUILD @@ -114,6 +114,7 @@ envoy_cc_test( "//test/mocks/server:server_mocks", "//test/test_common:environment_lib", "//test/test_common:utility_lib", + "@envoy_api//envoy/api/v2:lds_cc", ], ) diff --git a/test/server/config/access_log/config_test.cc b/test/server/config/access_log/config_test.cc index 223a65e877f9d..c8224708dff00 100644 --- a/test/server/config/access_log/config_test.cc +++ b/test/server/config/access_log/config_test.cc @@ -40,7 +40,7 @@ class HttpGrpcAccessLogConfigTest : public testing::Test { AccessLog::FilterPtr filter_; NiceMock context_; - envoy::api::v2::filter::accesslog::HttpGrpcAccessLogConfig http_grpc_access_log_; + envoy::config::accesslog::v2::HttpGrpcAccessLogConfig http_grpc_access_log_; ProtobufTypes::MessagePtr message_; AccessLogInstanceFactory* factory_{}; }; diff --git a/test/server/config/http/config_test.cc b/test/server/config/http/config_test.cc index ebd3daa8976b5..0cf205e045018 100644 --- a/test/server/config/http/config_test.cc +++ b/test/server/config/http/config_test.cc @@ -1,5 +1,6 @@ #include +#include "envoy/api/v2/filter/http/router.pb.h" #include "envoy/registry/registry.h" #include "common/config/filter_json.h" @@ -26,7 +27,6 @@ #include "test/mocks/server/mocks.h" #include "test/test_common/utility.h" -#include "api/filter/http/router.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/test/server/config/network/mongo_proxy_test.cc b/test/server/config/network/mongo_proxy_test.cc index 1824d7f28340c..ab0853dfc6985 100644 --- a/test/server/config/network/mongo_proxy_test.cc +++ b/test/server/config/network/mongo_proxy_test.cc @@ -1,11 +1,12 @@ #include +#include "envoy/api/v2/filter/network/mongo_proxy.pb.h" + #include "server/config/network/mongo_proxy.h" #include "test/mocks/server/mocks.h" #include "test/test_common/utility.h" -#include "api/filter/network/mongo_proxy.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" diff --git a/test/server/config/stats/BUILD b/test/server/config/stats/BUILD index 663be08290140..2ae08d70a799b 100644 --- a/test/server/config/stats/BUILD +++ b/test/server/config/stats/BUILD @@ -11,9 +11,6 @@ envoy_package() envoy_cc_test( name = "config_test", srcs = ["config_test.cc"], - external_deps = [ - "envoy_bootstrap", - ], deps = [ "//include/envoy/registry", "//source/common/config:well_known_names", @@ -25,5 +22,6 @@ envoy_cc_test( "//test/test_common:environment_lib", "//test/test_common:network_utility_lib", "//test/test_common:utility_lib", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) diff --git a/test/server/config/stats/config_test.cc b/test/server/config/stats/config_test.cc index 7481614edaa2c..ecfb8b13142ac 100644 --- a/test/server/config/stats/config_test.cc +++ b/test/server/config/stats/config_test.cc @@ -1,5 +1,6 @@ #include +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" #include "envoy/registry/registry.h" #include "common/config/well_known_names.h" @@ -14,7 +15,6 @@ #include "test/test_common/network_utility.h" #include "test/test_common/utility.h" -#include "api/bootstrap.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -30,7 +30,7 @@ namespace Configuration { TEST(StatsConfigTest, ValidTcpStatsd) { const std::string name = Config::StatsSinkNames::get().STATSD; - envoy::api::v2::StatsdSink sink_config; + envoy::config::metrics::v2::StatsdSink sink_config; sink_config.set_tcp_cluster_name("fake_cluster"); StatsSinkFactory* factory = Registry::FactoryRegistry::getFactory(name); @@ -52,7 +52,7 @@ INSTANTIATE_TEST_CASE_P(IpVersions, StatsConfigLoopbackTest, TEST_P(StatsConfigLoopbackTest, ValidUdpIpStatsd) { const std::string name = Config::StatsSinkNames::get().STATSD; - envoy::api::v2::StatsdSink sink_config; + envoy::config::metrics::v2::StatsdSink sink_config; envoy::api::v2::Address& address = *sink_config.mutable_address(); envoy::api::v2::SocketAddress& socket_address = *address.mutable_socket_address(); socket_address.set_protocol(envoy::api::v2::SocketAddress::UDP); @@ -76,8 +76,9 @@ TEST_P(StatsConfigLoopbackTest, ValidUdpIpStatsd) { // Negative test for protoc-gen-validate constraints for statsd. TEST(StatsdConfigTest, ValidateFail) { NiceMock server; - EXPECT_THROW(StatsdSinkFactory().createStatsSink(envoy::api::v2::StatsdSink(), server), - ProtoValidationException); + EXPECT_THROW( + StatsdSinkFactory().createStatsSink(envoy::config::metrics::v2::StatsdSink(), server), + ProtoValidationException); } class DogStatsdConfigLoopbackTest : public testing::TestWithParam {}; @@ -87,7 +88,7 @@ INSTANTIATE_TEST_CASE_P(IpVersions, DogStatsdConfigLoopbackTest, TEST_P(DogStatsdConfigLoopbackTest, ValidUdpIp) { const std::string name = Config::StatsSinkNames::get().DOG_STATSD; - envoy::api::v2::DogStatsdSink sink_config; + envoy::config::metrics::v2::DogStatsdSink sink_config; envoy::api::v2::Address& address = *sink_config.mutable_address(); envoy::api::v2::SocketAddress& socket_address = *address.mutable_socket_address(); socket_address.set_protocol(envoy::api::v2::SocketAddress::UDP); @@ -111,8 +112,9 @@ TEST_P(DogStatsdConfigLoopbackTest, ValidUdpIp) { // Negative test for protoc-gen-validate constraints for dog_statsd. TEST(DogStatsdConfigTest, ValidateFail) { NiceMock server; - EXPECT_THROW(DogStatsdSinkFactory().createStatsSink(envoy::api::v2::DogStatsdSink(), server), - ProtoValidationException); + EXPECT_THROW( + DogStatsdSinkFactory().createStatsSink(envoy::config::metrics::v2::DogStatsdSink(), server), + ProtoValidationException); } } // namespace Configuration diff --git a/test/server/config_validation/cluster_manager_test.cc b/test/server/config_validation/cluster_manager_test.cc index 8ebf7b1745279..583564223ea26 100644 --- a/test/server/config_validation/cluster_manager_test.cc +++ b/test/server/config_validation/cluster_manager_test.cc @@ -33,7 +33,7 @@ TEST(ValidationClusterManagerTest, MockedMethods) { ssl_context_manager, dispatcher, local_info); AccessLog::MockAccessLogManager log_manager; - const envoy::api::v2::Bootstrap bootstrap; + const envoy::config::bootstrap::v2::Bootstrap bootstrap; ClusterManagerPtr cluster_manager = factory.clusterManagerFromProto( bootstrap, stats, tls, runtime, random, local_info, log_manager); EXPECT_EQ(nullptr, cluster_manager->httpConnPoolForCluster("cluster", ResourcePriority::Default, diff --git a/test/server/configuration_impl_test.cc b/test/server/configuration_impl_test.cc index 3251e6039a176..f03ef6c98e866 100644 --- a/test/server/configuration_impl_test.cc +++ b/test/server/configuration_impl_test.cc @@ -56,7 +56,7 @@ class ConfigurationImplTest : public testing::Test { }; TEST_F(ConfigurationImplTest, DefaultStatsFlushInterval) { - envoy::api::v2::Bootstrap bootstrap; + envoy::config::bootstrap::v2::Bootstrap bootstrap; MainImpl config; config.initialize(bootstrap, server_, cluster_manager_factory_); @@ -79,7 +79,7 @@ TEST_F(ConfigurationImplTest, CustomStatsFlushInterval) { } )EOF"; - envoy::api::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); MainImpl config; config.initialize(bootstrap, server_, cluster_manager_factory_); @@ -109,7 +109,7 @@ TEST_F(ConfigurationImplTest, SetUpstreamClusterPerConnectionBufferLimit) { } )EOF"; - envoy::api::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); MainImpl config; config.initialize(bootstrap, server_, cluster_manager_factory_); @@ -151,7 +151,7 @@ TEST_F(ConfigurationImplTest, ServiceClusterNotSetWhenLSTracing) { } )EOF"; - envoy::api::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); server_.local_info_.node_.set_cluster(""); MainImpl config; @@ -174,7 +174,7 @@ TEST_F(ConfigurationImplTest, NullTracerSetWhenTracingConfigurationAbsent) { } )EOF"; - envoy::api::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); server_.local_info_.node_.set_cluster(""); MainImpl config; @@ -210,7 +210,7 @@ TEST_F(ConfigurationImplTest, NullTracerSetWhenHttpKeyAbsentFromTracerConfigurat } )EOF"; - envoy::api::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); server_.local_info_.node_.set_cluster(""); MainImpl config; @@ -246,7 +246,7 @@ TEST_F(ConfigurationImplTest, ConfigurationFailsWhenInvalidTracerSpecified) { } )EOF"; - envoy::api::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); bootstrap.mutable_tracing()->mutable_http()->set_name("invalid"); MainImpl config; EXPECT_THROW_WITH_MESSAGE(config.initialize(bootstrap, server_, cluster_manager_factory_), @@ -267,7 +267,7 @@ TEST_F(ConfigurationImplTest, ProtoSpecifiedStatsSink) { } )EOF"; - envoy::api::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); auto& sink = *bootstrap.mutable_stats_sinks()->Add(); sink.set_name(Config::StatsSinkNames::get().STATSD); @@ -293,9 +293,9 @@ TEST_F(ConfigurationImplTest, StatsSinkWithInvalidName) { } )EOF"; - envoy::api::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); - envoy::api::v2::StatsSink& sink = *bootstrap.mutable_stats_sinks()->Add(); + envoy::config::metrics::v2::StatsSink& sink = *bootstrap.mutable_stats_sinks()->Add(); sink.set_name("envoy.invalid"); auto& field_map = *sink.mutable_config()->mutable_fields(); field_map["tcp_cluster_name"].set_string_value("fake_cluster"); @@ -319,7 +319,7 @@ TEST_F(ConfigurationImplTest, StatsSinkWithNoName) { } )EOF"; - envoy::api::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); + envoy::config::bootstrap::v2::Bootstrap bootstrap = TestUtility::parseBootstrapFromJson(json); auto& sink = *bootstrap.mutable_stats_sinks()->Add(); auto& field_map = *sink.mutable_config()->mutable_fields(); diff --git a/test/server/lds_api_test.cc b/test/server/lds_api_test.cc index 4c37b2b21f92d..fc21b32305302 100644 --- a/test/server/lds_api_test.cc +++ b/test/server/lds_api_test.cc @@ -1,3 +1,5 @@ +#include "envoy/api/v2/lds.pb.h" + #include "common/config/utility.h" #include "common/http/message_impl.h" diff --git a/test/server/listener_manager_impl_test.cc b/test/server/listener_manager_impl_test.cc index 50e0b7dcb3752..2bbf7ac915ec0 100644 --- a/test/server/listener_manager_impl_test.cc +++ b/test/server/listener_manager_impl_test.cc @@ -59,17 +59,17 @@ class ListenerManagerImplTest : public testing::Test { EXPECT_CALL(listener_factory_, createDrainManager_(drain_type)) .WillOnce(Return(raw_listener->drain_manager_)); EXPECT_CALL(listener_factory_, createNetworkFilterFactoryList(_, _)) - .WillOnce(Invoke( - [raw_listener, need_init](const Protobuf::RepeatedPtrField&, - Configuration::FactoryContext& context) - -> std::vector { - std::shared_ptr notifier(raw_listener); - raw_listener->context_ = &context; - if (need_init) { - context.initManager().registerTarget(notifier->target_); - } - return {[notifier](Network::FilterManager&) -> void {}}; - })); + .WillOnce(Invoke([raw_listener, need_init]( + const Protobuf::RepeatedPtrField&, + Configuration::FactoryContext& context) + -> std::vector { + std::shared_ptr notifier(raw_listener); + raw_listener->context_ = &context; + if (need_init) { + context.initManager().registerTarget(notifier->target_); + } + return {[notifier](Network::FilterManager&) -> void {}}; + })); return raw_listener; } @@ -100,16 +100,18 @@ class ListenerManagerImplWithRealFiltersTest : public ListenerManagerImplTest { ListenerManagerImplWithRealFiltersTest() { // Use real filter loading by default. ON_CALL(listener_factory_, createNetworkFilterFactoryList(_, _)) - .WillByDefault(Invoke([](const Protobuf::RepeatedPtrField& filters, - Configuration::FactoryContext& context) - -> std::vector { - return ProdListenerComponentFactory::createNetworkFilterFactoryList_(filters, context); - })); - ON_CALL(listener_factory_, createListenerFilterFactoryList(_, _)) .WillByDefault( - Invoke([](const Protobuf::RepeatedPtrField& filters, + Invoke([](const Protobuf::RepeatedPtrField& filters, Configuration::FactoryContext& context) - -> std::vector { + -> std::vector { + return ProdListenerComponentFactory::createNetworkFilterFactoryList_(filters, + context); + })); + ON_CALL(listener_factory_, createListenerFilterFactoryList(_, _)) + .WillByDefault(Invoke( + [](const Protobuf::RepeatedPtrField& filters, + Configuration::FactoryContext& context) + -> std::vector { return ProdListenerComponentFactory::createListenerFilterFactoryList_(filters, context); })); diff --git a/test/test_common/BUILD b/test/test_common/BUILD index a1fe219e283f2..67bf3b5307c58 100644 --- a/test/test_common/BUILD +++ b/test/test_common/BUILD @@ -70,7 +70,6 @@ envoy_cc_test_library( srcs = ["utility.cc"], hdrs = ["utility.h"], external_deps = [ - "envoy_bootstrap", "abseil_strings", ], deps = [ @@ -85,6 +84,7 @@ envoy_cc_test_library( "//source/common/network:address_lib", "//source/common/network:utility_lib", "//source/common/protobuf:utility_lib", + "@envoy_api//envoy/config/bootstrap/v2:bootstrap_cc", ], ) diff --git a/test/test_common/utility.cc b/test/test_common/utility.cc index ed6d9c0556b46..380b326a7a318 100644 --- a/test/test_common/utility.cc +++ b/test/test_common/utility.cc @@ -151,8 +151,9 @@ std::vector TestUtility::listFiles(const std::string& path, bool re return file_names; } -envoy::api::v2::Bootstrap TestUtility::parseBootstrapFromJson(const std::string& json_string) { - envoy::api::v2::Bootstrap bootstrap; +envoy::config::bootstrap::v2::Bootstrap +TestUtility::parseBootstrapFromJson(const std::string& json_string) { + envoy::config::bootstrap::v2::Bootstrap bootstrap; auto json_object_ptr = Json::Factory::loadFromString(json_string); Config::BootstrapJson::translateBootstrap(*json_object_ptr, bootstrap); return bootstrap; diff --git a/test/test_common/utility.h b/test/test_common/utility.h index 9faa4ec4616b9..dac429f9bcf8c 100644 --- a/test/test_common/utility.h +++ b/test/test_common/utility.h @@ -10,6 +10,7 @@ #include #include "envoy/buffer/buffer.h" +#include "envoy/config/bootstrap/v2/bootstrap.pb.h" #include "envoy/network/address.h" #include "envoy/stats/stats.h" @@ -18,7 +19,6 @@ #include "test/test_common/printers.h" -#include "api/bootstrap.pb.h" #include "gmock/gmock.h" #include "gtest/gtest.h" @@ -192,9 +192,10 @@ class TestUtility { /** * Parse bootstrap config from v1 JSON static config string. * @param json_string source v1 JSON static config string. - * @return envoy::api::v2::Bootstrap. + * @return envoy::config::bootstrap::v2::Bootstrap. */ - static envoy::api::v2::Bootstrap parseBootstrapFromJson(const std::string& json_string); + static envoy::config::bootstrap::v2::Bootstrap + parseBootstrapFromJson(const std::string& json_string); /** * Returns a "novel" IPv4 loopback address, if available. diff --git a/test/tools/schema_validator/validator.cc b/test/tools/schema_validator/validator.cc index 4121b3af678b8..fde2decc8eeb4 100644 --- a/test/tools/schema_validator/validator.cc +++ b/test/tools/schema_validator/validator.cc @@ -52,8 +52,8 @@ void Validator::validate(const std::string& json_path, Schema::Type schema_type) case Schema::Type::Route: { Runtime::MockLoader runtime; Upstream::MockClusterManager cm; - // Construct a envoy::api::v2::RouteConfiguration to validate the Route configuration and ignore - // the output since nothing will consume it. + // Construct a envoy::api::v2::RouteConfiguration to validate the Route configuration and + // ignore the output since nothing will consume it. envoy::api::v2::RouteConfiguration route_config; Config::RdsJson::translateRouteConfiguration(*loader, route_config); break;