-
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
feat(wasm): support bundled filters #12843
Conversation
The code for this is AFAICT feature-complete and should be considered ready-for-review, but this should not be merged until after the distribution work for bundled filters is done so that I can update the tests accordingly. (Also I have no idea if my hack for enabling bundled filters in local dev is going to work yet.) |
0b371a3
to
7f132c2
Compare
Currently rebased onto #12853. Once that is merged this PR will get a bit smaller. |
7f132c2
to
b5efbd0
Compare
030775e
to
d78ea4c
Compare
This pr has some debug messages on it, I am moving it to Draft until that is addressed. @flrgh please move it back to "Ready to review" when ready. |
cc4b8d4
to
b3a54fc
Compare
I'm a bit late for adding my $0.02 on this, but I think some sort of namespacing of filters could nicely solve the collision issue. For example:
Then we could enable with
In addition, setting up some standard file locations for these such that we don't have to configure a base path, and these filters could be installed at:
|
@brentos Users can name filters as they like, so they can definitely use namespacing to avoid collisions. 👍 This is more about allowing for "intentional" collisions, that is, for when a user wants to override a bundled filter that is shipped with Kong (for example, with a more recent version), without having to disable bundled filters altogether. |
@@ -177,6 +177,8 @@ describe("#wasm - hybrid mode #postgres", function() | |||
res = res:read_body(), | |||
} | |||
end) | |||
.with_timeout(60) |
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.
re: all of these timeout changes
This is to account for the increased NGINX startup time incurred from loading the new datakit
module. Locally I'm seeing about ~3.6s pretty consistently, but timing in CI (where we are often saturating the CPU) is slower and very inconsistent, so a large timeout is selected to keep the test from being flaky.
There is some work in progress to mitigate the slow startup time: Kong/ngx_wasm_module#536
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.
update: because module loading is an init_worker thing, the privileged agent worker is also delayed on startup, so this affects how long it takes for the DP to establish a connection to the CP. I believe that is why this test suite is struggling so much more than others. Changes:
- added some more logfile assertions to watch for a module load event (technically this only guarantees that 1/N processes has finished init_worker, but it's still somewhat helpful).
- adjusted the worker procs to 2
- disabled bundled filters in this test suite because
datakit
is the biggest source of slow init_worker
cb21380
to
f5a317b
Compare
investigating something, please do not merge edit: okay I think the tests should be a lot more stable now, good to merge when 🟢 |
b5154c4
to
2d490a5
Compare
2d490a5
to
99901c6
Compare
Successfully created cherry-pick PR for |
(cherry picked from commit 1e90a31)
Summary
An upcoming Kong release will ship with at least one bundled Wasm filter.
Previously there was no concept of "bundled" filters: all filters must be provided by the user in the
wasm_filters_path
directory.This introduces a new
wasm_filters
kong.conf property. It is a comma-delimited array that functions quite similarly to theplugins
property with the addition of a specialuser
value:In the case of a collision between bundled and user filters, the conf loader will prefer the user filter and log a warning.
Checklist
changelog/unreleased/kong
orskip-changelog
label added on PR if changelog is unnecessary. README.mdIssue reference
KAG-4211