Skip to content

Commit

Permalink
adjust wasm plugin doc (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlanni committed Jan 28, 2023
1 parent 059f4c6 commit 4cd7975
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 45 deletions.
4 changes: 2 additions & 2 deletions plugins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
例如用如下配置使用 request-block 插件 的 1.0.0 版本:

```yaml
apiVersion: extensions.istio.io/v1alpha1
apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
name: request-block
Expand All @@ -36,7 +36,7 @@ spec:
selector:
matchLabels:
higress: higress-system-higress-gateway
pluginConfig:
defaultConfig:
block_urls:
- "swagger.html"
url: oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/request-block:1.0.0
Expand Down
43 changes: 23 additions & 20 deletions plugins/wasm-go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ docker push <your_registry_hub>/request-block:1.0.0
### step3. 创建 WasmPlugin 资源

```yaml
apiVersion: extensions.istio.io/v1alpha1
apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
name: request-block
Expand All @@ -43,7 +43,7 @@ spec:
selector:
matchLabels:
higress: higress-system-higress-gateway
pluginConfig:
defaultConfig:
block_urls:
- "swagger.html"
url: oci://<your_registry_hub>/request-block:1.0.0
Expand All @@ -70,7 +70,7 @@ content-length: 0
## 路由级或域名级生效

```yaml
apiVersion: extensions.istio.io/v1alpha1
apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
name: request-block
Expand All @@ -79,29 +79,32 @@ spec:
selector:
matchLabels:
higress: higress-system-higress-gateway
pluginConfig:
defaultConfig:
# 跟上面例子一样,这个配置会全局生效,但如果被下面规则匹配到,则会改为执行命中规则的配置
block_urls:
- "swagger.html"
_rules_:
matchRules:
# 路由级生效配置
- _match_route_:
- default/foo
- ingress:
- default/foo
# default 命名空间下名为 foo 的 ingress 会执行下面这个配置
block_bodys:
- "foo"
- _match_route_:
- default/bar
# default 命名空间下名为 bar 的 ingress 会执行下面这个配置
block_bodys:
- "bar"
config:
block_bodys:
- "foo"
- ingress:
- default/bar
# default 命名空间下名为 bar 的 ingress 会执行下面这个配置
config:
block_bodys:
- "bar"
# 域名级生效配置
- _match_domain_:
- "*.example.com"
# 若请求匹配了上面的域名, 会执行下面这个配置
block_bodys:
- "foo"
- "bar"
- domain:
- "*.example.com"
# 若请求匹配了上面的域名, 会执行下面这个配置
config:
block_bodys:
- "foo"
- "bar"
url: oci://<your_registry_hub>/request-block:1.0.0
```

Expand Down
49 changes: 26 additions & 23 deletions plugins/wasm-go/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ docker push <your_registry_hub>/request-block:1.0.0
Read this [document](https://istio.io/latest/docs/reference/config/proxy_extensions/wasm-plugin/) to learn more about wasmplugin.

```yaml
apiVersion: extensions.istio.io/v1alpha1
apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
name: request-block
Expand All @@ -42,7 +42,7 @@ spec:
selector:
matchLabels:
higress: higress-system-higress-gateway
pluginConfig:
defaultConfig:
block_urls:
- "swagger.html"
url: oci://<your_registry_hub>/request-block:1.0.0
Expand All @@ -64,7 +64,7 @@ content-length: 0
## route-level & domain-level takes effect

```yaml
apiVersion: extensions.istio.io/v1alpha1
apiVersion: extensions.higress.io/v1alpha1
kind: WasmPlugin
metadata:
name: request-block
Expand All @@ -73,29 +73,32 @@ spec:
selector:
matchLabels:
higress: higress-system-higress-gateway
pluginConfig:
defaultConfig:
# this config will take effect globally (all incoming requests not matched by rules below)
block_urls:
- "swagger.html"
_rules_:
# route-level takes effect
- _match_route_:
- default/foo
# the ingress foo in namespace default will use this config
block_bodys:
- "foo"
- _match_route_:
- default/bar
# the ingress bar in namespace default will use this config
block_bodys:
- "bar"
# domain-level takes effect
- _match_domain_:
- "*.example.com"
# if the request's domain matched, this config will be used
block_bodys:
- "foo"
- "bar"
matchRules:
# ingress-level takes effect
- ingress:
- default/foo
# the ingress foo in namespace default will use this config
config:
block_bodys:
- "foo"
- ingress:
- default/bar
# the ingress bar in namespace default will use this config
config:
block_bodys:
- "bar"
# domain-level takes effect
- domain:
- "*.example.com"
# if the request's domain matched, this config will be used
config:
block_bodys:
- "foo"
- "bar"
url: oci://<your_registry_hub>/request-block:1.0.0
```

Expand Down

0 comments on commit 4cd7975

Please sign in to comment.