Skip to content

Commit e33a24c

Browse files
committed
Updates Envoy
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
1 parent d6d3910 commit e33a24c

7 files changed

Lines changed: 28 additions & 21 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN cp /build/target/aarch64-unknown-linux-gnu/debug/librust_module.so /build/ar
2828
RUN cp /build/target/x86_64-unknown-linux-gnu/debug/librust_module.so /build/amd64_librust_module.so
2929

3030
# Finally, copy the built library to the final image.
31-
FROM envoyproxy/envoy-dev:726958228dc292f65b5acde26162a3645a99b067 AS envoy
31+
FROM envoyproxy/envoy-dev:9e1c1fc7e824ebf7ca8aef77377b1f9de854b2b2 AS envoy
3232
ARG TARGETARCH
3333
ENV ENVOY_DYNAMIC_MODULES_SEARCH_PATH=/usr/local/lib
3434
COPY --from=rust_builder /build/${TARGETARCH}_librust_module.so /usr/local/lib/librust_module.so

ENVOY_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
726958228dc292f65b5acde26162a3645a99b067
1+
9e1c1fc7e824ebf7ca8aef77377b1f9de854b2b2

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Dynamic Modules Examples
22

3-
> Envoy Version: [726958228dc292f65b5acde26162a3645a99b067]
3+
> Envoy Version: [9e1c1fc7e824ebf7ca8aef77377b1f9de854b2b2]
44
55
This repository hosts examples of dynamic modules for [Envoy] to extend its functionality.
66
The high level documentation is available [here][High Level Doc]. In short, a dynamic module is a shared library
@@ -79,6 +79,6 @@ NEW_VERSION=4a113b5118003682833ba612202eb68628861ac6 # Whatever the commit in en
7979
grep -rlF "${CURRENT_VERSION}" . | xargs sed -i "s/${CURRENT_VERSION}/${NEW_VERSION}/g"
8080
```
8181

82-
[726958228dc292f65b5acde26162a3645a99b067]: https://github.com/envoyproxy/envoy/tree/726958228dc292f65b5acde26162a3645a99b067
82+
[9e1c1fc7e824ebf7ca8aef77377b1f9de854b2b2]: https://github.com/envoyproxy/envoy/tree/9e1c1fc7e824ebf7ca8aef77377b1f9de854b2b2
8383
[Envoy]: https://github.com/envoyproxy/envoy
8484
[High Level Doc]: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/advanced/dynamic_modules

integration/envoy.yaml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,29 @@ static_resources:
3535
dynamic_module_config:
3636
name: rust_module
3737
filter_name: access_logger
38-
filter_config: |
39-
{
40-
"num_workers": 2,
41-
"dirname": "./access_logs"
42-
}
38+
filter_config:
39+
"@type": "type.googleapis.com/google.protobuf.StringValue"
40+
value: |
41+
{
42+
"num_workers": 2,
43+
"dirname": "./access_logs"
44+
}
4345
- name: dynamic_modules/header_mutation
4446
typed_config:
4547
# https://www.envoyproxy.io/docs/envoy/latest/api-v3/extensions/dynamic_modules/v3/dynamic_modules.proto#envoy-v3-api-msg-extensions-dynamic-modules-v3-dynamicmoduleconfig
4648
"@type": type.googleapis.com/envoy.extensions.filters.http.dynamic_modules.v3.DynamicModuleFilter
4749
dynamic_module_config:
4850
name: rust_module
4951
filter_name: header_mutation
50-
filter_config: |
51-
{
52-
"request_headers": [["X-Envoy-Header", "envoy-header"], ["X-Envoy-Header2", "envoy-header2"]],
53-
"remove_request_headers": ["apple"],
54-
"response_headers": [["Foo", "bar"], ["Foo2", "bar2"]],
55-
"remove_response_headers": ["Access-Control-Allow-Credentials"]
56-
}
52+
filter_config:
53+
"@type": "type.googleapis.com/google.protobuf.StringValue"
54+
value: |
55+
{
56+
"request_headers": [["X-Envoy-Header", "envoy-header"], ["X-Envoy-Header2", "envoy-header2"]],
57+
"remove_request_headers": ["apple"],
58+
"response_headers": [["Foo", "bar"], ["Foo2", "bar2"]],
59+
"remove_response_headers": ["Access-Control-Allow-Credentials"]
60+
}
5761
- name: envoy.filters.http.router
5862
typed_config:
5963
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
@@ -117,8 +121,10 @@ static_resources:
117121
dynamic_module_config:
118122
name: rust_module
119123
filter_name: zero_copy_regex_waf
120-
# Reject requests with curl or wget in the body.
121-
filter_config: "^.*(curl|wget).*"
124+
filter_config:
125+
"@type": "type.googleapis.com/google.protobuf.StringValue"
126+
# Reject requests with curl or wget in the body.
127+
value: "^.*(curl|wget).*"
122128
- name: envoy.filters.http.router
123129
typed_config:
124130
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router

rust/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repository = "https://github.com/envoyproxy/dynamic-modules-example"
88

99
[dependencies]
1010
# The SDK version must match the Envoy version due to the strict compatibility requirements.
11-
envoy-proxy-dynamic-modules-rust-sdk = { git = "https://github.com/envoyproxy/envoy", rev = "726958228dc292f65b5acde26162a3645a99b067" }
11+
envoy-proxy-dynamic-modules-rust-sdk = { git = "https://github.com/envoyproxy/envoy", rev = "9e1c1fc7e824ebf7ca8aef77377b1f9de854b2b2" }
1212
serde = { version = "1.0", features = ["derive"] }
1313
serde_json = "1.0"
1414
rand = "0.9.0"

rust/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ fn init() -> bool {
3131
fn new_http_filter_config_fn<EC: EnvoyHttpFilterConfig, EHF: EnvoyHttpFilter>(
3232
_envoy_filter_config: &mut EC,
3333
filter_name: &str,
34-
filter_config: &str,
34+
filter_config: &[u8],
3535
) -> Option<Box<dyn HttpFilterConfig<EC, EHF>>> {
36+
let filter_config = std::str::from_utf8(filter_config).unwrap();
3637
match filter_name {
3738
"passthrough" => Some(Box::new(http_passthrough::FilterConfig::new(filter_config))),
3839
"access_logger" => http_access_logger::FilterConfig::new(filter_config)

0 commit comments

Comments
 (0)