-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Wasm doesn't support setting filter state #28673
Comments
There's a similar issue for adding support for setting dynamic metadata here |
It seems strange that |
There are two reasons for using
|
Sounds like there's no generic way to set filter state. Would it make sense to have very specific wasm foreign function to set tcp_proxy filter state? (like This would enable writing wasm filters which just contain some business logic to select upstream cluster while reusing tcp_proxy filter for managing connections. Tcp_proxy filter already supports this dynamic upstream cluster selection but the only way to use it is write a native filter and recompile envoy. |
I think the missing piece of functionality is #24013. I don't like the idea of hard-coding a specific function for tcp_proxy. It would be more useful for tcp_proxy to register a dynamic handler to create and reflect on its filter state that could be used from any dynamic extension - go, Lua, or Wasm. |
That makes sense. However I don't fully understand #24013 (since I'm new to the codebase). Are there any pointers/examples on how to get the dynamic handler working? I'll be happy to contribute this to envoy since we really need this piece of extensibility in wasm. |
Proxy wasm supports setProperty method. However that method always prefixes all property keys with `wasm.`. So currently there's no way to set envoy filter state from wasm which prevents from using it for some scenarios (like chaining a custom network wasm filter with tcp proxy filter and setting `envoy.tcp_proxy.cluster` filter state to select upstream cluster). This change adds a new wasm foreign function `set_envoy_filter_state` and uses the [object factory to create filter state objects](#29030). Related Issue: #28673 Commit Message: Add set_envoy_filter_state proxy wasm foreign function Additional Description: Adds a proxy wasm foreign function to set envoy filter state Risk Level: low Testing: done Signed-off-by: Tanuj Mittal <tmittal@singlestore.com>
Description:
Currently
setProperty
method in Wasm prefixes all the property keys withwasm.
. This makes it impossible to set filter state likeenvoy.tcp_proxy.cluster
which is used by tcp_proxy network filter to dynamically select upstream cluster.Background:
I'm writing a custom Wasm filter which reads dynamic metadata (emitted by proxy_protocol listener based on TLV headers) and then selects a custom upstream cluster in tcp_proxy by setting filter state. However setting filter state is not possible with Wasm.
Is there any workaround for this?
The text was updated successfully, but these errors were encountered: