Skip to content
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
1 change: 1 addition & 0 deletions api/API_VERSIONING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ An exception to the above policy exists for:
* API versions tagged `vNalpha`. Within an alpha major version, arbitrary breaking changes are allowed.
* Any field, message or enum with a `[#not-implemented-hide:..` comment.
* Any proto with a `(udpa.annotations.file_status).work_in_progress` option annotation.
* Any proto marked as [#alpha:].

Note that changes to default values for wrapped types, e.g. `google.protobuf.UInt32Value` are not
governed by the above policy. Any management server requiring stability across Envoy API or
Expand Down
6 changes: 3 additions & 3 deletions api/bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_desc = "xDS API Working Group (xDS-WG)",
project_url = "https://github.com/cncf/xds",
# During the UDPA -> xDS migration, we aren't working with releases.
version = "b88cc788a63e5b38ee334a2e702c67901355ae2c",
sha256 = "3220df8564f217665b6e17776569c5f748178c2b9cbf83bb55a13ddc0a3738f0",
release_date = "2021-03-23",
version = "dd25fe81a44506ab21ea666fb70b3b1c4bb183ee",
sha256 = "9184235cd31272679e4c7f9232c341d4ea75351ded74d3fbba28b05c290bfa71",
release_date = "2021-07-22",
strip_prefix = "xds-{version}",
urls = ["https://github.com/cncf/xds/archive/{version}.tar.gz"],
use_category = ["api"],
Expand Down
2 changes: 2 additions & 0 deletions api/envoy/extensions/common/matching/v3/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ licenses(["notice"]) # Apache 2

api_proto_package(
deps = [
"//envoy/annotations:pkg",
"//envoy/config/common/matcher/v3:pkg",
"//envoy/config/core/v3:pkg",
"@com_github_cncf_udpa//udpa/annotations:pkg",
"@com_github_cncf_udpa//xds/type/matcher/v3:pkg",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ package envoy.extensions.common.matching.v3;
import "envoy/config/common/matcher/v3/matcher.proto";
import "envoy/config/core/v3/extension.proto";

import "xds/type/matcher/v3/matcher.proto";

import "envoy/annotations/deprecation.proto";
import "udpa/annotations/status.proto";
import "validate/validate.proto";

Expand All @@ -21,8 +24,12 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
//
// [#alpha:]
message ExtensionWithMatcher {
// The associated matcher. This is deprecated in favor of xds_matcher.
config.common.matcher.v3.Matcher matcher = 1
[deprecated = true, (envoy.annotations.deprecated_at_minor_version) = "3.0"];

// The associated matcher.
config.common.matcher.v3.Matcher matcher = 1 [(validate.rules).message = {required: true}];
xds.type.matcher.v3.Matcher xds_matcher = 3;

// The underlying extension config.
config.core.v3.TypedExtensionConfig extension_config = 2
Expand Down
2 changes: 1 addition & 1 deletion api/envoy/extensions/common/matching/v4alpha/BUILD

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static_resources:
name: composite
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.composite.v3.Composite
matcher:
xds_matcher:
matcher_tree:
input:
name: request-headers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static_resources:
percentage:
numerator: 0
denominator: HUNDRED
matcher:
xds_matcher:
# The top level matcher is a matcher tree which conceptually selects one of several subtrees.
matcher_tree:
input:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static_resources:
percentage:
numerator: 0
denominator: HUNDRED
matcher:
xds_matcher:
matcher_list:
matchers:
- predicate:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static_resources:
percentage:
numerator: 0
denominator: HUNDRED
matcher:
xds_matcher:
matcher_tree:
input:
name: request-headers
Expand Down
3 changes: 3 additions & 0 deletions docs/root/version_history/current.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ New Features

Deprecated
----------

* api: the :ref:`matcher <envoy_v3_api_field_extensions.common.matching.v3.ExtensionWithMatcher.matcher>` field has been deprecated in favor of
:ref:`matcher <envoy_v3_api_field_extensions.common.matching.v3.ExtensionWithMatcher.xds_matcher>` in order to break a build dependency.
* cluster: :ref:`max_requests_per_connection <envoy_v3_api_field_config.cluster.v3.Cluster.max_requests_per_connection>` is deprecated in favor of :ref:`max_requests_per_connection <envoy_v3_api_field_config.core.v3.HttpProtocolOptions.max_requests_per_connection>`.
* http: the HeaderMatcher fields :ref:`exact_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.exact_match>`, :ref:`safe_regex_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.safe_regex_match>`,
:ref:`prefix_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.prefix_match>`, :ref:`suffix_match <envoy_v3_api_field_config.route.v3.HeaderMatcher.suffix_match>` and
Expand Down
6 changes: 3 additions & 3 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.

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

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

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

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

1 change: 1 addition & 0 deletions source/common/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ envoy_cc_library(
"//envoy/common:regex_interface",
"//source/common/protobuf:utility_lib",
"//source/common/stats:symbol_table_lib",
"@com_github_cncf_udpa//xds/type/matcher/v3:pkg_cc_proto",
"@com_googlesource_code_re2//:re2",
"@envoy_api//envoy/type/matcher/v3:pkg_cc_proto",
],
Expand Down
62 changes: 2 additions & 60 deletions source/common/common/matchers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ ValueMatcherConstSharedPtr ValueMatcher::create(const envoy::type::matcher::v3::
case envoy::type::matcher::v3::ValueMatcher::MatchPatternCase::kDoubleMatch:
return std::make_shared<const DoubleMatcher>(v.double_match());
case envoy::type::matcher::v3::ValueMatcher::MatchPatternCase::kStringMatch:
return std::make_shared<const StringMatcherImpl>(v.string_match());
return std::make_shared<const StringMatcherImpl<std::decay_t<decltype(v.string_match())>>>(
v.string_match());
case envoy::type::matcher::v3::ValueMatcher::MatchPatternCase::kBoolMatch:
return std::make_shared<const BoolMatcher>(v.bool_match());
case envoy::type::matcher::v3::ValueMatcher::MatchPatternCase::kPresentMatch:
Expand Down Expand Up @@ -63,65 +64,6 @@ bool DoubleMatcher::match(const ProtobufWkt::Value& value) const {
};
}

StringMatcherImpl::StringMatcherImpl(const envoy::type::matcher::v3::StringMatcher& matcher)
: matcher_(matcher) {
if (matcher.match_pattern_case() ==
envoy::type::matcher::v3::StringMatcher::MatchPatternCase::kSafeRegex) {
if (matcher.ignore_case()) {
throw EnvoyException("ignore_case has no effect for safe_regex.");
}
regex_ = Regex::Utility::parseRegex(matcher_.safe_regex());
} else if (matcher.match_pattern_case() ==
envoy::type::matcher::v3::StringMatcher::MatchPatternCase::kContains) {
if (matcher_.ignore_case()) {
// Cache the lowercase conversion of the Contains matcher for future use
lowercase_contains_match_ = absl::AsciiStrToLower(matcher_.contains());
}
}
}

bool StringMatcherImpl::match(const ProtobufWkt::Value& value) const {
if (value.kind_case() != ProtobufWkt::Value::kStringValue) {
return false;
}

return match(value.string_value());
}

bool StringMatcherImpl::match(const absl::string_view value) const {
switch (matcher_.match_pattern_case()) {
case envoy::type::matcher::v3::StringMatcher::MatchPatternCase::kExact:
return matcher_.ignore_case() ? absl::EqualsIgnoreCase(value, matcher_.exact())
: value == matcher_.exact();
case envoy::type::matcher::v3::StringMatcher::MatchPatternCase::kPrefix:
return matcher_.ignore_case() ? absl::StartsWithIgnoreCase(value, matcher_.prefix())
: absl::StartsWith(value, matcher_.prefix());
case envoy::type::matcher::v3::StringMatcher::MatchPatternCase::kSuffix:
return matcher_.ignore_case() ? absl::EndsWithIgnoreCase(value, matcher_.suffix())
: absl::EndsWith(value, matcher_.suffix());
case envoy::type::matcher::v3::StringMatcher::MatchPatternCase::kContains:
return matcher_.ignore_case()
? absl::StrContains(absl::AsciiStrToLower(value), lowercase_contains_match_)
: absl::StrContains(value, matcher_.contains());
case envoy::type::matcher::v3::StringMatcher::MatchPatternCase::kHiddenEnvoyDeprecatedRegex:
FALLTHRU;
case envoy::type::matcher::v3::StringMatcher::MatchPatternCase::kSafeRegex:
return regex_->match(value);
default:
NOT_REACHED_GCOVR_EXCL_LINE;
}
}

bool StringMatcherImpl::getCaseSensitivePrefixMatch(std::string& prefix) const {
if (matcher_.match_pattern_case() ==
envoy::type::matcher::v3::StringMatcher::MatchPatternCase::kPrefix &&
!matcher_.ignore_case()) {
prefix = matcher_.prefix();
return true;
}
return false;
}

ListMatcher::ListMatcher(const envoy::type::matcher::v3::ListMatcher& matcher) : matcher_(matcher) {
ASSERT(matcher_.match_pattern_case() ==
envoy::type::matcher::v3::ListMatcher::MatchPatternCase::kOneOf);
Expand Down
Loading