Skip to content

Commit

Permalink
WasmPlugin add VmConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
zirain committed Jan 27, 2022
1 parent b9c4eee commit 2a64590
Show file tree
Hide file tree
Showing 8 changed files with 1,379 additions and 47 deletions.
52 changes: 52 additions & 0 deletions extensions/v1alpha1/wasm.gen.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

922 changes: 884 additions & 38 deletions extensions/v1alpha1/wasm.pb.go

Large diffs are not rendered by default.

123 changes: 122 additions & 1 deletion extensions/v1alpha1/wasm.pb.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions extensions/v1alpha1/wasm.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

syntax = "proto3";

import "google/protobuf/any.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/struct.proto";
import "type/v1beta1/selector.proto";
Expand Down Expand Up @@ -241,6 +242,9 @@ message WasmPlugin {
// value, the ordering will be deterministically derived from name and
// namespace of the `WasmPlugins`. Defaults to `0`.
google.protobuf.Int64Value priority = 10;

// Configuration for finding or starting VM.
VmConfig vm_config = 11;
}

// The phase in the filter chain where the plugin will be injected.
Expand Down Expand Up @@ -280,3 +284,38 @@ enum PullPolicy {
// this plugin.
Always = 2;
}

// Configuration for a Wasm VM.
message VmConfig {
// An ID which will be used along with a hash of the wasm code (or the name of the registered Null
// VM plugin) to determine which VM will be used for the plugin. All plugins which use the same
// *vm_id* and code will use the same VM. May be left blank. Sharing a VM between plugins can
// reduce memory utilization and make sharing of data easier which may have security implications.
string vm_id = 1;

// Optional: The Wasm runtime type (either "v8" or "null" for code compiled into Envoy).
// Default value: `envoy.wasm.runtime.v8`
optional string runtime = 2;

// The Wasm configuration used in initialization of a new VM
// (proxy_on_start). `google.protobuf.Struct` is serialized as JSON before
// passing it to the plugin. `google.protobuf.BytesValue` and
// `google.protobuf.StringValue` are passed directly without the wrapper.
google.protobuf.Any configuration = 3;

// Specifies environment variables to be injected to this VM which will be available through
// WASI's ``environ_get`` and ``environ_get_sizes`` system calls. Note that these functions are mostly implicitly
// called in your language's standard library, so you do not need to call them directly and you can access to env
// vars just like when you do on native platforms.
// Warning: Envoy rejects the configuration if there's conflict of key space.
EnvironmentVariables environment_variables = 4;
}

message EnvironmentVariables {
// The keys of *Envoy's* environment variables exposed to this VM. In other words, if a key exists in Envoy's environment
// variables, then that key-value pair will be injected. Note that if a key does not exist, it will be ignored.
repeated string host_env_keys = 1;

// Explicitly given key-value pairs to be injected to this VM in the form of "KEY=VALUE".
map<string, string> key_values = 2;
}
42 changes: 42 additions & 0 deletions extensions/v1alpha1/wasm_deepcopy.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions extensions/v1alpha1/wasm_json.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions kubernetes/customresourcedefinitions.gen.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2a64590

Please sign in to comment.