Skip to content

Commit

Permalink
Update to merged cncf/udpa#29.
Browse files Browse the repository at this point in the history
Signed-off-by: Harvey Tuch <[email protected]>
  • Loading branch information
htuch committed Jun 24, 2020
1 parent 7ea449b commit 9408fb0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
11 changes: 3 additions & 8 deletions api/bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@ GOOGLEAPIS_SHA = "a45019af4d3290f02eaeb1ce10990166978c807cb33a9692141a076ba46d14
PROMETHEUS_GIT_SHA = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c" # Nov 17, 2017
PROMETHEUS_SHA = "783bdaf8ee0464b35ec0c8704871e1e72afa0005c3f3587f65d9d6694bf3911b"

UDPA_GIT_SHA = "07b17b004e9aadb53ff9bb904fca432c1e6c2f9d" # June 21, 2020

# TODO(htuch): DO NOT COMMIT until https://github.com/cncf/udpa/pull/29 merges and this
# change is removed.
UDPA_SHA256 = "0be50f8c9353c96c570339bcfc36ab26b100e8caa1d0eb5385869a8aa89071c7"
UDPA_GIT_SHA = "ca580c4fcf87b178547c2e9e41a2481b0008efe9" # June 24, 2020
UDPA_SHA256 = "a1dc305cd56f1dd393fec8ec6b19f4f7d76af9740c7746e9377c8dd480f77e70"

ZIPKINAPI_RELEASE = "0.2.2" # Aug 23, 2019
ZIPKINAPI_SHA256 = "688c4fe170821dd589f36ec45aaadc03a618a40283bc1f97da8fa11686fc816b"
Expand All @@ -44,9 +41,7 @@ REPOSITORY_LOCATIONS = dict(
com_github_cncf_udpa = dict(
sha256 = UDPA_SHA256,
strip_prefix = "udpa-" + UDPA_GIT_SHA,
# TODO(htuch): DO NOT COMMIT until https://github.com/cncf/udpa/pull/29 merges and this
# change is removed.
urls = ["https://github.com/htuch/udpa/archive/" + UDPA_GIT_SHA + ".tar.gz"],
urls = ["https://github.com/cncf/udpa/archive/" + UDPA_GIT_SHA + ".tar.gz"],
),
prometheus_metrics_model = dict(
sha256 = PROMETHEUS_SHA,
Expand Down
11 changes: 3 additions & 8 deletions generated_api_shadow/bazel/repository_locations.bzl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions source/common/config/udpa_resource.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ std::string UdpaResourceName::encodeUri(const udpa::core::v1::ResourceName& reso
}
const std::string query_params =
query_param_components.empty() ? "" : "?" + absl::StrJoin(query_param_components, "&");
return absl::StrCat("udpa://", authority, "/", resource_name.qualified_type(),
return absl::StrCat("udpa://", authority, "/", resource_name.resource_type(),
path.empty() ? "" : "/", path, query_params);
}

Expand All @@ -64,8 +64,8 @@ udpa::core::v1::ResourceName UdpaResourceName::decodeUri(absl::string_view resou
// This is guaranteed by Http::Utility::extractHostPathFromUri.
ASSERT(absl::StartsWith(path, "/"));
const std::vector<absl::string_view> path_components = absl::StrSplit(path.substr(1), '/');
decoded_resource_name.set_qualified_type(std::string(path_components[0]));
if (decoded_resource_name.qualified_type().empty()) {
decoded_resource_name.set_resource_type(std::string(path_components[0]));
if (decoded_resource_name.resource_type().empty()) {
throw UdpaResourceName::DecodeException(
fmt::format("Qualified type missing from {}", resource_uri));
}
Expand Down
4 changes: 2 additions & 2 deletions test/common/config/udpa_resource_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ TEST(UdpaResourceNameTest, DecodeEncode) {
TEST(UdpaResourceNameTest, DecodeSuccess) {
const auto resource_name = UdpaResourceName::decodeUri(EscapedUriWithManyQueryParams);
EXPECT_EQ("f123%/#?&=o", resource_name.authority());
EXPECT_EQ("envoy.config.listener.v3.Listener", resource_name.qualified_type());
EXPECT_EQ("envoy.config.listener.v3.Listener", resource_name.resource_type());
EXPECT_EQ(3, resource_name.id().size());
EXPECT_EQ("b%/#?&=ar", resource_name.id()[0]);
EXPECT_EQ("", resource_name.id()[1]);
Expand All @@ -60,7 +60,7 @@ TEST(UdpaResourceNameTest, DecodeEmpty) {
const auto resource_name =
UdpaResourceName::decodeUri("udpa:///envoy.config.listener.v3.Listener");
EXPECT_TRUE(resource_name.authority().empty());
EXPECT_EQ("envoy.config.listener.v3.Listener", resource_name.qualified_type());
EXPECT_EQ("envoy.config.listener.v3.Listener", resource_name.resource_type());
EXPECT_TRUE(resource_name.id().empty());
EXPECT_TRUE(resource_name.context().params().empty());
}
Expand Down

0 comments on commit 9408fb0

Please sign in to comment.