feat(api): Add filterContext field to Lua type in EnvoyExtensionPolicy#8730
feat(api): Add filterContext field to Lua type in EnvoyExtensionPolicy#8730norman-zon wants to merge 3 commits intoenvoyproxy:mainfrom
Conversation
✅ Deploy Preview for cerulean-figolla-1f9435 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
694e6c9 to
846777f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8730 +/- ##
==========================================
- Coverage 74.32% 74.28% -0.04%
==========================================
Files 245 245
Lines 38801 38807 +6
==========================================
- Hits 28837 28829 -8
- Misses 7962 7973 +11
- Partials 2002 2005 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
…#8715) Add an optional `filterContext` field (map[string]string) to the Lua type in EnvoyExtensionPolicySpec. This exposes Envoy's existing LuaPerRoute.filter_context so that a shared Lua script can be parameterized differently per route via request_handle:filterContext(). Without this, users must either duplicate the entire script inline with hardcoded values or resort to EnvoyPatchPolicy to manually patch xDS. Changes: - api: add FilterContext to Lua struct - ir: add FilterContext to IR Lua struct - gatewayapi: pass FilterContext from API to IR in buildLua() - xds: set FilterContext on LuaPerRoute in patchRoute(), converting map[string]string to structpb.Struct - tests: update gatewayapi/xds translator testdata, add e2e test - docs: add FilterContext section to Lua extension task guide Signed-off-by: Norman Stetter <85173861+norman-zon@users.noreply.github.com>
Signed-off-by: Norman Stetter <85173861+norman-zon@users.noreply.github.com>
a55e539 to
4bc5e02
Compare
Signed-off-by: Norman Stetter <85173861+norman-zon@users.noreply.github.com>
4bc5e02 to
070ba24
Compare
|
|
rudrakhp
left a comment
There was a problem hiding this comment.
You will need to add mocks for the filterContext() api in the validator mocks which is failing your E2E. Please refer how other APIs are mocked for this.
What type of PR is this?
feat/api
What this PR does / why we need it:
Adds an optional
filterContextfield (map[string]string) to theLuatype inEnvoyExtensionPolicySpec, exposing Envoy's existingLuaPerRoute.filter_contextfield.This allows a shared Lua script (stored in a ConfigMap via
ValueRef) to be parameterized differently per route usingrequest_handle:filterContext(). Without this, users must either duplicate the entire script inline with hardcoded values for each route or useEnvoyPatchPolicyto manually patch the generated xDS — both of which are fragile and defeat the purpose of script reuse.Example usage:
The Lua script accesses the values via:
Changes:
api/v1alpha1/lua_types.go— addFilterContext map[string]stringtoLuastructinternal/ir/xds.go— addFilterContextto IRLuastructinternal/gatewayapi/envoyextensionpolicy.go— passFilterContextfrom API → IRinternal/xds/translator/lua.go— setFilterContextonLuaPerRoute, convertingmap[string]string→structpb.StructfilterContext()and sets value as response headerNo new Envoy features required — this only exposes an existing
LuaPerRoutefield.Which issue(s) this PR fixes:
Fixes #8715
Release Notes: Yes