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

feat(conf_loader): load all WASM filters from conf path #10353

Merged
merged 8 commits into from
Mar 2, 2023

Conversation

locao
Copy link
Contributor

@locao locao commented Feb 22, 2023

Summary

Load WASM filters from configured path.

Checklist

Full changelog

  • load wasm filters from configured path.
  • do not expect individual files.
  • added new directive to template.

Issue reference

KAG-500

@locao locao changed the title feat(conf_loader) load all WASM filters from conf path feat(conf_loader): load all WASM filters from conf path Feb 23, 2023
@locao locao requested a review from flrgh February 23, 2023 13:40
kong.conf.default Outdated Show resolved Hide resolved
@hbagdi
Copy link
Member

hbagdi commented Feb 23, 2023

I'm not sure but do you think it is reasonable to add an explicit "KONG_WASM" or similar configuration option to globally enable/disable wasm support in Kong, at least until it is stable enough that we deem it to be production-grade?

@thibaultcha
Copy link
Member

The tech preview branch had the wasm = on/off flag that superseded the wasm_modules property, but this PR removed it to fully depend on whether or not .wasm files are present in the directory we point to. I guess the question is do we want to enable wasm support only depending on whether or not .wasm bytecode is detected, or do we want a boolean flag to enable on top of that first condition. Personally I have no opinion, only wanted to clarify what we have and what we can do.

@hbagdi
Copy link
Member

hbagdi commented Feb 24, 2023

I guess the question is do we want to enable wasm support only depending on whether or not .wasm bytecode is detected, or do we want a boolean flag to enable on top of that first condition.

I lean towards having a boolean flag that serves as the main flag to enable/disable WASM support. The rationale is that sometimes the operator would like to disable WASM (for any reason) without removing the .wasm bytecode files, which may be baked into the container image, and changing the container image would require more hassle than is strictly necessary.

@locao
Copy link
Contributor Author

locao commented Feb 24, 2023

disable WASM (for any reason) without removing the .wasm bytecode files, which may be baked into the container image

Having the wasm files baked in the container image was something I wasn't considering. So, yes, it makes sense to have a boolean flag.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Feb 27, 2023
@@ -581,7 +581,7 @@ local CONF_PARSERS = {
max_queued_batches = { typ = "number" },

wasm = { typ = "boolean" },
wasm_modules = { typ = "array" },
wasm_filters_path = { typ = "string" },
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're leaning towards using the boolean wasm = on|off setting to toggle wasm, would it make sense to remove wasm_filters_path as a setting and use a standardized location (i.e. {{KONG_PREFIX}}/wasm_filters) instead?

We can always add wasm_filters_path later on if there is a compelling case to use a non-default location.

@locao what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have a strong opinion on this. I like a lot of knobs to adjust even if they were never touched, but that's not how a good product is built 😅

For the sake of keeping things simpler, I'd say let's try without wasm_filters_path and see if we miss using it during development phase.

Copy link
Contributor

Choose a reason for hiding this comment

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

I can imagine it being kind of annoying for our integration tests if the path is not configurable, but in my opinion this gives us the incentive to make sure symlinks are supported. Ideally something like this should be supported out-of-the box:

ln -s \
  /path/to/git/kong/spec/fixtures/wasm/a/b/c/d/my_filter.wasm \
  /path/to/my_kong_prefix/wasm_filters/my_filter.wasm

kong/conf_loader/init.lua Outdated Show resolved Hide resolved
@locao locao force-pushed the feat/wasmx-load_from_path branch from c00b894 to 7dcdf73 Compare March 2, 2023 15:23
@flrgh flrgh merged this pull request into feat/wasmx Mar 2, 2023
@flrgh flrgh deleted the feat/wasmx-load_from_path branch March 2, 2023 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants