This repository has been archived by the owner on Oct 22, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin): add
proxywasm
plugin (#284)
* feat(plugin): add `proxywasm` plugin 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, Envoy, Nginx with ngx_wasm_module from Kong and Istio. Fixes #145
- Loading branch information
Showing
57 changed files
with
2,164 additions
and
2,891 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
sablier.yaml | ||
./plugins/traefik/e2e/kubeconfig.yaml | ||
node_modules | ||
.DS_Store | ||
.DS_Store | ||
*.wasm | ||
kubeconfig.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
linters: | ||
enable: | ||
- dupword # Checks for duplicate words in the source code. | ||
- goimports | ||
- gosec | ||
- gosimple | ||
- govet | ||
- importas | ||
- ineffassign | ||
- misspell | ||
- revive | ||
- staticcheck | ||
- typecheck | ||
- unconvert | ||
- unused |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Apache APISIX Plugin | ||
|
||
The Apache APISIX Plugin is a WASM Plugin written with the Proxy Wasm SDK. | ||
|
||
## Provider compatibility grid | ||
|
||
| Provider | Dynamic | Blocking | | ||
|-----------------------------------------|:-------:|:--------:| | ||
| [Docker](/providers/docker) | ✅ | ✅ | | ||
| [Docker Swarm](/providers/docker_swarm) | ❓ | ❓ | | ||
| [Kubernetes](/providers/kubernetes) | ❓ | ❓ | | ||
|
||
## Install the plugin to Apache APISIX | ||
|
||
```yaml | ||
wasm: | ||
plugins: | ||
- name: proxywasm_sablier_plugin | ||
priority: 7997 | ||
file: /wasm/sablierproxywasm.wasm # Downloaded WASM Filter path | ||
``` | ||
## Configuration | ||
You can have the following configuration: | ||
```yaml | ||
routes: | ||
- uri: "/" | ||
plugins: | ||
proxywasm_sablier_plugin: | ||
conf: '{ "sablier_url": "sablier:10000", "group": ["my-group"], "session_duration": "1m", "dynamic": { "display_name": "Dynamic Whoami" } }' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Envoy Plugin | ||
|
||
The Envoy Plugin is a WASM Plugin written with the Proxy Wasm SDK. | ||
|
||
## Provider compatibility grid | ||
|
||
| Provider | Dynamic | Blocking | | ||
|-----------------------------------------|:-------:|:--------:| | ||
| [Docker](/providers/docker) | ✅ | ✅ | | ||
| [Docker Swarm](/providers/docker_swarm) | ❓ | ❓ | | ||
| [Kubernetes](/providers/kubernetes) | ❓ | ❓ | | ||
|
||
## Configuration | ||
|
||
You can have the following configuration: | ||
|
||
```yaml | ||
http_filters: | ||
- name: sablier-wasm-whoami-dynamic | ||
disabled: true | ||
typed_config: | ||
"@type": type.googleapis.com/udpa.type.v1.TypedStruct | ||
type_url: type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm | ||
value: | ||
config: | ||
name: "sablier-wasm-whoami-dynamic" | ||
root_id: "sablier-wasm-whoami-dynamic" | ||
configuration: | ||
"@type": "type.googleapis.com/google.protobuf.StringValue" | ||
value: | | ||
{ | ||
"sablier_url": "sablier:10000", | ||
"cluster": "sablier", | ||
"names": ["docker_classic_e2e-whoami-1"], | ||
"session_duration": "1m", | ||
"dynamic": { | ||
"display_name": "Dynamic Whoami", | ||
"theme": "hacker-terminal" | ||
} | ||
} | ||
vm_config: | ||
runtime: "envoy.wasm.runtime.v8" | ||
vm_id: "vm.sablier.sablier-wasm-whoami-dynamic" | ||
code: | ||
local: | ||
filename: "/etc/sablierproxywasm.wasm" | ||
configuration: { } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Istio Plugin | ||
|
||
The Istio Plugin is a WASM Plugin written with the Proxy Wasm SDK. | ||
|
||
## Provider compatibility grid | ||
|
||
| Provider | Dynamic | Blocking | | ||
|-----------------------------------------|:-------:|:--------:| | ||
| [Docker](/providers/docker) | ❌ | ❌ | | ||
| [Docker Swarm](/providers/docker_swarm) | ❌ | ❌ | | ||
| [Kubernetes](/providers/kubernetes) | ✅ | ✅ | | ||
|
||
## Configuration | ||
|
||
You can have the following configuration: | ||
|
||
!> This only works for ingress gateways. | ||
!> Attaching this filter to a side-car would not work because the side-car itself gets shutdown on scaling to zero. | ||
|
||
```yaml | ||
apiVersion: extensions.istio.io/v1alpha1 | ||
kind: WasmPlugin | ||
metadata: | ||
name: sablier-wasm-whoami-dynamic | ||
namespace: istio-system | ||
spec: | ||
selector: | ||
matchLabels: | ||
istio: ingressgateway | ||
url: file:///opt/filters/sablierproxywasm.wasm/..data/sablierproxywasm.wasm | ||
# Use https://istio.io/latest/docs/reference/config/proxy_extensions/wasm-plugin/#WasmPlugin-TrafficSelector | ||
# To specify which service to apply this filter only | ||
phase: UNSPECIFIED_PHASE | ||
pluginConfig: | ||
{ | ||
"sablier_url": "sablier.sablier-system.svc.cluster.local", | ||
"cluster": "outbound|10000||sablier.sablier-system.svc.cluster.local", | ||
"names": [ "deployment_default_whoami_1" ], | ||
"session_duration": "1m", | ||
"dynamic": { | ||
"display_name": "Dynamic Whoami", | ||
"theme": "hacker-terminal" | ||
} | ||
} | ||
``` |
Oops, something went wrong.