mirror of
https://github.com/alibaba/higress.git
synced 2026-03-03 08:00:49 +08:00
adjust wasm plugin doc (#146)
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -70,7 +70,7 @@ content-length: 0
|
||||
## 路由级或域名级生效
|
||||
|
||||
```yaml
|
||||
apiVersion: extensions.istio.io/v1alpha1
|
||||
apiVersion: extensions.higress.io/v1alpha1
|
||||
kind: WasmPlugin
|
||||
metadata:
|
||||
name: request-block
|
||||
@@ -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
|
||||
```
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user