From 5f1bce050b7235bdf2cb62a0dca306da608d68ae Mon Sep 17 00:00:00 2001 From: Vadim Eisenberg Date: Thu, 22 Nov 2018 09:24:47 +0200 Subject: [PATCH 1/5] update envoy SHA to 48b161ee02f4ca77b8c26959c4058456ad3f197f --- WORKSPACE | 4 ++-- istio.deps | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 460020c15c4..68e7657b375 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -30,8 +30,8 @@ bind( ) # When updating envoy sha manually please update the sha in istio.deps file also -ENVOY_SHA = "fcc68f1165d0343891d3ce14c2952019fe403743" -ENVOY_SHA256 = "44b38c68be6f80deffb26c91151d3bf7e97575d286d5316770473dc1dc2198de" +ENVOY_SHA = "48b161ee02f4ca77b8c26959c4058456ad3f197f" +ENVOY_SHA256 = "ae044661f49db58cfb79fa65f1213a2e07758e3fac1e3e4088fd9edafa8e590d" http_archive( name = "envoy", diff --git a/istio.deps b/istio.deps index 0798b9e5543..97636aae0f3 100644 --- a/istio.deps +++ b/istio.deps @@ -11,6 +11,6 @@ "name": "ENVOY_SHA", "repoName": "envoyproxy/envoy", "file": "WORKSPACE", - "lastStableSHA": "fcc68f1165d0343891d3ce14c2952019fe403743" + "lastStableSHA": "48b161ee02f4ca77b8c26959c4058456ad3f197f" } ] From ebbc0a5b98944a391a36a49c8a76d7e73d8023fa Mon Sep 17 00:00:00 2001 From: Vadim Eisenberg Date: Thu, 22 Nov 2018 10:06:40 +0200 Subject: [PATCH 2/5] use Http::AsyncClient::RequestOptions() in AsyncClient::send() --- src/envoy/http/jwt_auth/jwt_authenticator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/envoy/http/jwt_auth/jwt_authenticator.cc b/src/envoy/http/jwt_auth/jwt_authenticator.cc index c47b8b6d036..b309b6b169a 100644 --- a/src/envoy/http/jwt_auth/jwt_authenticator.cc +++ b/src/envoy/http/jwt_auth/jwt_authenticator.cc @@ -138,7 +138,7 @@ void JwtAuthenticator::FetchPubkey(PubkeyCacheItem* issuer) { ENVOY_LOG(debug, "fetch pubkey from [uri = {}]: start", uri_); request_ = cm_.httpAsyncClientForCluster(cluster).send( - std::move(message), *this, absl::optional()); + std::move(message), *this, Http::AsyncClient::RequestOptions()); } void JwtAuthenticator::onSuccess(MessagePtr&& response) { From df21002836a43081a2c41cc8a01c3dc3973a5948 Mon Sep 17 00:00:00 2001 From: Vadim Eisenberg Date: Thu, 22 Nov 2018 10:16:25 +0200 Subject: [PATCH 3/5] PerConnectionCluster::Key -> PerConnectionCluster::key() --- .../tcp_cluster_rewrite/tcp_cluster_rewrite.cc | 6 +++--- .../tcp_cluster_rewrite_test.cc | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/envoy/tcp/tcp_cluster_rewrite/tcp_cluster_rewrite.cc b/src/envoy/tcp/tcp_cluster_rewrite/tcp_cluster_rewrite.cc index b189c40abd6..c1306d67a5e 100644 --- a/src/envoy/tcp/tcp_cluster_rewrite/tcp_cluster_rewrite.cc +++ b/src/envoy/tcp/tcp_cluster_rewrite/tcp_cluster_rewrite.cc @@ -43,13 +43,13 @@ Network::FilterStatus TcpClusterRewriteFilter::onNewConnection() { .streamInfo() .filterState() .hasData( - TcpProxy::PerConnectionCluster::Key)) { + TcpProxy::PerConnectionCluster::key())) { absl::string_view cluster_name = read_callbacks_->connection() .streamInfo() .filterState() .getDataReadOnly( - TcpProxy::PerConnectionCluster::Key) + TcpProxy::PerConnectionCluster::key()) .value(); ENVOY_CONN_LOG(trace, "tcp_cluster_rewrite: new connection with server name {}", @@ -66,7 +66,7 @@ Network::FilterStatus TcpClusterRewriteFilter::onNewConnection() { // The data is mutable to allow other filters to change it. read_callbacks_->connection().streamInfo().filterState().setData( - TcpProxy::PerConnectionCluster::Key, + TcpProxy::PerConnectionCluster::key(), std::make_unique(final_cluster_name), StreamInfo::FilterState::StateType::Mutable); } diff --git a/src/envoy/tcp/tcp_cluster_rewrite/tcp_cluster_rewrite_test.cc b/src/envoy/tcp/tcp_cluster_rewrite/tcp_cluster_rewrite_test.cc index a63ae3d937a..c42aa58cc33 100644 --- a/src/envoy/tcp/tcp_cluster_rewrite/tcp_cluster_rewrite_test.cc +++ b/src/envoy/tcp/tcp_cluster_rewrite/tcp_cluster_rewrite_test.cc @@ -62,7 +62,7 @@ TEST_F(TcpClusterRewriteFilterTest, ClusterRewrite) { // no rewrite { stream_info_.filterState().setData( - TcpProxy::PerConnectionCluster::Key, + TcpProxy::PerConnectionCluster::key(), std::make_unique( "hello.ns1.svc.cluster.local"), StreamInfo::FilterState::StateType::Mutable); @@ -70,12 +70,12 @@ TEST_F(TcpClusterRewriteFilterTest, ClusterRewrite) { EXPECT_TRUE( stream_info_.filterState().hasData( - TcpProxy::PerConnectionCluster::Key)); + TcpProxy::PerConnectionCluster::key())); auto per_connection_cluster = stream_info_.filterState() .getDataReadOnly( - TcpProxy::PerConnectionCluster::Key); + TcpProxy::PerConnectionCluster::key()); EXPECT_EQ(per_connection_cluster.value(), "hello.ns1.svc.cluster.local"); } @@ -87,19 +87,19 @@ TEST_F(TcpClusterRewriteFilterTest, ClusterRewrite) { configure(proto_config); stream_info_.filterState().setData( - TcpProxy::PerConnectionCluster::Key, + TcpProxy::PerConnectionCluster::key(), std::make_unique("hello.ns1.global"), StreamInfo::FilterState::StateType::Mutable); filter_->onNewConnection(); EXPECT_TRUE( stream_info_.filterState().hasData( - TcpProxy::PerConnectionCluster::Key)); + TcpProxy::PerConnectionCluster::key())); auto per_connection_cluster = stream_info_.filterState() .getDataReadOnly( - TcpProxy::PerConnectionCluster::Key); + TcpProxy::PerConnectionCluster::key()); EXPECT_EQ(per_connection_cluster.value(), "hello.ns1.svc.cluster.local"); } @@ -111,19 +111,19 @@ TEST_F(TcpClusterRewriteFilterTest, ClusterRewrite) { configure(proto_config); stream_info_.filterState().setData( - TcpProxy::PerConnectionCluster::Key, + TcpProxy::PerConnectionCluster::key(), std::make_unique("hello.ns1.global"), StreamInfo::FilterState::StateType::Mutable); filter_->onNewConnection(); EXPECT_TRUE( stream_info_.filterState().hasData( - TcpProxy::PerConnectionCluster::Key)); + TcpProxy::PerConnectionCluster::key())); auto per_connection_cluster = stream_info_.filterState() .getDataReadOnly( - TcpProxy::PerConnectionCluster::Key); + TcpProxy::PerConnectionCluster::key()); EXPECT_EQ(per_connection_cluster.value(), "another.svc.cluster.local"); } } From 9d6d0f30d61ec55becfd76f728fffc91dd271d35 Mon Sep 17 00:00:00 2001 From: Vadim Eisenberg Date: Thu, 22 Nov 2018 16:47:05 +0200 Subject: [PATCH 4/5] use Http::AsyncClient::RequestOptions() in AsyncClient::send() in the test --- src/envoy/http/jwt_auth/jwt_authenticator_test.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/envoy/http/jwt_auth/jwt_authenticator_test.cc b/src/envoy/http/jwt_auth/jwt_authenticator_test.cc index fd35224e7fe..91de2eb68a7 100644 --- a/src/envoy/http/jwt_auth/jwt_authenticator_test.cc +++ b/src/envoy/http/jwt_auth/jwt_authenticator_test.cc @@ -312,7 +312,7 @@ class MockUpstream { ON_CALL(mock_cm.async_client_, send_(_, _, _)) .WillByDefault( Invoke([this](MessagePtr &, AsyncClient::Callbacks &cb, - const absl::optional &) + const Http::AsyncClient::RequestOptions &) -> AsyncClient::Request * { Http::MessagePtr response_message(new ResponseMessageImpl( HeaderMapPtr{new TestHeaderMapImpl{{":status", "200"}}})); @@ -629,7 +629,7 @@ TEST_F(JwtAuthenticatorTest, TestPubkeyFetchFail) { AsyncClient::Callbacks *callbacks; EXPECT_CALL(async_client, send_(_, _, _)) .WillOnce(Invoke([&](MessagePtr &message, AsyncClient::Callbacks &cb, - const absl::optional &) + const Http::AsyncClient::RequestOptions &) -> AsyncClient::Request * { EXPECT_EQ((TestHeaderMapImpl{ {":method", "GET"}, @@ -665,7 +665,7 @@ TEST_F(JwtAuthenticatorTest, TestInvalidPubkey) { AsyncClient::Callbacks *callbacks; EXPECT_CALL(async_client, send_(_, _, _)) .WillOnce(Invoke([&](MessagePtr &message, AsyncClient::Callbacks &cb, - const absl::optional &) + const Http::AsyncClient::RequestOptions &) -> AsyncClient::Request * { EXPECT_EQ((TestHeaderMapImpl{ {":method", "GET"}, @@ -702,7 +702,7 @@ TEST_F(JwtAuthenticatorTest, TestOnDestroy) { AsyncClient::Callbacks *callbacks; EXPECT_CALL(async_client, send_(_, _, _)) .WillOnce(Invoke([&](MessagePtr &message, AsyncClient::Callbacks &cb, - const absl::optional &) + const Http::AsyncClient::RequestOptions &) -> AsyncClient::Request * { EXPECT_EQ((TestHeaderMapImpl{ {":method", "GET"}, From 80b4b2f373ae20df433cd09bb6fc1373de13559b Mon Sep 17 00:00:00 2001 From: Vadim Eisenberg Date: Thu, 22 Nov 2018 17:03:04 +0200 Subject: [PATCH 5/5] fix format --- .../http/jwt_auth/jwt_authenticator_test.cc | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/envoy/http/jwt_auth/jwt_authenticator_test.cc b/src/envoy/http/jwt_auth/jwt_authenticator_test.cc index 91de2eb68a7..b4d9b3ec260 100644 --- a/src/envoy/http/jwt_auth/jwt_authenticator_test.cc +++ b/src/envoy/http/jwt_auth/jwt_authenticator_test.cc @@ -310,18 +310,16 @@ class MockUpstream { const std::string &response_body) : request_(&mock_cm.async_client_), response_body_(response_body) { ON_CALL(mock_cm.async_client_, send_(_, _, _)) - .WillByDefault( - Invoke([this](MessagePtr &, AsyncClient::Callbacks &cb, - const Http::AsyncClient::RequestOptions &) - -> AsyncClient::Request * { - Http::MessagePtr response_message(new ResponseMessageImpl( - HeaderMapPtr{new TestHeaderMapImpl{{":status", "200"}}})); - response_message->body().reset( - new Buffer::OwnedImpl(response_body_)); - cb.onSuccess(std::move(response_message)); - called_count_++; - return &request_; - })); + .WillByDefault(Invoke([this](MessagePtr &, AsyncClient::Callbacks &cb, + const Http::AsyncClient::RequestOptions &) + -> AsyncClient::Request * { + Http::MessagePtr response_message(new ResponseMessageImpl( + HeaderMapPtr{new TestHeaderMapImpl{{":status", "200"}}})); + response_message->body().reset(new Buffer::OwnedImpl(response_body_)); + cb.onSuccess(std::move(response_message)); + called_count_++; + return &request_; + })); } int called_count() const { return called_count_; }