Skip to content
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

api: lua support in EnvoyExtensionPolicy #4932

Merged
merged 1 commit into from
Jan 8, 2025

Conversation

rudrakhp
Copy link
Contributor

@rudrakhp rudrakhp commented Dec 14, 2024

What type of PR is this?

api: lua support in EnvoyExtensionPolicy

What this PR does / why we need it:

Enables EGW users to define Lua filters natively without a need to patch Envoy filters.

Which issue(s) this PR fixes:

Related #4627

Release Notes: No

@rudrakhp rudrakhp force-pushed the api_lua_extension branch 2 times, most recently from 9e34b47 to 5a7a7ed Compare December 14, 2024 23:17
Copy link

codecov bot commented Dec 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.75%. Comparing base (279ba62) to head (acbc4b0).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4932   +/-   ##
=======================================
  Coverage   66.75%   66.75%           
=======================================
  Files         209      209           
  Lines       32254    32254           
=======================================
  Hits        21531    21531           
  Misses       9428     9428           
  Partials     1295     1295           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rudrakhp rudrakhp marked this pull request as ready for review December 15, 2024 06:29
@rudrakhp rudrakhp requested a review from a team as a code owner December 15, 2024 06:29
@zirain
Copy link
Member

zirain commented Dec 16, 2024

for a general idea, I think we should support in only in EnvoyExtensionPolicy?

@rudrakhp
Copy link
Contributor Author

@zirain do you mean have no support for per route Lua filters at all? Or have only global filter for the first phase and support per route filter later?

@zirain
Copy link
Member

zirain commented Dec 17, 2024

@zirain do you mean have no support for per route Lua filters at all? Or have only global filter for the first phase and support per route filter later?

I means we can start from support it in EnvoyExtensionPolicy first.

@zhaohuabing
Copy link
Member

@zirain do you mean have no support for per route Lua filters at all? Or have only global filter for the first phase and support per route filter later?

@rudrakhp Let's only support Lua in the EEP. EEP can be applied to either a Gateway or an HTTPRoute.

@zhaohuabing
Copy link
Member

@rudrakhp Thanks for working on this! The API looks quite similar to the Envoy lua configuration, which is not ideal for EG. The Envoy Lua configuration is primarily designed as a programming API for a control plane, rather than for direct use by end users.

Please refer to the comments and the other EG API to redefine the Lua API. Thanks!

@rudrakhp
Copy link
Contributor Author

rudrakhp commented Dec 17, 2024

@zhaohuabing Thanks! I was actually wondering if we need to opinionated about what we expose to users or be as transparent as possible.

EEP can be applied to either a Gateway or an HTTPRoute.

Ah that simplifies things! Have made some changes please do check!

@rudrakhp rudrakhp force-pushed the api_lua_extension branch 3 times, most recently from e096d3d to 2e7c5cc Compare December 17, 2024 20:57
@rudrakhp rudrakhp changed the title api: lua support in EnvoyExtensionPolicy and HTTPRouteFilter api: lua support in EnvoyExtensionPolicy Dec 18, 2024
@rudrakhp rudrakhp force-pushed the api_lua_extension branch 2 times, most recently from 417f0e1 to 3af71fd Compare December 18, 2024 06:03
@zirain
Copy link
Member

zirain commented Dec 18, 2024

/retest

@rudrakhp
Copy link
Contributor Author

/retest

zhaohuabing
zhaohuabing previously approved these changes Dec 19, 2024
Copy link
Member

@zhaohuabing zhaohuabing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

zirain
zirain previously approved these changes Dec 19, 2024
@zhaohuabing
Copy link
Member

@rudrakhp @zirain Let's hold this until @arkodg is back from vacation as he may have more insights on the API.

@zirain
Copy link
Member

zirain commented Dec 24, 2024

/retest

//
// +kubebuilder:validation:XValidation:rule="has(self.inline) ? !has(self.valueRef) : has(self.valueRef)",message="Exactly one of inline or valueRef must be set."
type Lua struct {
// Inline contains the source code as an inline string.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also needs a Type enum here e.g.

Type *ResponseValueType `json:"type"`

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arkodg I was kind of making it work by allowing only one of both value types, but added a type as suggested.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah we've followed https://github.com/kubernetes/enhancements/blob/master/keps/sig-api-machinery/1027-api-unions/README.md to implement unions in most places of the API to getter better schema for validation

@rudrakhp rudrakhp dismissed stale reviews from zirain and zhaohuabing via 09df0af January 7, 2025 19:34
api/v1alpha1/lua_types.go Outdated Show resolved Hide resolved
Copy link
Contributor

@arkodg arkodg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks !

@arkodg arkodg requested review from a team, zirain and zhaohuabing January 8, 2025 01:54
Copy link
Member

@zhaohuabing zhaohuabing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks!

@zhaohuabing zhaohuabing merged commit d23eab9 into envoyproxy:main Jan 8, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants