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: add a tiny stub page on JavaScript policies #107

Merged
merged 1 commit into from
Apr 26, 2022

Conversation

agilgur5
Copy link
Contributor

@agilgur5 agilgur5 commented Apr 21, 2022

Description

Summary

Adds a tiny stub page on writing policies in JavaScript using Javy

Details

  • similar to the TypeScript stub page that just briefly mentions AssemblyScript

    • minus the example
  • I found out about Javy recently, think it might deserve a mention

    • especially for potential eventual compatibility with jsPolicy policies, similar to how Kubewarden has some Rego/OPA/Gatekeeper compat

Test

N/A

To test this pull request, you can run the following commands:

Additional Information

Tradeoff

It's a stub, so not particularly useful and potentially even misleading, but it also shows potential users that there is opportunity for JS usage as well. Javy is also in beta, so could be abandoned, but it is also used by Shopify, so maybe not so likely. The stub is also transparent about the status, similar to the TypeScript stub.

Potential improvement

Just informing the Kubewarden and broader WASM and Policy communities about Javy

- similar to the TypeScript page, minus the available example

- I found out about Javy recently, think it might deserve a mention
  - especially for potential eventual compatibility with jsPolicy
    policies, similar to how there is Rego/OPA/Gatekeeper compat
@agilgur5 agilgur5 requested a review from a team as a code owner April 21, 2022 22:16
@flavio
Copy link
Member

flavio commented Apr 26, 2022

Yes, I wanted to give Javy a try. Please, keep us posted if you run some experiments with Javy/QuickJS

@flavio flavio merged commit 216cc9a into kubewarden:main Apr 26, 2022
@flavio
Copy link
Member

flavio commented Apr 26, 2022

@divya-mohan0209: something to be ported to docusaurus branch 😅

@agilgur5
Copy link
Contributor Author

agilgur5 commented Nov 9, 2024

Was curious to see if anyone else had made progress with JS support and it looks like this page doesn't exist on the v1.10+ versions of the docs. Was that intentional?

@flavio
Copy link
Member

flavio commented Nov 11, 2024

We haven't working on adding JS as a supported language to write policies. We haven't received requests from the community, aside from this PR.

Would you mind opening a new issue on https://github.com/kubewarden/kubewarden-controller/ please?

@agilgur5
Copy link
Contributor Author

agilgur5 commented Nov 12, 2024

I can, although the current "Writing Policies" > "Other languages" page says to open an issue or PR in this repo.

And that makes more sense to me as the "Writing Policies" docs are the main place where language usage is documented. The Controller also isn't responsible for language usage either, so an issue there would be confusing to me (the Policy Server would sound closer to me, but also not quite accurate either).
Let me know what you think.

Since Javy and WASI have more stable adoption/usage these days, I was thinking of experimenting with both myself to support other languages (JS and Python as two very popular languages, with jsPolicy compat being nice to have too (as per the original description). I was looking at updating the Go WASI example too since the official compiler supports it better now too)

@flavio
Copy link
Member

flavio commented Nov 14, 2024

About where to open the issue, it's just that we use the controller repository as a central place to coordinate the work on bigger issue, like this one.

Since Javy and WASI have more stable adoption/usage these days, I was thinking of experimenting with both myself to support other languages (JS and Python as two very popular languages, with jsPolicy compat being nice to have too (as per the original description).

Yes, they are definitely more mature solutions right now. The best way to implement support of these languages would be by adding a waPC guest driver for them.

A faster way (in terms of coding efforts) would be the writing of a Kubewarden WASI policy, but this suffers some limitations (documented here).

If you need some help feel free to join slack and ask. We'll be glad to help :)

I was looking at updating the Go WASI example too since the official compiler supports it better now too)

What are you referring to?

@agilgur5
Copy link
Contributor Author

agilgur5 commented Mar 3, 2025

About where to open the issue, it's just that we use the controller repository as a central place to coordinate the work on bigger issue, like this one.

A faster way (in terms of coding efforts) would be the writing of a Kubewarden WASI policy, but this suffers some limitations (documented here).

It looks like this effort has been moved to kubewarden/community#37

I was looking at updating the Go WASI example too since the official compiler supports it better now too)

What are you referring to?

The current Go WASI template uses TinyGo, but Go has partial support for WASI preview 1 since Go 1.21 / golang/go#31105. The Kyverno policy also says its waPC support is blocked due to the lack of go:wasmexport directive / golang/go#42372 -- it has been added in Go 1.24 per golang/go#65199.
Supporting the official Go compiler could help adoption and reduce maintenance overhead, although I think there are still some desirable features from TinyGo (e.g. smaller binary size, better support for WASI preview 2)

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.

2 participants