-
Notifications
You must be signed in to change notification settings - Fork 360
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: Wasm extension HTTP code source #3164
Changes from 16 commits
d0cb214
b6cc5a6
64b76a9
d05c8ec
0b47909
164f6d8
67977a3
880d436
59ff9a2
6f5a419
4ba3921
c48eadc
0c4400c
0369f4f
e82e79b
3b9510b
67baf73
416eeb9
20038ab
6a4942e
bfb649d
6086333
cb2b993
8d536ba
a13e258
0c52d50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,14 +31,16 @@ type Wasm struct { | |
// RootID is a unique ID for a set of extensions in a VM which will share a | ||
// RootContext and Contexts if applicable (e.g., an Wasm HttpFilter and an Wasm AccessLog). | ||
// If left blank, all extensions with a blank root_id with the same vm_id will share Context(s). | ||
// RootID *string `json:"rootID,omitempty"` | ||
// RootID must match the root_id parameter used to register the Context in the Wasm code. | ||
RootID *string `json:"rootID,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. RootID is needed and it can't be generated by EG. See: https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/blob/921039ae983ce053bf5cba78a85a3c08ff9791e5/proxy_wasm_intrinsics.cc#L27-L28 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why can't we reuse There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In theory, yes,
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we can generate this field internally, using name, my vote is to do that and not expose another field the user needs to think about how to populate There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't generate And it can be optional if the wasm source code leaves it empty. |
||
|
||
// Code is the wasm code for the extension. | ||
Code WasmCodeSource `json:"code"` | ||
|
||
// Config is the configuration for the Wasm extension. | ||
// This configuration will be passed as a JSON string to the Wasm extension. | ||
Config *apiextensionsv1.JSON `json:"config"` | ||
// +optional | ||
Config *apiextensionsv1.JSON `json:"config,omitempty"` | ||
|
||
// FailOpen is a switch used to control the behavior when a fatal error occurs | ||
// during the initialization or the execution of the Wasm extension. | ||
|
@@ -61,7 +63,7 @@ type WasmCodeSource struct { | |
// Type is the type of the source of the wasm code. | ||
// Valid WasmCodeSourceType values are "HTTP" or "Image". | ||
// | ||
// +kubebuilder:validation:Enum=HTTP;Image | ||
// +kubebuilder:validation:Enum=HTTP;Image;ConfigMap | ||
// +unionDiscriminator | ||
Type WasmCodeSourceType `json:"type"` | ||
|
||
|
@@ -78,8 +80,9 @@ type WasmCodeSource struct { | |
Image *ImageWasmCodeSource `json:"image,omitempty"` | ||
|
||
// SHA256 checksum that will be used to verify the wasm code. | ||
// +optional | ||
// SHA256 *string `json:"sha256,omitempty"` | ||
// | ||
// kubebuilder:validation:Pattern=`^[a-f0-9]{64}$` | ||
SHA256 string `json:"sha256"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make SHA256 mandatory for now to avoid downloading wasm and calculate SHA in the control plane. We can make it optional without breaking changes if we opt to build a cache in the control plane in the future. |
||
} | ||
|
||
// WasmCodeSourceType specifies the types of sources for the wasm code. | ||
|
@@ -92,6 +95,9 @@ const ( | |
|
||
// ImageWasmCodeSourceType allows the user to specify the wasm code in an OCI image. | ||
ImageWasmCodeSourceType WasmCodeSourceType = "Image" | ||
|
||
// ConfigMapCodeSourceType allows the user to specify the wasm code in a ConfigMap. | ||
zhaohuabing marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ConfigMapWasmCodeSourceType WasmCodeSourceType = "ConfigMap" | ||
) | ||
|
||
// HTTPWasmCodeSource defines the HTTP URL containing the wasm code. | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pascal case semantics ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following the name convention here:https://webassembly.org/