Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and fix compile errors. #1993

Merged
merged 6 commits into from
Oct 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
destination: /proxy/bin
linux_asan:
docker:
- image: istio/ci:go1.10-bazel0.15-clang6.0
- image: istio/ci:go1.10-bazel0.18-clang6.0
environment:
- BAZEL_TEST_ARGS: "--test_env=ENVOY_IP_TEST_VERSIONS=v4only --test_output=all"
resource_class: xlarge
Expand All @@ -49,7 +49,7 @@ jobs:
- /home/circleci/.cache/bazel
linux_tsan:
docker:
- image: istio/ci:go1.10-bazel0.15-clang6.0
- image: istio/ci:go1.10-bazel0.18-clang6.0
environment:
- BAZEL_TEST_ARGS: "--test_env=ENVOY_IP_TEST_VERSIONS=v4only --test_output=all"
resource_class: xlarge
Expand Down
3 changes: 0 additions & 3 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,3 @@ genrule(
visibility = ["//visibility:public"],
)

load("@io_bazel_rules_go//go:def.bzl", "go_prefix")

go_prefix("istio.io/proxy")
4 changes: 1 addition & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bind(
)

# When updating envoy sha manually please update the sha in istio.deps file also
ENVOY_SHA = "a637506da5f55f0bec37701d9e0a04f1179a6bfb"
ENVOY_SHA = "8607e912a1df840da1080b7b0d4a9ed6bc247c39"

http_archive(
name = "envoy",
Expand All @@ -48,8 +48,6 @@ load("@envoy_api//bazel:repositories.bzl", "api_dependencies")
api_dependencies()

load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
load("@com_lyft_protoc_gen_validate//bazel:go_proto_library.bzl", "go_proto_repositories")
go_proto_repositories(shared=0)
go_rules_dependencies()
go_register_toolchains()

Expand Down
2 changes: 1 addition & 1 deletion istio.deps
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"name": "ENVOY_SHA",
"repoName": "envoyproxy/envoy",
"file": "WORKSPACE",
"lastStableSHA": "a637506da5f55f0bec37701d9e0a04f1179a6bfb"
"lastStableSHA": "8607e912a1df840da1080b7b0d4a9ed6bc247c39"
}
]
2 changes: 1 addition & 1 deletion protobuf.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def protobuf_repositories(load_repo=True, bind=True):
if load_repo:
git_repository(
name = "com_google_protobuf",
commit = "6a4fec616ec4b20f54d5fb530808b855cb664390", # Match SHA used by Envoy
commit = "fa252ec2a54acb24ddc87d48fed1ecfd458445fd", # Match SHA used by Envoy
remote = "https://github.com/google/protobuf.git",
)

Expand Down
4 changes: 2 additions & 2 deletions src/envoy/http/authn/http_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ FilterHeadersStatus AuthenticationFilter::decodeHeaders(HeaderMap& headers,
state_ = State::PROCESSING;

filter_context_.reset(new Istio::AuthN::FilterContext(
decoder_callbacks_->requestInfo().dynamicMetadata(), headers,
decoder_callbacks_->streamInfo().dynamicMetadata(), headers,
decoder_callbacks_->connection(), filter_config_));

Payload payload;
Expand All @@ -76,7 +76,7 @@ FilterHeadersStatus AuthenticationFilter::decodeHeaders(HeaderMap& headers,
ProtobufWkt::Struct data;
Utils::Authentication::SaveAuthAttributesToStruct(
filter_context_->authenticationResult(), data);
decoder_callbacks_->requestInfo().setDynamicMetadata(
decoder_callbacks_->streamInfo().setDynamicMetadata(
Utils::IstioFilterName::kAuthentication, data);
ENVOY_LOG(debug, "Saved Dynamic Metadata:\n{}", data.DebugString());
}
Expand Down
46 changes: 23 additions & 23 deletions src/envoy/http/authn/http_filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "src/envoy/http/authn/http_filter.h"
#include "common/common/base64.h"
#include "common/http/header_map_impl.h"
#include "common/request_info/request_info_impl.h"
#include "common/stream_info/stream_info_impl.h"
#include "envoy/config/filter/http/authn/v2alpha1/config.pb.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
Expand Down Expand Up @@ -122,11 +122,11 @@ TEST_F(AuthenticationFilterTest, PeerFail) {
.Times(1)
.WillOnce(Invoke(createAlwaysFailAuthenticator));
DangerousDeprecatedTestTime test_time;
RequestInfo::RequestInfoImpl request_info(Http::Protocol::Http2,
test_time.timeSystem());
EXPECT_CALL(decoder_callbacks_, requestInfo())
StreamInfo::StreamInfoImpl stream_info(Http::Protocol::Http2,
test_time.timeSystem());
EXPECT_CALL(decoder_callbacks_, streamInfo())
.Times(AtLeast(1))
.WillRepeatedly(ReturnRef(request_info));
.WillRepeatedly(ReturnRef(stream_info));
EXPECT_CALL(decoder_callbacks_, encodeHeaders_(_, _))
.Times(1)
.WillOnce(testing::Invoke([](Http::HeaderMap &headers, bool) {
Expand All @@ -135,7 +135,7 @@ TEST_F(AuthenticationFilterTest, PeerFail) {
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
filter_.decodeHeaders(request_headers_, true));
EXPECT_FALSE(Utils::Authentication::GetResultFromMetadata(
request_info.dynamicMetadata()));
stream_info.dynamicMetadata()));
}

TEST_F(AuthenticationFilterTest, PeerPassOriginFail) {
Expand All @@ -148,11 +148,11 @@ TEST_F(AuthenticationFilterTest, PeerPassOriginFail) {
.Times(1)
.WillOnce(Invoke(createAlwaysFailAuthenticator));
DangerousDeprecatedTestTime test_time;
RequestInfo::RequestInfoImpl request_info(Http::Protocol::Http2,
test_time.timeSystem());
EXPECT_CALL(decoder_callbacks_, requestInfo())
StreamInfo::StreamInfoImpl stream_info(Http::Protocol::Http2,
test_time.timeSystem());
EXPECT_CALL(decoder_callbacks_, streamInfo())
.Times(AtLeast(1))
.WillRepeatedly(ReturnRef(request_info));
.WillRepeatedly(ReturnRef(stream_info));
EXPECT_CALL(decoder_callbacks_, encodeHeaders_(_, _))
.Times(1)
.WillOnce(testing::Invoke([](Http::HeaderMap &headers, bool) {
Expand All @@ -161,7 +161,7 @@ TEST_F(AuthenticationFilterTest, PeerPassOriginFail) {
EXPECT_EQ(Http::FilterHeadersStatus::StopIteration,
filter_.decodeHeaders(request_headers_, true));
EXPECT_FALSE(Utils::Authentication::GetResultFromMetadata(
request_info.dynamicMetadata()));
stream_info.dynamicMetadata()));
}

TEST_F(AuthenticationFilterTest, AllPass) {
Expand All @@ -172,18 +172,18 @@ TEST_F(AuthenticationFilterTest, AllPass) {
.Times(1)
.WillOnce(Invoke(createAlwaysPassAuthenticator));
DangerousDeprecatedTestTime test_time;
RequestInfo::RequestInfoImpl request_info(Http::Protocol::Http2,
test_time.timeSystem());
EXPECT_CALL(decoder_callbacks_, requestInfo())
StreamInfo::StreamInfoImpl stream_info(Http::Protocol::Http2,
test_time.timeSystem());
EXPECT_CALL(decoder_callbacks_, streamInfo())
.Times(AtLeast(1))
.WillRepeatedly(ReturnRef(request_info));
.WillRepeatedly(ReturnRef(stream_info));

EXPECT_EQ(Http::FilterHeadersStatus::Continue,
filter_.decodeHeaders(request_headers_, true));

EXPECT_EQ(1, request_info.dynamicMetadata().filter_metadata_size());
EXPECT_EQ(1, stream_info.dynamicMetadata().filter_metadata_size());
const auto *data = Utils::Authentication::GetResultFromMetadata(
request_info.dynamicMetadata());
stream_info.dynamicMetadata());
ASSERT_TRUE(data);

ProtobufWkt::Struct expected_data;
Expand Down Expand Up @@ -243,18 +243,18 @@ TEST_F(AuthenticationFilterTest, IgnoreBothPass) {
.Times(1)
.WillOnce(Invoke(createAlwaysPassAuthenticator));
DangerousDeprecatedTestTime test_time;
RequestInfo::RequestInfoImpl request_info(Http::Protocol::Http2,
test_time.timeSystem());
EXPECT_CALL(decoder_callbacks_, requestInfo())
StreamInfo::StreamInfoImpl stream_info(Http::Protocol::Http2,
test_time.timeSystem());
EXPECT_CALL(decoder_callbacks_, streamInfo())
.Times(AtLeast(1))
.WillRepeatedly(ReturnRef(request_info));
.WillRepeatedly(ReturnRef(stream_info));

EXPECT_EQ(Http::FilterHeadersStatus::Continue,
filter.decodeHeaders(request_headers_, true));

EXPECT_EQ(1, request_info.dynamicMetadata().filter_metadata_size());
EXPECT_EQ(1, stream_info.dynamicMetadata().filter_metadata_size());
const auto *data = Utils::Authentication::GetResultFromMetadata(
request_info.dynamicMetadata());
stream_info.dynamicMetadata());
ASSERT_TRUE(data);

ProtobufWkt::Struct expected_data;
Expand Down
2 changes: 1 addition & 1 deletion src/envoy/http/jwt_auth/http_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void JwtVerificationFilter::onDone(const JwtAuth::Status& status) {

void JwtVerificationFilter::savePayload(const std::string& key,
const std::string& payload) {
decoder_callbacks_->requestInfo().setDynamicMetadata(
decoder_callbacks_->streamInfo().setDynamicMetadata(
Utils::IstioFilterName::kJwt, MessageUtil::keyValueStruct(key, payload));
}

Expand Down
14 changes: 7 additions & 7 deletions src/envoy/http/mixer/filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ FilterHeadersStatus Filter::decodeHeaders(HeaderMap& headers, bool) {
state_ = Calling;
initiating_call_ = true;
CheckData check_data(headers,
decoder_callbacks_->requestInfo().dynamicMetadata(),
decoder_callbacks_->streamInfo().dynamicMetadata(),
decoder_callbacks_->connection());
Utils::HeaderUpdate header_update(&headers);
headers_ = &headers;
Expand Down Expand Up @@ -160,8 +160,8 @@ void Filter::completeCheck(const CheckResponseInfo& info) {
int status_code = ::istio::utils::StatusHttpCode(status.error_code());
decoder_callbacks_->sendLocalReply(Code(status_code), status.ToString(),
nullptr);
decoder_callbacks_->requestInfo().setResponseFlag(
RequestInfo::ResponseFlag::UnauthorizedExternalService);
decoder_callbacks_->streamInfo().setResponseFlag(
StreamInfo::ResponseFlag::UnauthorizedExternalService);
return;
}

Expand Down Expand Up @@ -210,7 +210,7 @@ void Filter::onDestroy() {
void Filter::log(const HeaderMap* request_headers,
const HeaderMap* response_headers,
const HeaderMap* response_trailers,
const RequestInfo::RequestInfo& request_info) {
const StreamInfo::StreamInfo& stream_info) {
ENVOY_LOG(debug, "Called Mixer::Filter : {}", __func__);
if (!handler_) {
if (request_headers == nullptr) {
Expand All @@ -219,15 +219,15 @@ void Filter::log(const HeaderMap* request_headers,

// Here Request is rejected by other filters, Mixer filter is not called.
::istio::control::http::Controller::PerRouteConfig config;
ReadPerRouteConfig(request_info.routeEntry(), &config);
ReadPerRouteConfig(stream_info.routeEntry(), &config);
handler_ = control_.controller()->CreateRequestHandler(config);
}

// If check is NOT called, check attributes are not extracted.
CheckData check_data(*request_headers, request_info.dynamicMetadata(),
CheckData check_data(*request_headers, stream_info.dynamicMetadata(),
decoder_callbacks_->connection());
// response trailer header is not counted to response total size.
ReportData report_data(response_headers, response_trailers, request_info,
ReportData report_data(response_headers, response_trailers, stream_info,
request_total_size_);
handler_->Report(&check_data, &report_data);
}
Expand Down
2 changes: 1 addition & 1 deletion src/envoy/http/mixer/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Filter : public StreamFilter,
virtual void log(const HeaderMap* request_headers,
const HeaderMap* response_headers,
const HeaderMap* response_trailers,
const RequestInfo::RequestInfo& request_info) override;
const StreamInfo::StreamInfo& stream_info) override;

private:
// Read per-route config.
Expand Down
10 changes: 5 additions & 5 deletions src/envoy/http/mixer/report_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#pragma once

#include "common/common/logger.h"
#include "common/request_info/utility.h"
#include "common/stream_info/utility.h"
#include "envoy/http/header_map.h"
#include "envoy/request_info/request_info.h"
#include "envoy/stream_info/stream_info.h"
#include "extensions/filters/http/well_known_names.h"
#include "include/istio/control/http/controller.h"
#include "src/envoy/utils/utils.h"
Expand Down Expand Up @@ -53,13 +53,13 @@ class ReportData : public ::istio::control::http::ReportData,
public Logger::Loggable<Logger::Id::filter> {
const HeaderMap *headers_;
const HeaderMap *trailers_;
const RequestInfo::RequestInfo &info_;
const StreamInfo::StreamInfo &info_;
uint64_t response_total_size_;
uint64_t request_total_size_;

public:
ReportData(const HeaderMap *headers, const HeaderMap *response_trailers,
const RequestInfo::RequestInfo &info, uint64_t request_total_size)
const StreamInfo::StreamInfo &info, uint64_t request_total_size)
: headers_(headers),
trailers_(response_trailers),
info_(info),
Expand Down Expand Up @@ -96,7 +96,7 @@ class ReportData : public ::istio::control::http::ReportData,
// is rejected by Envoy. Set the response code for such requests as 500.
data->response_code = info_.responseCode().value_or(500);

data->response_flags = RequestInfo::ResponseFlagUtils::toShortString(info_);
data->response_flags = StreamInfo::ResponseFlagUtils::toShortString(info_);
}

bool GetDestinationIpPort(std::string *str_ip, int *port) const override {
Expand Down