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(plugin): add proxywasm plugin #284

Draft
wants to merge 6 commits into
base: beta
Choose a base branch
from

Conversation

acouvreur
Copy link
Owner

The proxywasm plugin is a WASM Filter following the ProxyWasm ABI Specification using the proxywasm go sdk

This allows extensibility with any reverse proxy who implements the ProxyWasm ABI Specification.

The current WASM Filter was successfully tested with APISIX and Envoy.

@acouvreur acouvreur linked an issue Apr 17, 2024 that may be closed by this pull request
@github-actions github-actions bot added documentation Improvements or additions to documentation reverse-proxy Reverse proxy integration related issue labels Apr 17, 2024
Copy link
Owner Author

@acouvreur acouvreur left a comment

Choose a reason for hiding this comment

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

This is a first draft for the proxywasm plugin.

This plugin will allow a great extensibility and usage within the reverse proxy world.

More examples are to come with Nginx and Istio.


What's left to do:

  • Add nginx and istio examples
  • Add E2E tests
  • Publish a WASM Docker Image that will be used with Istio (ci)
  • Enhance documentation
  • All examples should have a README on how to run them with a full execution example.

@github-actions github-actions bot added the ci label Apr 18, 2024
@acouvreur acouvreur force-pushed the 145-add-envoyistio-reverse-proxy-integration branch from 2b6fcdf to 4aa69e6 Compare April 18, 2024 01:35
@acouvreur acouvreur changed the base branch from main to beta April 18, 2024 01:46
@acouvreur acouvreur changed the base branch from beta to main April 19, 2024 15:07
@acouvreur acouvreur force-pushed the 145-add-envoyistio-reverse-proxy-integration branch from 4aa69e6 to 410a49b Compare April 21, 2024 04:52
@github-actions github-actions bot added the provider Issue related to a provider label Apr 21, 2024
@acouvreur acouvreur changed the base branch from main to beta May 4, 2024 15:30
@acouvreur acouvreur force-pushed the 145-add-envoyistio-reverse-proxy-integration branch from 410a49b to beca491 Compare May 5, 2024 02:52
@acouvreur
Copy link
Owner Author

There's one remaining issue before marking this PR as ready:

It's the way the proxywasm.DispatchHttpCall function works depending on the reverse proxy.

The signature of the function is the following:

// DispatchHttpCall is for dispatching HTTP calls to a remote cluster. This can be used by all contexts
// including Tcp and Root contexts. "cluster" arg specifies the remote cluster the host will send
// the request against with "headers", "body", and "trailers" arguments. "callBack" function is called if the host successfully
// made the request and received the response from the remote cluster.
// When the callBack function is called, the "GetHttpCallResponseHeaders", "GetHttpCallResponseBody", "GetHttpCallResponseTrailers"
// calls are available for accessing the response information.
func DispatchHttpCall(
	cluster string,
	headers [][2]string,
	body []byte,
	trailers [][2]string,
	timeoutMillisecond uint32,
	callBack func(numHeaders, bodySize, numTrailers int),
) (calloutID uint32, err error) {

Istio expects the following arguments:

  • The cluster in the following format: "outbound|10000||sablier"
  • The following headers:
    • ":method": GET
    • ":path": /api/strategies/...
    • ":authority": sablier

Other reverse proxies (Ngin and APISIX) expect the following arguments:

  • The cluster in the following format: sablier:10000
  • The following headers:
    • ":method": GET
    • ":path": /api/strategies/...
    • ":authority": sablier:10000

Kong ref: https://github.com/Kong/ngx_wasm_module/blob/b19d405403ca6765c548e571010aea3af1accaea/src/http/proxy_wasm/ngx_http_proxy_wasm_dispatch.c#L255-L269
APISIX Ref: https://github.com/api7/wasm-nginx-module/blob/0b4b31d6ecfdbc587e8ea455ed6e920a98aadff1/src/http/ngx_http_wasm_call.c#L38-L44


So depending of the execution context, I have to provide different ways of build the configuration.
I could expose the cluster argument and authority arguments directly so I don't have to pre-bake them.

But I'm not really sure.

The `proxywasm` plugin is a WASM Filter following the ProxyWasm ABI Specification using the proxywasm go sdk

This allows extensibility with any reverse proxy who implements the ProxyWasm ABI Specification.

The current WASM Filter was successfully tested with APISIX and Envoy.
@acouvreur acouvreur force-pushed the 145-add-envoyistio-reverse-proxy-integration branch from 106e187 to ae56efa Compare May 30, 2024 17:08
@acouvreur
Copy link
Owner Author

Everything is almost ready:

  • need to add e2e tests
  • more documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci documentation Improvements or additions to documentation provider Issue related to a provider reverse-proxy Reverse proxy integration related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Envoy/Istio reverse proxy integration
1 participant