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

middleware: add wasm basic #1747

Merged
merged 8 commits into from
Jun 13, 2022
Merged

middleware: add wasm basic #1747

merged 8 commits into from
Jun 13, 2022

Conversation

daixiang0
Copy link
Member

@daixiang0 daixiang0 commented May 24, 2022

Signed-off-by: Loong [email protected]

Description

Basic WASM HTTP middleware implement.

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #1171

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation / Created issue in the https://github.com/dapr/docs/ repo: dapr/docs#[issue number]

@daixiang0 daixiang0 requested review from a team as code owners May 24, 2022 08:03
@daixiang0 daixiang0 mentioned this pull request May 24, 2022
3 tasks
@daixiang0
Copy link
Member Author

@shubham1172 could you help check the exact error of fossa? And where is the webapp:

The build failed. Check the FOSSA webapp for more details.

@shubham1172
Copy link
Member

@daixiang0 you can check out the Dapr project once you login to https://app.fossa.com/projects
As of the build failure, it looks like a FOSSA problem. Scan completed fine; the test step failed without any other information. I don't see anything on the FOSSA portal too. Had created this issue to track fossas/fossa-cli#943

@daixiang0
Copy link
Member Author

@yaron2 could you take a look?

@yaron2
Copy link
Member

yaron2 commented Jun 2, 2022

@daixiang0 please resolve the conflict.

@yaron2
Copy link
Member

yaron2 commented Jun 9, 2022

ping @daixiang0

@yaron2
Copy link
Member

yaron2 commented Jun 9, 2022

Can you give an example here of how a component YAML would look like for WASM?

middleware/http/wasm/basic/basic.go Outdated Show resolved Hide resolved
middleware/http/wasm/basic/basic.go Outdated Show resolved Hide resolved
@berndverst
Copy link
Member

@yaron2 component should look like this if I'm understanding this PR correctly

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: basicwasm
spec:
  type: middleware.http.wasm.basic
  version: v1
  metadata:
  - name: path
    value: "./hello.wasm"
  - bane: runtime
    value: "wazero"

@daixiang0
Copy link
Member Author

daixiang0 commented Jun 13, 2022

@yaron2 component should look like this if I'm understanding this PR correctly

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: basicwasm
spec:
  type: middleware.http.wasm.basic
  version: v1
  metadata:
  - name: path
    value: "./hello.wasm"
  - bane: runtime
    value: "wazero"

@berndverst totally correct! Thanks for lint fixing by the way.

@daixiang0 daixiang0 mentioned this pull request Jun 13, 2022
7 tasks
@codecov
Copy link

codecov bot commented Jun 13, 2022

Codecov Report

Merging #1747 (ea7dc91) into master (4322a22) will decrease coverage by 0.01%.
The diff coverage is 32.47%.

@@            Coverage Diff             @@
##           master    #1747      +/-   ##
==========================================
- Coverage   36.59%   36.58%   -0.02%     
==========================================
  Files         177      178       +1     
  Lines       16222    16350     +128     
==========================================
+ Hits         5937     5982      +45     
- Misses       9617     9682      +65     
- Partials      668      686      +18     
Impacted Files Coverage Δ
pubsub/azure/servicebus/subscription.go 0.00% <0.00%> (ø)
state/postgresql/postgresdbaccess.go 37.05% <0.00%> (-1.56%) ⬇️
...indings/azure/servicebusqueues/servicebusqueues.go 11.59% <14.28%> (+0.89%) ⬆️
pubsub/azure/servicebus/servicebus.go 27.03% <17.77%> (-0.65%) ⬇️
bindings/aws/s3/s3.go 15.00% <20.00%> (+0.43%) ⬆️
pubsub/rabbitmq/rabbitmq.go 56.45% <31.57%> (-1.24%) ⬇️
middleware/http/wasm/basic/basic.go 52.45% <52.45%> (ø)
pubsub/rabbitmq/metadata.go 93.93% <100.00%> (+0.39%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8728f8a...ea7dc91. Read the comment docs.

@berndverst berndverst merged commit 419e296 into dapr:master Jun 13, 2022
@daixiang0 daixiang0 deleted the wasm-v2 branch June 14, 2022 02:00
@berndverst berndverst added this to the v1.8 milestone Jun 21, 2022
@ewassef
Copy link
Contributor

ewassef commented Jun 28, 2022

What is the WASM interface or structure? any guidance here? Also, can this be used with Pub/Sub or just HTTP service invocation?

@codefromthecrypt
Copy link
Contributor

@ewassef sorry about the large delay in responding. I'm just reviewing old issues for the dapr talk at kubecon EU next week.

What is the WASM interface or structure? any guidance here? Also, can this be used with Pub/Sub or just HTTP service invocation?

Since this PR landed, we had requests to make the model more flexible. We wrote a specification and some SDKs for http-wasm, though currently this is only used by dapr (PR for mosn has been paused due to resources)

So, as of v1.10 this feature is more fleshed out and documented and has a sample, also.

About Pub/Sub, the closest we have in progress now is the output binding, which is incomplete, but I plan to help with this after KubeCon EU next week. It is pure WASI, so there's no pre-defined model (basically you interact via stdin or CLI args). You can subscribe to this issue which I think is prematurely closed as we haven't documented or integrated it into dapr, yet.

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.

[Proposal] middleware with WASM
7 participants