-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
lua: Add per filter config for Lua filter #11235
Conversation
string name = 2 [(validate.rules).string = {min_bytes: 1}]; | ||
|
||
// Lua source code from RDS directly. | ||
config.core.v3.DataSource code = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should name
and code
be in a oneof
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name
is used to refer to a Lua script in the global configuration, and the code
is used to configure a Lua script directly in the Route. They should not be configured repeatedly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda agree with @htuch, what is the expected behavior when we set both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot set the name
and code
at the same time. If you need to use the same script in different routes, you can send the script through LDS, and then set the name
field in the route configuration. When the script is large, a part of redundant configuration can be reduced. The code
is for better flexibility, to avoid all scripts must be issued using LDS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest a oneof
for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, it seems like it is. One of disabled
, name
, or code
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but nit, rename s/code/source_code/ for consistency with source_codes
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4a85e30
to
480f466
Compare
This PR is based on @dio 's work.
|
@wbpcode please do not force-push in Envoy PRs. It makes reviewing your PR impossible. Also, can you fix format errors? That will unblock the rest of CI. Thank you! |
Signed-off-by: wbpcode <comems@msn.com>
Okay. |
Signed-off-by: wbpcode <comems@msn.com>
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Any luck of this one getting reviewed and merged in? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up. Sorry for the super late response. Seems like this one is fell off my radar. Sorry.
Functionally it looks good. However, we need to add docs as well regarding this newly introduced features.
string name = 2 [(validate.rules).string = {min_bytes: 1}]; | ||
|
||
// Lua source code from RDS directly. | ||
config.core.v3.DataSource code = 3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kinda agree with @htuch, what is the expected behavior when we set both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes for this. 🙂
@wbpcode I also appreciate it if you could elaborate on the changes introduced in this PR into a proper commit message. Thanks! |
Thanks for your detailed review and I will try to update this PR ASAP. @dio |
I will. |
I think you should do "merge master" as well. Thank you! |
Signed-off-by: wbpcode <comems@msn.com>
Signed-off-by: wbpcode <comems@msn.com>
Signed-off-by: wbpcode <comems@msn.com>
A new commit that reduced redundant code and updated integration test. |
/retest |
🐴 hold your horses - no failures detected, yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, nice work!
Please check CI and merge master. /wait |
|
||
// A name of a Lua source code stored in | ||
// :ref:`Lua.source_codes <envoy_v3_api_field_extensions.filters.http.lua.v3.Lua.source_codes>`. | ||
string name = 2 [(validate.rules).string.min_len = 1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string name = 2 [(validate.rules).string = {min_len: 1}];
Signed-off-by: wbpcode <comems@msn.com>
/retest |
🐴 hold your horses - no failures detected, yet. |
hmmm, look some wrong with this windows ci. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Commit Message: Add per filter config support for Lua filter.
This allows Lua filter to support per-route configuration. This patch enables the configured Lua filter to have multiple registered codes that can be referenced from each per-route config. Disabling running the global Lua filter for a route is also supported.
Risk Level: Low
Testing: Added.
Docs Changes: Added.
Release Notes: Added.
Fixes: #9279 #3124