diff --git a/.bazelrc b/.bazelrc index 15173a48b..3f0c52e31 100644 --- a/.bazelrc +++ b/.bazelrc @@ -30,9 +30,10 @@ build:linux --copt=-fPIC # We already have absl in the build, define absl=1 to tell googletest to use absl for backtrace. build --define absl=1 -# Pass PATH, CC and CXX variables from the environment. +# Pass PATH, CC, CXX and LLVM_CONFIG variables from the environment. build --action_env=CC build --action_env=CXX +build --action_env=LLVM_CONFIG build --action_env=PATH # Common flags for sanitizers @@ -162,7 +163,7 @@ build:remote-msan --config=rbe-toolchain-msan # Docker sandbox # NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/master/toolchains/rbe_toolchains_config.bzl#L7 -build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu@sha256:f0b2453c3587e3297f5caf5e97fbf57c97592c96136209ec13fe2795aae2c896 +build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu@sha256:3788a87461f2b3dc8048ad0ce5df40438a56e0a8f1a4ab0f61b4ef0d8c11ff1f build:docker-sandbox --spawn_strategy=docker build:docker-sandbox --strategy=Javac=docker build:docker-sandbox --strategy=Closure=docker diff --git a/.circleci/config.yml b/.circleci/config.yml index 8376cfe91..ff9710745 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,7 @@ references: envoy-build-image: &envoy-build-image - envoyproxy/envoy-build-ubuntu@sha256:3ca8acc35fdb57ab26e1bb5f9488f37095f45acd77a12602510410dbefa00b58 # October 31th, 2019 + # Jan 9th, 2020 + envoyproxy/envoy-build-ubuntu@sha256:3788a87461f2b3dc8048ad0ce5df40438a56e0a8f1a4ab0f61b4ef0d8c11ff1f version: 2 jobs: build: diff --git a/api/client/BUILD b/api/client/BUILD index f0b719779..e2f54f289 100644 --- a/api/client/BUILD +++ b/api/client/BUILD @@ -12,9 +12,8 @@ api_cc_py_proto_library( ], visibility = ["//visibility:public"], deps = [ - "@envoy_api//envoy/api/v2/auth:pkg", - "@envoy_api//envoy/api/v2/cluster:pkg", - "@envoy_api//envoy/api/v2/core:pkg", + "@envoy_api//envoy/config/core/v3alpha:pkg", + "@envoy_api//envoy/extensions/transport_sockets/tls/v3alpha:pkg", ], ) diff --git a/api/client/options.proto b/api/client/options.proto index a534cd507..b84c7e87f 100644 --- a/api/client/options.proto +++ b/api/client/options.proto @@ -4,14 +4,14 @@ package nighthawk.client; import "google/protobuf/duration.proto"; import "google/protobuf/wrappers.proto"; -import "envoy/api/v2/auth/cert.proto"; -import "envoy/api/v2/core/base.proto"; +import "envoy/config/core/v3alpha/base.proto"; +import "envoy/extensions/transport_sockets/tls/v3alpha/cert.proto"; import "validate/validate.proto"; // Allows for static configuration of requests that should be send by the load generator. message RequestOptions { - envoy.api.v2.core.RequestMethod request_method = 1; - repeated envoy.api.v2.core.HeaderValueOption request_headers = 2; + envoy.config.core.v3alpha.RequestMethod request_method = 1; + repeated envoy.config.core.v3alpha.HeaderValueOption request_headers = 2; // Our StreamDecoder depends on bounding the size here, so if this changes, an amendment // to that is needed as well. google.protobuf.UInt32Value request_body_size = 3 [(validate.rules).uint32 = {lte: 4194304}]; @@ -130,7 +130,7 @@ message CommandLineOptions { RequestSource request_source = 26; } // See :option:`--tls_context` for details. - envoy.api.v2.auth.UpstreamTlsContext tls_context = 13; + envoy.extensions.transport_sockets.tls.v3alpha.UpstreamTlsContext tls_context = 13; // See :option:`--max-pending_requests` for details. google.protobuf.UInt32Value max_pending_requests = 14; // See :option:`--max-active_requests` for details. @@ -167,5 +167,5 @@ message CommandLineOptions { // See :option:`--labels` repeated string labels = 28; // See :option:`--transport-socket` for details. - envoy.api.v2.core.TransportSocket transport_socket = 27; + envoy.config.core.v3alpha.TransportSocket transport_socket = 27; } diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index 722b43c7a..8acf449e9 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -1,7 +1,7 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -ENVOY_COMMIT = "a78311faf214bb9216f92407102b547b6fcd14a3" # December 13th, 2019 -ENVOY_SHA = "2e65ed67b3413e5c177321360ae6e15bf78dac24f65336a252bd59c1f6bb5a08" +ENVOY_COMMIT = "29b30911dbfb3f9760efeb28238ceac36e1a1a23" # Jan 9th, 2019 +ENVOY_SHA = "b52455552e922be27a51c2b0bb6e1c2b73c42207ddee46fd36b22401115e43fa" RULES_PYTHON_COMMIT = "fdbb17a4118a1728d19e638a5291b4c4266ea5b8" RULES_PYTHON_SHA = "9a3d71e348da504a9c4c5e8abd4cb822f7afb32c613dc6ee8b8535333a81a938" diff --git a/include/nighthawk/client/options.h b/include/nighthawk/client/options.h index 7bf122475..b42a01f16 100644 --- a/include/nighthawk/client/options.h +++ b/include/nighthawk/client/options.h @@ -5,9 +5,9 @@ #include #include -#include "envoy/api/v2/cds.pb.h" -#include "envoy/api/v2/core/base.pb.h" #include "envoy/common/pure.h" +#include "envoy/config/cluster/v3alpha/cluster.pb.h" +#include "envoy/config/core/v3alpha/base.pb.h" #include "api/client/options.pb.h" @@ -38,11 +38,13 @@ class Options { virtual bool prefetchConnections() const PURE; virtual uint32_t burstSize() const PURE; virtual nighthawk::client::AddressFamily::AddressFamilyOptions addressFamily() const PURE; - virtual envoy::api::v2::core::RequestMethod requestMethod() const PURE; + virtual envoy::config::core::v3alpha::RequestMethod requestMethod() const PURE; virtual std::vector requestHeaders() const PURE; virtual uint32_t requestBodySize() const PURE; - virtual const envoy::api::v2::auth::UpstreamTlsContext& tlsContext() const PURE; - virtual const absl::optional& transportSocket() const PURE; + virtual const envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext& + tlsContext() const PURE; + virtual const absl::optional& + transportSocket() const PURE; virtual uint32_t maxPendingRequests() const PURE; virtual uint32_t maxActiveRequests() const PURE; virtual uint32_t maxRequestsPerConnection() const PURE; diff --git a/source/client/factories_impl.cc b/source/client/factories_impl.cc index 312a8db08..c585321ac 100644 --- a/source/client/factories_impl.cc +++ b/source/client/factories_impl.cc @@ -143,7 +143,7 @@ RequestSourcePtr RequestSourceFactoryImpl::create() const { : Envoy::Http::Headers::get().SchemeValues.Http); } - header->setMethod(envoy::api::v2::core::RequestMethod_Name(options_.requestMethod())); + header->setMethod(envoy::config::core::v3alpha::RequestMethod_Name(options_.requestMethod())); const uint32_t content_length = options_.requestBodySize(); if (content_length > 0) { header->setContentLength(content_length); diff --git a/source/client/options_impl.cc b/source/client/options_impl.cc index ce6705804..88a37ce4d 100644 --- a/source/client/options_impl.cc +++ b/source/client/options_impl.cc @@ -290,7 +290,7 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) { if (request_method.isSet()) { std::string upper_cased = request_method.getValue(); absl::AsciiStrToUpper(&upper_cased); - RELEASE_ASSERT(envoy::api::v2::core::RequestMethod_Parse(upper_cased, &request_method_), + RELEASE_ASSERT(envoy::config::core::v3alpha::RequestMethod_Parse(upper_cased, &request_method_), "Failed to parse request method"); } TCLAP_SET_IF_SPECIFIED(request_headers, request_headers_); @@ -402,7 +402,7 @@ OptionsImpl::OptionsImpl(int argc, const char* const* argv) { } if (!transport_socket.getValue().empty()) { try { - transport_socket_.emplace(envoy::api::v2::core::TransportSocket()); + transport_socket_.emplace(envoy::config::core::v3alpha::TransportSocket()); Envoy::MessageUtil::loadFromJson(transport_socket.getValue(), transport_socket_.value(), Envoy::ProtobufMessage::getStrictValidationVisitor()); } catch (const Envoy::EnvoyException& e) { @@ -475,7 +475,7 @@ OptionsImpl::OptionsImpl(const nighthawk::client::CommandLineOptions& options) { const auto& request_options = options.request_options(); if (request_options.request_method() != - ::envoy::api::v2::core::RequestMethod::METHOD_UNSPECIFIED) { + ::envoy::config::core::v3alpha::RequestMethod::METHOD_UNSPECIFIED) { request_method_ = request_options.request_method(); } request_body_size_ = @@ -497,7 +497,7 @@ OptionsImpl::OptionsImpl(const nighthawk::client::CommandLineOptions& options) { tls_context_.MergeFrom(options.tls_context()); if (options.has_transport_socket()) { - transport_socket_.emplace(envoy::api::v2::core::TransportSocket()); + transport_socket_.emplace(envoy::config::core::v3alpha::TransportSocket()); transport_socket_.value().MergeFrom(options.transport_socket()); } diff --git a/source/client/options_impl.h b/source/client/options_impl.h index ebb96d845..f8d8b62a2 100644 --- a/source/client/options_impl.h +++ b/source/client/options_impl.h @@ -42,13 +42,17 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable requestHeaders() const override { return request_headers_; }; uint32_t requestBodySize() const override { return request_body_size_; }; - const envoy::api::v2::auth::UpstreamTlsContext& tlsContext() const override { + const envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext& + tlsContext() const override { return tls_context_; }; - const absl::optional& transportSocket() const override { + const absl::optional& + transportSocket() const override { return transport_socket_; } uint32_t maxPendingRequests() const override { return max_pending_requests_; } @@ -98,11 +102,12 @@ class OptionsImpl : public Options, public Envoy::Logger::Loggable request_headers_; uint32_t request_body_size_{0}; - envoy::api::v2::auth::UpstreamTlsContext tls_context_; - absl::optional transport_socket_; + envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext tls_context_; + absl::optional transport_socket_; uint32_t max_pending_requests_{0}; // This default is based the minimum recommendation for SETTINGS_MAX_CONCURRENT_STREAMS over at // https://tools.ietf.org/html/rfc7540#section-6.5.2 diff --git a/source/client/process_impl.cc b/source/client/process_impl.cc index 90f01722c..234ad5722 100644 --- a/source/client/process_impl.cc +++ b/source/client/process_impl.cc @@ -244,27 +244,28 @@ ProcessImpl::mergeWorkerStatistics(const StatisticFactory& statistic_factory, return merged_statistics; } -void ProcessImpl::createBootstrapConfiguration(envoy::config::bootstrap::v2::Bootstrap& bootstrap, - const std::vector& uris, - int number_of_clusters) const { +void ProcessImpl::createBootstrapConfiguration( + envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap, const std::vector& uris, + int number_of_clusters) const { for (int i = 0; i < number_of_clusters; i++) { auto* cluster = bootstrap.mutable_static_resources()->add_clusters(); RELEASE_ASSERT(!uris.empty(), "illegal configuration with zero endpoints"); if (uris[0]->scheme() == "https") { - auto* tls_context = cluster->mutable_tls_context(); - *tls_context = options_.tlsContext(); - auto* common_tls_context = tls_context->mutable_common_tls_context(); + auto* transport_socket = cluster->mutable_transport_socket(); + transport_socket->set_name("envoy.transport_sockets.tls"); + envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext context = + options_.tlsContext(); + auto* common_tls_context = context.mutable_common_tls_context(); if (options_.h2()) { common_tls_context->add_alpn_protocols("h2"); } else { common_tls_context->add_alpn_protocols("http/1.1"); } + transport_socket->mutable_typed_config()->PackFrom(context); } - if (options_.transportSocket().has_value()) { *cluster->mutable_transport_socket() = options_.transportSocket().value(); } - cluster->set_name(fmt::format("{}", i)); cluster->mutable_connect_timeout()->set_seconds(options_.timeout().count()); cluster->mutable_max_requests_per_connection()->set_value(options_.maxRequestsPerConnection()); @@ -279,7 +280,8 @@ void ProcessImpl::createBootstrapConfiguration(envoy::config::bootstrap::v2::Boo options_.maxPendingRequests() == 0 ? 1 : options_.maxPendingRequests()); thresholds->mutable_max_requests()->set_value(options_.maxActiveRequests()); - cluster->set_type(envoy::api::v2::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC); + cluster->set_type( + envoy::config::cluster::v3alpha::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC); for (const UriPtr& uri : uris) { auto* host = cluster->add_hosts(); auto* socket_address = host->mutable_socket_address(); @@ -289,27 +291,28 @@ void ProcessImpl::createBootstrapConfiguration(envoy::config::bootstrap::v2::Boo } } -void ProcessImpl::addTracingCluster(envoy::config::bootstrap::v2::Bootstrap& bootstrap, +void ProcessImpl::addTracingCluster(envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap, const Uri& uri) const { auto* cluster = bootstrap.mutable_static_resources()->add_clusters(); cluster->set_name("tracing"); cluster->mutable_connect_timeout()->set_seconds(options_.timeout().count()); - cluster->set_type(envoy::api::v2::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC); + cluster->set_type( + envoy::config::cluster::v3alpha::Cluster::DiscoveryType::Cluster_DiscoveryType_STATIC); auto* host = cluster->add_hosts(); auto* socket_address = host->mutable_socket_address(); socket_address->set_address(uri.address()->ip()->addressAsString()); socket_address->set_port_value(uri.port()); } -void ProcessImpl::setupTracingImplementation(envoy::config::bootstrap::v2::Bootstrap& bootstrap, - const Uri& uri) const { +void ProcessImpl::setupTracingImplementation( + envoy::config::bootstrap::v3alpha::Bootstrap& bootstrap, const Uri& uri) const { #ifdef ZIPKIN_ENABLED auto* http = bootstrap.mutable_tracing()->mutable_http(); auto scheme = uri.scheme(); const std::string kTracingClusterName = "tracing"; http->set_name(fmt::format("envoy.{}", scheme)); RELEASE_ASSERT(scheme == "zipkin", "Only zipkin is supported"); - envoy::config::trace::v2::ZipkinConfig config; + envoy::config::trace::v3alpha::ZipkinConfig config; config.mutable_collector_cluster()->assign(kTracingClusterName); config.mutable_collector_endpoint()->assign(std::string(uri.path())); config.mutable_shared_span_context()->set_value(true); @@ -321,7 +324,8 @@ void ProcessImpl::setupTracingImplementation(envoy::config::bootstrap::v2::Boots #endif } -void ProcessImpl::maybeCreateTracingDriver(const envoy::config::trace::v2::Tracing& configuration) { +void ProcessImpl::maybeCreateTracingDriver( + const envoy::config::trace::v3alpha::Tracing& configuration) { if (configuration.has_http()) { #ifdef ZIPKIN_ENABLED std::string type = configuration.http().name(); @@ -332,10 +336,10 @@ void ProcessImpl::maybeCreateTracingDriver(const envoy::config::trace::v2::Traci // upstream code changes. auto& factory = Config::Utility::getAndCheckFactory( - configuration.http().name()); + configuration.http()); ProtobufTypes::MessagePtr message = Envoy::Config::Utility::translateToFactoryConfig( configuration.http(), Envoy::ProtobufMessage::getStrictValidationVisitor(), factory); - auto zipkin_config = dynamic_cast(*message); + auto zipkin_config = dynamic_cast(*message); Envoy::Tracing::DriverPtr zipkin_driver = std::make_unique( zipkin_config, *cluster_manager_, store_root_, tls_, @@ -402,7 +406,7 @@ bool ProcessImpl::run(OutputCollector& collector) { if (options_.h2UseMultipleConnections()) { cluster_manager_factory_->enableMultiConnectionH2Pool(); } - envoy::config::bootstrap::v2::Bootstrap bootstrap; + envoy::config::bootstrap::v3alpha::Bootstrap bootstrap; createBootstrapConfiguration(bootstrap, uris, number_of_workers); if (tracing_uri != nullptr) { setupTracingImplementation(bootstrap, *tracing_uri); diff --git a/source/client/process_impl.h b/source/client/process_impl.h index 30fc3ac78..fd7de4f31 100644 --- a/source/client/process_impl.h +++ b/source/client/process_impl.h @@ -50,12 +50,13 @@ class ProcessImpl : public Process, public Envoy::Logger::Loggable& uris, int number_of_workers) const; - void maybeCreateTracingDriver(const envoy::config::trace::v2::Tracing& configuration); + void maybeCreateTracingDriver(const envoy::config::trace::v3alpha::Tracing& configuration); void shutdown() override; private: diff --git a/source/server/README.md b/source/server/README.md index c427c5780..780dd139f 100644 --- a/source/server/README.md +++ b/source/server/README.md @@ -84,7 +84,8 @@ admin: ``` USAGE: -bazel-bin/nighthawk_test_server [--use-fake-symbol-table ] +bazel-bin/nighthawk_test_server [--disable-extensions ] +[--use-fake-symbol-table ] [--cpuset-threads] [--enable-mutex-tracing] [--disable-hot-restart] @@ -114,6 +115,9 @@ bazel-bin/nighthawk_test_server [--use-fake-symbol-table ] Where: +--disable-extensions +Comma-separated list of extensions to disable + --use-fake-symbol-table Use fake symbol table implementation diff --git a/source/server/http_test_server_filter_config.cc b/source/server/http_test_server_filter_config.cc index 4efd32440..ffd814303 100644 --- a/source/server/http_test_server_filter_config.cc +++ b/source/server/http_test_server_filter_config.cc @@ -31,7 +31,7 @@ class HttpTestServerDecoderFilterConfig return Envoy::ProtobufTypes::MessagePtr{new nighthawk::server::ResponseOptions()}; } - std::string name() override { return "test-server"; } + std::string name() const override { return "test-server"; } private: Envoy::Http::FilterFactoryCb createFilter(const nighthawk::server::ResponseOptions& proto_config, diff --git a/test/mocks.h b/test/mocks.h index 4d257ff80..9188f1ce7 100644 --- a/test/mocks.h +++ b/test/mocks.h @@ -81,11 +81,13 @@ class MockOptions : public Client::Options { MOCK_CONST_METHOD0(prefetchConnections, bool()); MOCK_CONST_METHOD0(burstSize, uint32_t()); MOCK_CONST_METHOD0(addressFamily, nighthawk::client::AddressFamily::AddressFamilyOptions()); - MOCK_CONST_METHOD0(requestMethod, envoy::api::v2::core::RequestMethod()); + MOCK_CONST_METHOD0(requestMethod, envoy::config::core::v3alpha::RequestMethod()); MOCK_CONST_METHOD0(requestHeaders, std::vector()); MOCK_CONST_METHOD0(requestBodySize, uint32_t()); - MOCK_CONST_METHOD0(tlsContext, envoy::api::v2::auth::UpstreamTlsContext&()); - MOCK_CONST_METHOD0(transportSocket, absl::optional&()); + MOCK_CONST_METHOD0(tlsContext, + envoy::extensions::transport_sockets::tls::v3alpha::UpstreamTlsContext&()); + MOCK_CONST_METHOD0(transportSocket, + absl::optional&()); MOCK_CONST_METHOD0(maxPendingRequests, uint32_t()); MOCK_CONST_METHOD0(maxActiveRequests, uint32_t()); MOCK_CONST_METHOD0(maxRequestsPerConnection, uint32_t()); diff --git a/test/options_test.cc b/test/options_test.cc index 360084254..4cf1c2499 100644 --- a/test/options_test.cc +++ b/test/options_test.cc @@ -70,7 +70,7 @@ TEST_F(OptionsImplTest, AlmostAll) { EXPECT_EQ(13, options->burstSize()); EXPECT_EQ(nighthawk::client::AddressFamily::V6, options->addressFamily()); EXPECT_EQ(good_test_uri_, options->uri()); - EXPECT_EQ(envoy::api::v2::core::RequestMethod::POST, options->requestMethod()); + EXPECT_EQ(envoy::config::core::v3alpha::RequestMethod::POST, options->requestMethod()); const std::vector expected_headers = {"f1:b1", "f2:b2", "f3:b3:b4"}; EXPECT_EQ(expected_headers, options->requestHeaders()); EXPECT_EQ(1234, options->requestBodySize()); @@ -493,7 +493,8 @@ TEST_F(OptionsImplTest, BadTlsContextSpecification) { EXPECT_THROW_WITH_REGEX( TestUtility::createOptionsImpl(fmt::format("{} --tls-context {} http://foo/", client_name_, "{misspelled_tls_context:{}}")), - MalformedArgvException, "envoy.api.v2.auth.UpstreamTlsContext reason INVALID_ARGUMENT"); + MalformedArgvException, + "envoy.extensions.transport_sockets.tls.v3alpha.UpstreamTlsContext reason INVALID_ARGUMENT"); } TEST_F(OptionsImplTest, BadTransportSocketSpecification) { @@ -507,7 +508,7 @@ TEST_F(OptionsImplTest, BadTransportSocketSpecification) { TestUtility::createOptionsImpl(fmt::format("{} --transport-socket {} http://foo/", client_name_, "{misspelled_transport_socket:{}}")), MalformedArgvException, - "Protobuf message \\(type envoy.api.v2.core.TransportSocket reason " + "Protobuf message \\(type envoy.config.core.v3alpha.TransportSocket reason " "INVALID_ARGUMENT:misspelled_transport_socket: Cannot find field.\\) has unknown fields"); }