add extension point for custom StringMatcher, and lua implementation (#32586)

Risk Level: Low
Testing: New tests

Signed-off-by: Greg Greenway <ggreenway@apple.com>

Mirrored from https://github.com/envoyproxy/envoy @ f9ec5b8e59de6cf5cafdab2a954b03b83b58c64d
main
update-envoy[bot] 12 months ago
parent 00f6ad0725
commit 2059357065
  1. 1
      BUILD
  2. 12
      envoy/extensions/string_matcher/lua/v3/BUILD
  3. 37
      envoy/extensions/string_matcher/lua/v3/lua.proto
  4. 1
      envoy/type/matcher/v3/BUILD
  5. 8
      envoy/type/matcher/v3/string.proto
  6. 1
      versioning/BUILD

@ -317,6 +317,7 @@ proto_library(
"//envoy/extensions/stat_sinks/graphite_statsd/v3:pkg",
"//envoy/extensions/stat_sinks/open_telemetry/v3:pkg",
"//envoy/extensions/stat_sinks/wasm/v3:pkg",
"//envoy/extensions/string_matcher/lua/v3:pkg",
"//envoy/extensions/tracers/opentelemetry/resource_detectors/v3:pkg",
"//envoy/extensions/tracers/opentelemetry/samplers/v3:pkg",
"//envoy/extensions/transport_sockets/alts/v3:pkg",

@ -0,0 +1,12 @@
# 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/core/v3:pkg",
"@com_github_cncf_xds//udpa/annotations:pkg",
],
)

@ -0,0 +1,37 @@
syntax = "proto3";
package envoy.extensions.string_matcher.lua.v3;
import "envoy/config/core/v3/base.proto";
import "udpa/annotations/status.proto";
import "validate/validate.proto";
option java_package = "io.envoyproxy.envoy.extensions.string_matcher.lua.v3";
option java_outer_classname = "LuaProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/string_matcher/lua/v3;luav3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;
// [#protodoc-title: Lua StringMatcher]
// A Lua StringMatcher allows executing a Lua script to determine if a string is a match. The configured source
// code must define a function named `envoy_match`. If the function returns true, the string is considered a match.
// Any other result, including an execution error, is considered a non-match.
//
// Example:
//
// .. code-block:: yaml
//
// source_code:
// inline_string: |
// function envoy_match(str)
// -- Do something.
// return true
// end
//
// [#extension: envoy.string_matcher.lua]
message Lua {
// The Lua code that Envoy will execute
config.core.v3.DataSource source_code = 1 [(validate.rules).message = {required: true}];
}

@ -9,5 +9,6 @@ api_proto_package(
"//envoy/annotations:pkg",
"//envoy/type/v3:pkg",
"@com_github_cncf_xds//udpa/annotations:pkg",
"@com_github_cncf_xds//xds/core/v3:pkg",
],
)

@ -4,6 +4,8 @@ package envoy.type.matcher.v3;
import "envoy/type/matcher/v3/regex.proto";
import "xds/core/v3/extension.proto";
import "udpa/annotations/status.proto";
import "udpa/annotations/versioning.proto";
import "validate/validate.proto";
@ -17,7 +19,7 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE;
// [#protodoc-title: String matcher]
// Specifies the way to match a string.
// [#next-free-field: 8]
// [#next-free-field: 9]
message StringMatcher {
option (udpa.annotations.versioning).previous_message_type = "envoy.type.matcher.StringMatcher";
@ -61,6 +63,10 @@ message StringMatcher {
//
// * ``abc`` matches the value ``xyz.abc.def``
string contains = 7 [(validate.rules).string = {min_len: 1}];
// Use an extension as the matcher type.
// [#extension-category: envoy.string_matcher]
xds.core.v3.TypedExtensionConfig custom = 8;
}
// If true, indicates the exact/prefix/suffix/contains matching should be case insensitive. This

@ -256,6 +256,7 @@ proto_library(
"//envoy/extensions/stat_sinks/graphite_statsd/v3:pkg",
"//envoy/extensions/stat_sinks/open_telemetry/v3:pkg",
"//envoy/extensions/stat_sinks/wasm/v3:pkg",
"//envoy/extensions/string_matcher/lua/v3:pkg",
"//envoy/extensions/tracers/opentelemetry/resource_detectors/v3:pkg",
"//envoy/extensions/tracers/opentelemetry/samplers/v3:pkg",
"//envoy/extensions/transport_sockets/alts/v3:pkg",

Loading…
Cancel
Save