-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Merge release-1.1 to master #2220
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
Changes from all commits
a5d5a46
9d52640
55c8096
5a9945b
bf8b9cd
a169a0c
73fa9b1
56242cd
2e27a0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # Copyright 2017 Istio Authors. All Rights Reserved. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| ################################################################################ | ||
| # | ||
| load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
|
||
| # Match SHA used by Envoy | ||
| PROTOBUF_SHA = "582743bf40c5d3639a70f98f183914a2c0cd0680" | ||
| PROTOBUF_SHA256 = "cf9e2fb1d2cd30ec9d51ff1749045208bd641f290f64b85046485934b0e03783" | ||
|
|
||
| def protobuf_repositories(load_repo = True, bind = True): | ||
| if load_repo: | ||
| http_archive( | ||
| name = "com_google_protobuf", | ||
| strip_prefix = "protobuf-" + PROTOBUF_SHA, | ||
| url = "https://github.com/google/protobuf/archive/" + PROTOBUF_SHA + ".tar.gz", | ||
| sha256 = PROTOBUF_SHA256, | ||
| ) | ||
|
|
||
| if bind: | ||
| native.bind( | ||
| name = "protoc", | ||
| actual = "@com_google_protobuf//:protoc", | ||
| ) | ||
|
|
||
| native.bind( | ||
| name = "protocol_compiler", | ||
| actual = "@com_google_protobuf//:protoc", | ||
| ) | ||
|
|
||
| native.bind( | ||
| name = "protobuf", | ||
| actual = "@com_google_protobuf//:protobuf", | ||
| ) | ||
|
|
||
| native.bind( | ||
| name = "cc_wkt_protos", | ||
| actual = "@com_google_protobuf//:cc_wkt_protos", | ||
| ) | ||
|
|
||
| native.bind( | ||
| name = "cc_wkt_protos_genproto", | ||
| actual = "@com_google_protobuf//:cc_wkt_protos_genproto", | ||
| ) | ||
|
|
||
| native.bind( | ||
| name = "protobuf_compiler", | ||
| actual = "@com_google_protobuf//:protoc_lib", | ||
| ) | ||
|
|
||
| native.bind( | ||
| name = "protobuf_clib", | ||
| actual = "@com_google_protobuf//:protoc_lib", | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,7 @@ | |
| */ | ||
|
|
||
| #include "src/envoy/utils/utils.h" | ||
|
|
||
| #include "include/istio/utils/attributes_builder.h" | ||
| #include "mixer/v1/attributes.pb.h" | ||
|
|
||
|
|
@@ -36,21 +37,21 @@ const std::string kMetadataDestinationUID("uid"); | |
|
|
||
| } // namespace | ||
|
|
||
| void ExtractHeaders(const Http::HeaderMap& header_map, | ||
| const std::set<std::string>& exclusives, | ||
| std::map<std::string, std::string>& headers) { | ||
| void ExtractHeaders(const Http::HeaderMap &header_map, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you check when the "&" "*" format is introduced? I don't see this pattern else where
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I doubt this is caused by the different version of
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it is introduced at your merge, you'd better fixed with this PR. |
||
| const std::set<std::string> &exclusives, | ||
| std::map<std::string, std::string> &headers) { | ||
| struct Context { | ||
| Context(const std::set<std::string>& exclusives, | ||
| std::map<std::string, std::string>& headers) | ||
| Context(const std::set<std::string> &exclusives, | ||
| std::map<std::string, std::string> &headers) | ||
| : exclusives(exclusives), headers(headers) {} | ||
| const std::set<std::string>& exclusives; | ||
| std::map<std::string, std::string>& headers; | ||
| const std::set<std::string> &exclusives; | ||
| std::map<std::string, std::string> &headers; | ||
| }; | ||
| Context ctx(exclusives, headers); | ||
| header_map.iterate( | ||
| [](const Http::HeaderEntry& header, | ||
| void* context) -> Http::HeaderMap::Iterate { | ||
| Context* ctx = static_cast<Context*>(context); | ||
| [](const Http::HeaderEntry &header, | ||
| void *context) -> Http::HeaderMap::Iterate { | ||
| Context *ctx = static_cast<Context *>(context); | ||
| auto key = std::string(header.key().getStringView()); | ||
| auto value = std::string(header.value().getStringView()); | ||
| if (ctx->exclusives.count(key) == 0) { | ||
|
|
@@ -61,21 +62,21 @@ void ExtractHeaders(const Http::HeaderMap& header_map, | |
| &ctx); | ||
| } | ||
|
|
||
| void FindHeaders(const Http::HeaderMap& header_map, | ||
| const std::set<std::string>& inclusives, | ||
| std::map<std::string, std::string>& headers) { | ||
| void FindHeaders(const Http::HeaderMap &header_map, | ||
| const std::set<std::string> &inclusives, | ||
| std::map<std::string, std::string> &headers) { | ||
| struct Context { | ||
| Context(const std::set<std::string>& inclusives, | ||
| std::map<std::string, std::string>& headers) | ||
| Context(const std::set<std::string> &inclusives, | ||
| std::map<std::string, std::string> &headers) | ||
| : inclusives(inclusives), headers(headers) {} | ||
| const std::set<std::string>& inclusives; | ||
| std::map<std::string, std::string>& headers; | ||
| const std::set<std::string> &inclusives; | ||
| std::map<std::string, std::string> &headers; | ||
| }; | ||
| Context ctx(inclusives, headers); | ||
| header_map.iterate( | ||
| [](const Http::HeaderEntry& header, | ||
| void* context) -> Http::HeaderMap::Iterate { | ||
| Context* ctx = static_cast<Context*>(context); | ||
| [](const Http::HeaderEntry &header, | ||
| void *context) -> Http::HeaderMap::Iterate { | ||
| Context *ctx = static_cast<Context *>(context); | ||
| auto key = std::string(header.key().getStringView()); | ||
| auto value = std::string(header.value().getStringView()); | ||
| if (ctx->inclusives.count(key) != 0) { | ||
|
|
@@ -86,30 +87,31 @@ void FindHeaders(const Http::HeaderMap& header_map, | |
| &ctx); | ||
| } | ||
|
|
||
| bool GetIpPort(const Network::Address::Ip* ip, std::string* str_ip, int* port) { | ||
| bool GetIpPort(const Network::Address::Ip *ip, std::string *str_ip, int *port) { | ||
| if (ip) { | ||
| *port = ip->port(); | ||
| if (ip->ipv4()) { | ||
| uint32_t ipv4 = ip->ipv4()->address(); | ||
| *str_ip = std::string(reinterpret_cast<const char*>(&ipv4), sizeof(ipv4)); | ||
| *str_ip = | ||
| std::string(reinterpret_cast<const char *>(&ipv4), sizeof(ipv4)); | ||
| return true; | ||
| } | ||
| if (ip->ipv6()) { | ||
| absl::uint128 ipv6 = ip->ipv6()->address(); | ||
| *str_ip = std::string(reinterpret_cast<const char*>(&ipv6), 16); | ||
| *str_ip = std::string(reinterpret_cast<const char *>(&ipv6), 16); | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| bool GetDestinationUID(const envoy::api::v2::core::Metadata& metadata, | ||
| std::string* uid) { | ||
| bool GetDestinationUID(const envoy::api::v2::core::Metadata &metadata, | ||
| std::string *uid) { | ||
| const auto filter_it = metadata.filter_metadata().find(kPerHostMetadataKey); | ||
| if (filter_it == metadata.filter_metadata().end()) { | ||
| return false; | ||
| } | ||
| const Struct& struct_pb = filter_it->second; | ||
| const Struct &struct_pb = filter_it->second; | ||
| const auto fields_it = struct_pb.fields().find(kMetadataDestinationUID); | ||
| if (fields_it == struct_pb.fields().end()) { | ||
| return false; | ||
|
|
@@ -118,11 +120,11 @@ bool GetDestinationUID(const envoy::api::v2::core::Metadata& metadata, | |
| return true; | ||
| } | ||
|
|
||
| bool GetPrincipal(const Network::Connection* connection, bool peer, | ||
| std::string* principal) { | ||
| bool GetPrincipal(const Network::Connection *connection, bool peer, | ||
| std::string *principal) { | ||
| if (connection) { | ||
| Ssl::ConnectionInfo* ssl = | ||
| const_cast<Ssl::ConnectionInfo*>(connection->ssl()); | ||
| Ssl::ConnectionInfo *ssl = | ||
| const_cast<Ssl::ConnectionInfo *>(connection->ssl()); | ||
| if (ssl != nullptr) { | ||
| const std::vector<std::string> sans = | ||
| (peer ? ssl->uriSanPeerCertificate() : ssl->uriSanLocalCertificate()); | ||
|
|
@@ -144,13 +146,13 @@ bool GetPrincipal(const Network::Connection* connection, bool peer, | |
| return false; | ||
| } | ||
|
|
||
| bool IsMutualTLS(const Network::Connection* connection) { | ||
| bool IsMutualTLS(const Network::Connection *connection) { | ||
| return connection != nullptr && connection->ssl() != nullptr && | ||
| connection->ssl()->peerCertificatePresented(); | ||
| } | ||
|
|
||
| bool GetRequestedServerName(const Network::Connection* connection, | ||
| std::string* name) { | ||
| bool GetRequestedServerName(const Network::Connection *connection, | ||
| std::string *name) { | ||
| if (connection && !connection->requestedServerName().empty()) { | ||
| *name = std::string(connection->requestedServerName()); | ||
| return true; | ||
|
|
@@ -159,20 +161,20 @@ bool GetRequestedServerName(const Network::Connection* connection, | |
| return false; | ||
| } | ||
|
|
||
| Status ParseJsonMessage(const std::string& json, Message* output) { | ||
| Status ParseJsonMessage(const std::string &json, Message *output) { | ||
| ::google::protobuf::util::JsonParseOptions options; | ||
| options.ignore_unknown_fields = true; | ||
| return ::google::protobuf::util::JsonStringToMessage(json, output, options); | ||
| } | ||
|
|
||
| void CheckResponseInfoToStreamInfo( | ||
| const istio::mixerclient::CheckResponseInfo& check_response, | ||
| StreamInfo::StreamInfo& stream_info) { | ||
| const istio::mixerclient::CheckResponseInfo &check_response, | ||
| StreamInfo::StreamInfo &stream_info) { | ||
| if (!check_response.status().ok()) { | ||
| stream_info.setResponseFlag( | ||
| StreamInfo::ResponseFlag::UnauthorizedExternalService); | ||
| ProtobufWkt::Struct metadata; | ||
| auto& fields = *metadata.mutable_fields(); | ||
| auto &fields = *metadata.mutable_fields(); | ||
| fields["status"].set_string_value(check_response.status().ToString()); | ||
| stream_info.setDynamicMetadata(istio::utils::kMixerMetadataKey, metadata); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt some of the conflicts are not resolved correctly. John's PR shoudl beat this one: 0b76a30
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the redundant message. John's PR is down. If you check line 41, you will find John's PR. But I don't know why I didn't find this line when I resolving conflicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. git is not that reliable :) That's why we have this review
Please fix it in the follow up