This repository was archived by the owner on Feb 22, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR extends the
req
API to take a second, optional parameter. This parameter contains some tuning values such as:These settings are stored into a dedicates Struct which is modeled after what reqwest uses. The struct is controller by the Wasm client (this makes it possible to have a client specify its own identity, instead of having all the outgoing request from the host to use the same identity).
The request configuration is serialized to MsgPack by the Wasm guest, and is then deserialized by the Wasm host.
Currently only the Rust guest code has been extended to handle this serialization. The AssemblyScript code needs to be written. I can do that, but I would like to gather your feedback before doing that.
BTW, I picked MsgPack because we can reuse the waPC libraries made available for different programming languages to serialize structures into MsgPack.
Why did I do that?
During the holidays I played a bit with Wagi. I tried to interact with the Kubernetes API from within a Wasm module. To do that I used this crate to perform my requests.
As you probably know, the Kubernetes API server is exposed over a TLS endpoint that is often secured by a self-signed certificate.
Moreover, the client authentication can work in two ways: either through a token sent inside of the request headers or via client certificates. Obviously I wanted to use the client certificates, which was not doable before this PR.
The final outcome, which deserves a blog post on its own, works pretty well. I implemented a webhook endpoint using Wagi + Rust modules using this crate that can trigger actions inside of a Kubernetes cluster 😎
I had to make some small changes to Wagi too, I'll create a PR once I know if you're interested in this feature :)