From dd8276e9da73f3efa3d373ba4f80ecdd3615a828 Mon Sep 17 00:00:00 2001 From: "data-plane-api(Azure Pipelines)" Date: Thu, 1 Apr 2021 16:21:14 +0000 Subject: [PATCH] matching: add support for generic inputs and add environment variable input (#15410) Adds support for a "generic input" extension point that allows specifying inputs that are not dependent on protocol data. Adds an environment variable generic input that allows matching on the value of an environment variable. Signed-off-by: Snow Pettersen Mirrored from https://github.com/envoyproxy/envoy @ 758a9a90c15331fbfd093f23170454c5a2fbf903 --- BUILD | 1 + envoy/config/common/matcher/v3/matcher.proto | 1 + .../common/matcher/v4alpha/matcher.proto | 1 + .../environment_variable/v3/BUILD | 9 ++++++++ .../environment_variable/v3/input.proto | 22 +++++++++++++++++++ versioning/BUILD | 1 + 6 files changed, 35 insertions(+) create mode 100644 envoy/extensions/matching/common_inputs/environment_variable/v3/BUILD create mode 100644 envoy/extensions/matching/common_inputs/environment_variable/v3/input.proto diff --git a/BUILD b/BUILD index 0167c8a6..7077b21a 100644 --- a/BUILD +++ b/BUILD @@ -246,6 +246,7 @@ proto_library( "//envoy/extensions/internal_redirect/allow_listed_routes/v3:pkg", "//envoy/extensions/internal_redirect/previous_routes/v3:pkg", "//envoy/extensions/internal_redirect/safe_cross_scheme/v3:pkg", + "//envoy/extensions/matching/common_inputs/environment_variable/v3:pkg", "//envoy/extensions/matching/input_matchers/consistent_hashing/v3:pkg", "//envoy/extensions/network/socket_interface/v3:pkg", "//envoy/extensions/rate_limit_descriptors/expr/v3:pkg", diff --git a/envoy/config/common/matcher/v3/matcher.proto b/envoy/config/common/matcher/v3/matcher.proto index aa49132c..f9a4aafa 100644 --- a/envoy/config/common/matcher/v3/matcher.proto +++ b/envoy/config/common/matcher/v3/matcher.proto @@ -50,6 +50,7 @@ message Matcher { // Predicate for a single input field. message SinglePredicate { // Protocol-specific specification of input field to match on. + // [#extension-category: envoy.matching.common_inputs] core.v3.TypedExtensionConfig input = 1 [(validate.rules).message = {required: true}]; oneof matcher { diff --git a/envoy/config/common/matcher/v4alpha/matcher.proto b/envoy/config/common/matcher/v4alpha/matcher.proto index 586a4a92..7747157a 100644 --- a/envoy/config/common/matcher/v4alpha/matcher.proto +++ b/envoy/config/common/matcher/v4alpha/matcher.proto @@ -66,6 +66,7 @@ message Matcher { "envoy.config.common.matcher.v3.Matcher.MatcherList.Predicate.SinglePredicate"; // Protocol-specific specification of input field to match on. + // [#extension-category: envoy.matching.common_inputs] core.v4alpha.TypedExtensionConfig input = 1 [(validate.rules).message = {required: true}]; oneof matcher { diff --git a/envoy/extensions/matching/common_inputs/environment_variable/v3/BUILD b/envoy/extensions/matching/common_inputs/environment_variable/v3/BUILD new file mode 100644 index 00000000..ee92fb65 --- /dev/null +++ b/envoy/extensions/matching/common_inputs/environment_variable/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/matching/common_inputs/environment_variable/v3/input.proto b/envoy/extensions/matching/common_inputs/environment_variable/v3/input.proto new file mode 100644 index 00000000..13db7227 --- /dev/null +++ b/envoy/extensions/matching/common_inputs/environment_variable/v3/input.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package envoy.extensions.matching.common_inputs.environment_variable.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.matching.common_inputs.environment_variable.v3"; +option java_outer_classname = "InputProto"; +option java_multiple_files = true; +option (udpa.annotations.file_status).package_version_status = ACTIVE; + +// [#protodoc-title: Environment Variable Input] +// [#extension: envoy.matching.common_inputs.environment_variable] + +// Reads an environment variable to provide an input for matching. +message Config { + // Name of the environment variable to read from. + string name = 1 [(validate.rules).string = {min_len: 1}]; +} diff --git a/versioning/BUILD b/versioning/BUILD index 1be50dfd..17c30b15 100644 --- a/versioning/BUILD +++ b/versioning/BUILD @@ -129,6 +129,7 @@ proto_library( "//envoy/extensions/internal_redirect/allow_listed_routes/v3:pkg", "//envoy/extensions/internal_redirect/previous_routes/v3:pkg", "//envoy/extensions/internal_redirect/safe_cross_scheme/v3:pkg", + "//envoy/extensions/matching/common_inputs/environment_variable/v3:pkg", "//envoy/extensions/matching/input_matchers/consistent_hashing/v3:pkg", "//envoy/extensions/network/socket_interface/v3:pkg", "//envoy/extensions/rate_limit_descriptors/expr/v3:pkg",