Skip to content

Commit 38f7d23

Browse files
committed
dynamic_modules: adds a matcher based on Dynamic Modules
Signed-off-by: Rohit Agrawal <rohit.agrawal@databricks.com>
1 parent 011bd84 commit 38f7d23

File tree

41 files changed

+2336
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2336
-1
lines changed

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ extensions/upstreams/tcp @ggreenway @mattklein123
409409
/*/extensions/filters/listener/dynamic_modules @agrawroh @mathetake @wbpcode
410410
/*/extensions/filters/udp/dynamic_modules @agrawroh @mathetake @wbpcode
411411
/*/extensions/load_balancing_policies/dynamic_modules @agrawroh @mathetake @wbpcode
412+
/*/extensions/matching/input_matchers/dynamic_modules @agrawroh @mathetake @wbpcode
413+
/*/extensions/matching/http/dynamic_modules @agrawroh @mathetake @wbpcode
412414
# Linux network namespace override
413415
/*/extensions/local_address_selectors/filter_state_override @tonya11en @kyessenov
414416

api/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ proto_library(
348348
"//envoy/extensions/matching/common_inputs/network/v3:pkg",
349349
"//envoy/extensions/matching/common_inputs/ssl/v3:pkg",
350350
"//envoy/extensions/matching/common_inputs/stats/v3:pkg",
351+
"//envoy/extensions/matching/http/dynamic_modules/v3:pkg",
351352
"//envoy/extensions/matching/input_matchers/consistent_hashing/v3:pkg",
353+
"//envoy/extensions/matching/input_matchers/dynamic_modules/v3:pkg",
352354
"//envoy/extensions/matching/input_matchers/ip/v3:pkg",
353355
"//envoy/extensions/matching/input_matchers/metadata/v3:pkg",
354356
"//envoy/extensions/matching/input_matchers/runtime_fraction/v3:pkg",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.
2+
3+
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")
4+
5+
licenses(["notice"]) # Apache 2
6+
7+
api_proto_package(
8+
deps = ["@xds//udpa/annotations:pkg"],
9+
)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
syntax = "proto3";
2+
3+
package envoy.extensions.matching.http.dynamic_modules.v3;
4+
5+
import "udpa/annotations/status.proto";
6+
7+
option java_package = "io.envoyproxy.envoy.extensions.matching.http.dynamic_modules.v3";
8+
option java_outer_classname = "DynamicModulesProto";
9+
option java_multiple_files = true;
10+
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/matching/http/dynamic_modules/v3;dynamic_modulesv3";
11+
option (udpa.annotations.file_status).package_version_status = ACTIVE;
12+
13+
// [#protodoc-title: Dynamic Modules HTTP Match Input]
14+
// [#extension: envoy.matching.inputs.dynamic_module_data_input]
15+
16+
// Configuration for the dynamic modules HTTP match input. This input extracts HTTP request and
17+
// response data from the matching context and makes it available to the dynamic module matcher
18+
// via ABI callbacks during match evaluation.
19+
//
20+
// This data input should be used together with the
21+
// :ref:`dynamic modules input matcher
22+
// <envoy_v3_api_msg_extensions.matching.input_matchers.dynamic_modules.v3.DynamicModuleMatcher>`.
23+
message HttpDynamicModuleMatchInput {
24+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.
2+
3+
load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")
4+
5+
licenses(["notice"]) # Apache 2
6+
7+
api_proto_package(
8+
deps = [
9+
"//envoy/extensions/dynamic_modules/v3:pkg",
10+
"@xds//udpa/annotations:pkg",
11+
],
12+
)
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
syntax = "proto3";
2+
3+
package envoy.extensions.matching.input_matchers.dynamic_modules.v3;
4+
5+
import "envoy/extensions/dynamic_modules/v3/dynamic_modules.proto";
6+
7+
import "google/protobuf/any.proto";
8+
9+
import "udpa/annotations/status.proto";
10+
import "validate/validate.proto";
11+
12+
option java_package = "io.envoyproxy.envoy.extensions.matching.input_matchers.dynamic_modules.v3";
13+
option java_outer_classname = "DynamicModulesProto";
14+
option java_multiple_files = true;
15+
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/matching/input_matchers/dynamic_modules/v3;dynamic_modulesv3";
16+
option (udpa.annotations.file_status).package_version_status = ACTIVE;
17+
18+
// [#protodoc-title: Dynamic Modules Input Matcher]
19+
// [#extension: envoy.matching.matchers.dynamic_modules]
20+
21+
// Configuration for the Dynamic Modules Input Matcher. This matcher allows loading shared object
22+
// files via ``dlopen`` to implement custom matching logic in dynamic modules (e.g. Rust, Go).
23+
//
24+
// A module can implement arbitrary matching logic by examining request headers and other HTTP
25+
// attributes during the match evaluation. This is useful for scenarios that require complex
26+
// matching beyond what built-in matchers provide, such as JWT/OAuth token analysis, custom
27+
// routing decisions, or integration with external data sources.
28+
message DynamicModuleMatcher {
29+
// Specifies the shared-object level configuration. This field is required.
30+
envoy.extensions.dynamic_modules.v3.DynamicModuleConfig dynamic_module_config = 1
31+
[(validate.rules).message = {required: true}];
32+
33+
// The name for this matcher configuration. If not specified, defaults to an empty string.
34+
//
35+
// This can be used to distinguish between different matcher implementations inside a dynamic
36+
// module. For example, a module can have completely different matcher implementations (e.g.,
37+
// OAuth token matcher, geo-IP matcher). When Envoy receives this configuration, it passes
38+
// the ``matcher_config_name`` to the dynamic module's matcher config init function together
39+
// with the ``matcher_config``. That way a module can decide which in-module matcher
40+
// implementation to use based on the name at load time.
41+
string matcher_config_name = 2;
42+
43+
// The configuration for the matcher chosen by ``matcher_config_name``. If not specified, an
44+
// empty configuration is passed to the module.
45+
//
46+
// This is passed to the module's matcher initialization function. Together with the
47+
// ``matcher_config_name``, the module can decide which in-module matcher implementation to
48+
// use and fine-tune the behavior of the matcher.
49+
//
50+
// ``google.protobuf.Struct`` is serialized as JSON before passing it to the module.
51+
// ``google.protobuf.BytesValue`` and ``google.protobuf.StringValue`` are passed directly
52+
// without the wrapper.
53+
google.protobuf.Any matcher_config = 3;
54+
}

api/versioning/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,9 @@ proto_library(
288288
"//envoy/extensions/matching/common_inputs/ssl/v3:pkg",
289289
"//envoy/extensions/matching/common_inputs/stats/v3:pkg",
290290
"//envoy/extensions/matching/common_inputs/transport_socket/v3:pkg",
291+
"//envoy/extensions/matching/http/dynamic_modules/v3:pkg",
291292
"//envoy/extensions/matching/input_matchers/consistent_hashing/v3:pkg",
293+
"//envoy/extensions/matching/input_matchers/dynamic_modules/v3:pkg",
292294
"//envoy/extensions/matching/input_matchers/ip/v3:pkg",
293295
"//envoy/extensions/matching/input_matchers/metadata/v3:pkg",
294296
"//envoy/extensions/matching/input_matchers/runtime_fraction/v3:pkg",

changelogs/current.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ removed_config_or_runtime:
119119
# *Normally occurs at the end of the* :ref:`deprecation period <deprecated>`
120120

121121
new_features:
122+
- area: dynamic_modules
123+
change: |
124+
Added dynamic module input matcher extension which would allow implementing custom matching logic
125+
in external languages (Rust, Go, C) via dynamic modules.
122126
- area: ext_authz
123127
change: |
124128
Added support for the ``append_action`` enum in gRPC ext_authz ``OkHttpResponse.headers`` for upstream

docs/root/intro/arch_overview/advanced/dynamic_modules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Currently, dynamic modules are supported at the following extension points:
2727
* As an :ref:`access logger <envoy_v3_api_msg_extensions.access_loggers.dynamic_modules.v3.DynamicModuleAccessLog>`.
2828
* As a :ref:`network filter <envoy_v3_api_msg_extensions.filters.network.dynamic_modules.v3.DynamicModuleNetworkFilter>`.
2929
* As an :ref:`HTTP filter <envoy_v3_api_msg_extensions.filters.http.dynamic_modules.v3.DynamicModuleFilter>`.
30+
* As an :ref:`input matcher <envoy_v3_api_msg_extensions.matching.input_matchers.dynamic_modules.v3.DynamicModuleMatcher>`.
3031

3132
There are a few design goals for the dynamic modules:
3233

source/common/router/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ envoy_cc_library(
100100
"//source/common/matcher:matcher_lib",
101101
"//source/extensions/matching/network/common:inputs_lib",
102102
"@envoy_api//envoy/extensions/matching/common_inputs/network/v3:pkg_cc_proto",
103+
"@envoy_api//envoy/extensions/matching/http/dynamic_modules/v3:pkg_cc_proto",
103104
"@envoy_api//envoy/type/matcher/v3:pkg_cc_proto",
104105
],
105106
alwayslink = LEGACY_ALWAYSLINK,

0 commit comments

Comments
 (0)