From 3bd2667b8e41d2685a4fecf78374ccdfa3867c76 Mon Sep 17 00:00:00 2001 From: "data-plane-api(Azure Pipelines)" Date: Mon, 14 Dec 2020 21:18:49 +0000 Subject: [PATCH] http: add support for skip filter match action (#14275) Adds support for associating a match tree with a HTTP filter, supporting a single "Skip" operation that will have the FM ignore the filter for the duration of the stream once matched. Signed-off-by: Snow Pettersen Mirrored from https://github.com/envoyproxy/envoy @ 935a6598cd01324f03608ca77ebffc9608f7af81 --- BUILD | 2 ++ envoy/config/common/matcher/v3/matcher.proto | 1 - .../common/matcher/v4alpha/matcher.proto | 1 - envoy/extensions/common/matching/v3/BUILD | 13 ++++++++ .../matching/v3/extension_matcher.proto | 29 +++++++++++++++++ .../extensions/common/matching/v4alpha/BUILD | 14 ++++++++ .../matching/v4alpha/extension_matcher.proto | 32 +++++++++++++++++++ .../filters/common/matcher/action/v3/BUILD | 9 ++++++ .../matcher/action/v3/skip_action.proto | 19 +++++++++++ versioning/BUILD | 2 ++ 10 files changed, 120 insertions(+), 2 deletions(-) create mode 100644 envoy/extensions/common/matching/v3/BUILD create mode 100644 envoy/extensions/common/matching/v3/extension_matcher.proto create mode 100644 envoy/extensions/common/matching/v4alpha/BUILD create mode 100644 envoy/extensions/common/matching/v4alpha/extension_matcher.proto create mode 100644 envoy/extensions/filters/common/matcher/action/v3/BUILD create mode 100644 envoy/extensions/filters/common/matcher/action/v3/skip_action.proto diff --git a/BUILD b/BUILD index 82a15929..f7c75a2d 100644 --- a/BUILD +++ b/BUILD @@ -160,11 +160,13 @@ proto_library( "//envoy/extensions/clusters/dynamic_forward_proxy/v3:pkg", "//envoy/extensions/clusters/redis/v3:pkg", "//envoy/extensions/common/dynamic_forward_proxy/v3:pkg", + "//envoy/extensions/common/matching/v3:pkg", "//envoy/extensions/common/ratelimit/v3:pkg", "//envoy/extensions/common/tap/v3:pkg", "//envoy/extensions/compression/gzip/compressor/v3:pkg", "//envoy/extensions/compression/gzip/decompressor/v3:pkg", "//envoy/extensions/filters/common/fault/v3:pkg", + "//envoy/extensions/filters/common/matcher/action/v3:pkg", "//envoy/extensions/filters/http/adaptive_concurrency/v3:pkg", "//envoy/extensions/filters/http/admission_control/v3alpha:pkg", "//envoy/extensions/filters/http/aws_lambda/v3:pkg", diff --git a/envoy/config/common/matcher/v3/matcher.proto b/envoy/config/common/matcher/v3/matcher.proto index 24ed5daf..2760be1b 100644 --- a/envoy/config/common/matcher/v3/matcher.proto +++ b/envoy/config/common/matcher/v3/matcher.proto @@ -25,7 +25,6 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE; // might repeat several times until the final OnMatch (or no match) is decided. // // This API is a work in progress. -// [#not-implemented-hide:] message Matcher { // What to do if a match is successful. message OnMatch { diff --git a/envoy/config/common/matcher/v4alpha/matcher.proto b/envoy/config/common/matcher/v4alpha/matcher.proto index ab1f4de6..7c846e1e 100644 --- a/envoy/config/common/matcher/v4alpha/matcher.proto +++ b/envoy/config/common/matcher/v4alpha/matcher.proto @@ -24,7 +24,6 @@ option (udpa.annotations.file_status).package_version_status = NEXT_MAJOR_VERSIO // might repeat several times until the final OnMatch (or no match) is decided. // // This API is a work in progress. -// [#not-implemented-hide:] message Matcher { option (udpa.annotations.versioning).previous_message_type = "envoy.config.common.matcher.v3.Matcher"; diff --git a/envoy/extensions/common/matching/v3/BUILD b/envoy/extensions/common/matching/v3/BUILD new file mode 100644 index 00000000..5fa93360 --- /dev/null +++ b/envoy/extensions/common/matching/v3/BUILD @@ -0,0 +1,13 @@ +# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. + +load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") + +licenses(["notice"]) # Apache 2 + +api_proto_package( + deps = [ + "//envoy/config/common/matcher/v3:pkg", + "//envoy/config/core/v3:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/envoy/extensions/common/matching/v3/extension_matcher.proto b/envoy/extensions/common/matching/v3/extension_matcher.proto new file mode 100644 index 00000000..47a065be --- /dev/null +++ b/envoy/extensions/common/matching/v3/extension_matcher.proto @@ -0,0 +1,29 @@ +syntax = "proto3"; + +package envoy.extensions.common.matching.v3; + +import "envoy/config/common/matcher/v3/matcher.proto"; +import "envoy/config/core/v3/extension.proto"; + +import "udpa/annotations/migrate.proto"; +import "udpa/annotations/status.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.common.matching.v3"; +option java_outer_classname = "ExtensionMatcherProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Extension Matcher] + +// Wrapper around an existing extension that provides an associated matcher. This allows +// decorating an existing extension with a matcher, which can be used to match against +// relevant protocol data. +message ExtensionWithMatcher { + // The associated matcher. + config.common.matcher.v3.Matcher matcher = 1 [(validate.rules).message = {required: true}]; + + // The underlying extension config. + config.core.v3.TypedExtensionConfig extension_config = 2 + [(validate.rules).message = {required: true}]; +} diff --git a/envoy/extensions/common/matching/v4alpha/BUILD b/envoy/extensions/common/matching/v4alpha/BUILD new file mode 100644 index 00000000..95ccc22a --- /dev/null +++ b/envoy/extensions/common/matching/v4alpha/BUILD @@ -0,0 +1,14 @@ +# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. + +load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") + +licenses(["notice"]) # Apache 2 + +api_proto_package( + deps = [ + "//envoy/config/common/matcher/v4alpha:pkg", + "//envoy/config/core/v4alpha:pkg", + "//envoy/extensions/common/matching/v3:pkg", + "@com_github_cncf_udpa//udpa/annotations:pkg", + ], +) diff --git a/envoy/extensions/common/matching/v4alpha/extension_matcher.proto b/envoy/extensions/common/matching/v4alpha/extension_matcher.proto new file mode 100644 index 00000000..bb71cc5a --- /dev/null +++ b/envoy/extensions/common/matching/v4alpha/extension_matcher.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package envoy.extensions.common.matching.v4alpha; + +import "envoy/config/common/matcher/v4alpha/matcher.proto"; +import "envoy/config/core/v4alpha/extension.proto"; + +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.common.matching.v4alpha"; +option java_outer_classname = "ExtensionMatcherProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = NEXT_MAJOR_VERSION_CANDIDATE; + +// [#protodoc-title: Extension Matcher] + +// Wrapper around an existing extension that provides an associated matcher. This allows +// decorating an existing extension with a matcher, which can be used to match against +// relevant protocol data. +message ExtensionWithMatcher { + option (udpa.annotations.versioning).previous_message_type = + "envoy.extensions.common.matching.v3.ExtensionWithMatcher"; + + // The associated matcher. + config.common.matcher.v4alpha.Matcher matcher = 1 [(validate.rules).message = {required: true}]; + + // The underlying extension config. + config.core.v4alpha.TypedExtensionConfig extension_config = 2 + [(validate.rules).message = {required: true}]; +} diff --git a/envoy/extensions/filters/common/matcher/action/v3/BUILD b/envoy/extensions/filters/common/matcher/action/v3/BUILD new file mode 100644 index 00000000..ee92fb65 --- /dev/null +++ b/envoy/extensions/filters/common/matcher/action/v3/BUILD @@ -0,0 +1,9 @@ +# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py. + +load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package") + +licenses(["notice"]) # Apache 2 + +api_proto_package( + deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"], +) diff --git a/envoy/extensions/filters/common/matcher/action/v3/skip_action.proto b/envoy/extensions/filters/common/matcher/action/v3/skip_action.proto new file mode 100644 index 00000000..79879699 --- /dev/null +++ b/envoy/extensions/filters/common/matcher/action/v3/skip_action.proto @@ -0,0 +1,19 @@ +syntax = "proto3"; + +package envoy.extensions.filters.common.matcher.action.v3; + +import "udpa/annotations/migrate.proto"; +import "udpa/annotations/status.proto"; +import "udpa/annotations/versioning.proto"; +import "validate/validate.proto"; + +option java_package = "io.envoyproxy.envoy.extensions.filters.common.matcher.action.v3"; +option java_outer_classname = "SkipActionProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Common Match Actions] + +// Indicates that the associated filter should be skipped. +message SkipFilter { +} diff --git a/versioning/BUILD b/versioning/BUILD index 9b9ea97e..41addf76 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -43,11 +43,13 @@ proto_library( "//envoy/extensions/clusters/dynamic_forward_proxy/v3:pkg", "//envoy/extensions/clusters/redis/v3:pkg", "//envoy/extensions/common/dynamic_forward_proxy/v3:pkg", + "//envoy/extensions/common/matching/v3:pkg", "//envoy/extensions/common/ratelimit/v3:pkg", "//envoy/extensions/common/tap/v3:pkg", "//envoy/extensions/compression/gzip/compressor/v3:pkg", "//envoy/extensions/compression/gzip/decompressor/v3:pkg", "//envoy/extensions/filters/common/fault/v3:pkg", + "//envoy/extensions/filters/common/matcher/action/v3:pkg", "//envoy/extensions/filters/http/adaptive_concurrency/v3:pkg", "//envoy/extensions/filters/http/admission_control/v3alpha:pkg", "//envoy/extensions/filters/http/aws_lambda/v3:pkg",