-
Notifications
You must be signed in to change notification settings - Fork 5.5k
add extension point for custom StringMatcher, and lua implementation #32586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
58e9631
add field
ggreenway 603fe94
start work on extension
ggreenway e4c9248
includes
ggreenway 2c19a62
wip
ggreenway 50a7bc1
starting to create filter - needs message validation visitor
ggreenway 2f9d983
fix circular dependency between matchers and stats, grpc
ggreenway 9e49958
wip
ggreenway 5ba4161
working tests and integration test
ggreenway fd26479
Merge remote-tracking branch 'upstream/main' into stringmatcher-exten…
ggreenway 2988a31
switch to DataSource for code
ggreenway 24cf4b1
remove comment that isn't needed
ggreenway c5406b0
rename proto filed from `extension` to `custom`
ggreenway 55ef7e6
change namespace
ggreenway 5f75d3c
prefix function name with `envoy_`; hold a reference to function in lua
ggreenway 43e53fd
document lua
ggreenway 01916e6
proto format
ggreenway 2fd2b4c
format
ggreenway 8a17661
Revert "fix circular dependency between matchers and stats, grpc"
ggreenway 43bc93d
Merge remote-tracking branch 'upstream/main' into stringmatcher-exten…
ggreenway 2b765cd
allow luajit use in new extension
ggreenway 31037cf
fix format
ggreenway a7acad3
add comment
ggreenway 679ff29
fix router check tool
ggreenway 5c5c4c4
extension metadata
ggreenway 36b4595
fix format namespace
ggreenway ddef77a
docs
ggreenway a266a1d
fix multi-envoy test, following pattern used for all other singletons
ggreenway c47edf3
improve test coverage
ggreenway 5792164
fix asan test
ggreenway 0090626
Merge remote-tracking branch 'upstream/main' into stringmatcher-exten…
ggreenway 6684e5d
add comment about singletons
ggreenway 5de8572
Merge remote-tracking branch 'upstream/main' into stringmatcher-exten…
ggreenway 57f2942
changelog
ggreenway File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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}]; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| String Matcher | ||
| ============== | ||
|
|
||
| .. toctree:: | ||
| :glob: | ||
| :maxdepth: 2 | ||
|
|
||
| ../../extensions/string_matcher/*/v3/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,3 +12,4 @@ Other features | |
| wasm | ||
| wasm_service | ||
| qatzip | ||
| string_matcher | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| String Matcher | ||
| ============== | ||
|
|
||
| :ref:`StringMatcher <envoy_v3_api_msg_type.matcher.v3.StringMatcher>` can be configured | ||
| for one of the commonly used modes, or :ref:`extended for custom usecases | ||
| <envoy_v3_api_field_type.matcher.v3.StringMatcher.custom>`. | ||
|
|
||
| Envoy includes an :ref:`extension for running a Lua script | ||
| <envoy_v3_api_msg_extensions.string_matcher.lua.v3.Lua>` to determine | ||
| whether a string matches. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| load( | ||
| "//bazel:envoy_build_system.bzl", | ||
| "envoy_cc_extension", | ||
| "envoy_extension_package", | ||
| ) | ||
|
|
||
| licenses(["notice"]) # Apache 2 | ||
|
|
||
| envoy_extension_package() | ||
|
|
||
| envoy_cc_extension( | ||
| name = "config", | ||
| srcs = ["match.cc"], | ||
| hdrs = ["match.h"], | ||
| deps = [ | ||
| "//source/common/common:matchers_lib", | ||
| "//source/common/config:datasource_lib", | ||
| "//source/extensions/filters/common/lua:lua_lib", | ||
| "@envoy_api//envoy/extensions/string_matcher/lua/v3:pkg_cc_proto", | ||
| ], | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.