fix: lua filters from EnvoyExtensionPolicy can now run after ext_proc on the response path#2266
fix: lua filters from EnvoyExtensionPolicy can now run after ext_proc on the response path#2266yuehaii wants to merge 6 commits into
Conversation
…oll the lua filter order in filter chain. by default, it is after the ext_proc filter. setting it as "before-extproc" will move the lua filter before ext_proc filter. so in response, it will be executed after ext_proc filter. Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
|
hi @nacx , good day. could you please help review this pull request when it is convenient? thanks. |
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2266 +/- ##
==========================================
+ Coverage 84.70% 84.85% +0.15%
==========================================
Files 144 144
Lines 21204 21369 +165
==========================================
+ Hits 17960 18133 +173
+ Misses 2162 2146 -16
- Partials 1082 1090 +8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Thanks for raising. I would like to generalize the problem statement a bit and put more thought into this. Today, the filter order is hardcoded in the code and cannot be modified, and that has been a challenge already for several users. This PR tackles specifically hte problem for Lua, but I think we can generalize the solution to apply to the rest of the filters that can be configured with an `EnvoyExtensionPolicy, as Wasm or dynamic module users may be facing the same problems. Several things to consider and discuss:
|
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
Signed-off-by: hai.yue <20416005+yuehaii@users.noreply.github.com>
hi @nacx, good day. can you please review the pull request again? I introduced a new annotation on EnvoyExtensionPolicy that lets users declare the desired filter ordering relative to the ext_proc. the new annotation "aigateway.envoyproxy.io/filter-order" value is a comma-separated ordered sequence of filter type tokens, with the special token ExtProc acting as the pivot representing the ext_proc filter.
if "aigateway.envoyproxy.io/default-filter-order" is set as the value of DefaultFilterOrderAnnotation. it will places all of the policy's extension filters before the ext_proc. the k8s List call for EnvoyExtensionPolicy is served from the controller-runtime in-memory cache. it does not hit the k8s api server on every xDS translation. |
Description
lua filters are always ran before ext_proc on responses. any content mutation done in the filter is lost. lua filter order prevents running after ext_proc on responses.
Related Issues/PRs (if applicable)
Fixes #2247
Special notes for reviewers (if applicable)
introduces a new annotation on EnvoyExtensionPolicy that lets users declare the desired filter ordering relative to the ext_proc. during XDS translation (PostTranslateModify), the extension server reads the annotation and repositions the named filters in each listener's HCM filter chain accordingly.
the new annotation "aigateway.envoyproxy.io/filter-order" value is a comma-separated ordered sequence of filter type tokens, with the special token ExtProc acting as the pivot representing the ext_proc filter.
if "aigateway.envoyproxy.io/default-filter-order" is set as the value of DefaultFilterOrderAnnotation. it will places all of the policy's extension filters before the ext_proc.
the k8s List call for EnvoyExtensionPolicy is served from the controller-runtime in-memory cache. it does not hit the k8s api server on every xDS translation.