mirror of
https://github.com/alibaba/higress.git
synced 2026-06-09 04:37:31 +08:00
adjust wasm plugin doc (#146)
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
例如用如下配置使用 request-block 插件 的 1.0.0 版本:
|
例如用如下配置使用 request-block 插件 的 1.0.0 版本:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: extensions.istio.io/v1alpha1
|
apiVersion: extensions.higress.io/v1alpha1
|
||||||
kind: WasmPlugin
|
kind: WasmPlugin
|
||||||
metadata:
|
metadata:
|
||||||
name: request-block
|
name: request-block
|
||||||
@@ -36,7 +36,7 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
higress: higress-system-higress-gateway
|
higress: higress-system-higress-gateway
|
||||||
pluginConfig:
|
defaultConfig:
|
||||||
block_urls:
|
block_urls:
|
||||||
- "swagger.html"
|
- "swagger.html"
|
||||||
url: oci://higress-registry.cn-hangzhou.cr.aliyuncs.com/plugins/request-block:1.0.0
|
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 资源
|
### step3. 创建 WasmPlugin 资源
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: extensions.istio.io/v1alpha1
|
apiVersion: extensions.higress.io/v1alpha1
|
||||||
kind: WasmPlugin
|
kind: WasmPlugin
|
||||||
metadata:
|
metadata:
|
||||||
name: request-block
|
name: request-block
|
||||||
@@ -43,7 +43,7 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
higress: higress-system-higress-gateway
|
higress: higress-system-higress-gateway
|
||||||
pluginConfig:
|
defaultConfig:
|
||||||
block_urls:
|
block_urls:
|
||||||
- "swagger.html"
|
- "swagger.html"
|
||||||
url: oci://<your_registry_hub>/request-block:1.0.0
|
url: oci://<your_registry_hub>/request-block:1.0.0
|
||||||
@@ -70,7 +70,7 @@ content-length: 0
|
|||||||
## 路由级或域名级生效
|
## 路由级或域名级生效
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: extensions.istio.io/v1alpha1
|
apiVersion: extensions.higress.io/v1alpha1
|
||||||
kind: WasmPlugin
|
kind: WasmPlugin
|
||||||
metadata:
|
metadata:
|
||||||
name: request-block
|
name: request-block
|
||||||
@@ -79,29 +79,32 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
higress: higress-system-higress-gateway
|
higress: higress-system-higress-gateway
|
||||||
pluginConfig:
|
defaultConfig:
|
||||||
# 跟上面例子一样,这个配置会全局生效,但如果被下面规则匹配到,则会改为执行命中规则的配置
|
# 跟上面例子一样,这个配置会全局生效,但如果被下面规则匹配到,则会改为执行命中规则的配置
|
||||||
block_urls:
|
block_urls:
|
||||||
- "swagger.html"
|
- "swagger.html"
|
||||||
_rules_:
|
matchRules:
|
||||||
# 路由级生效配置
|
# 路由级生效配置
|
||||||
- _match_route_:
|
- ingress:
|
||||||
- default/foo
|
- default/foo
|
||||||
# default 命名空间下名为 foo 的 ingress 会执行下面这个配置
|
# default 命名空间下名为 foo 的 ingress 会执行下面这个配置
|
||||||
block_bodys:
|
config:
|
||||||
- "foo"
|
block_bodys:
|
||||||
- _match_route_:
|
- "foo"
|
||||||
- default/bar
|
- ingress:
|
||||||
# default 命名空间下名为 bar 的 ingress 会执行下面这个配置
|
- default/bar
|
||||||
block_bodys:
|
# default 命名空间下名为 bar 的 ingress 会执行下面这个配置
|
||||||
- "bar"
|
config:
|
||||||
|
block_bodys:
|
||||||
|
- "bar"
|
||||||
# 域名级生效配置
|
# 域名级生效配置
|
||||||
- _match_domain_:
|
- domain:
|
||||||
- "*.example.com"
|
- "*.example.com"
|
||||||
# 若请求匹配了上面的域名, 会执行下面这个配置
|
# 若请求匹配了上面的域名, 会执行下面这个配置
|
||||||
block_bodys:
|
config:
|
||||||
- "foo"
|
block_bodys:
|
||||||
- "bar"
|
- "foo"
|
||||||
|
- "bar"
|
||||||
url: oci://<your_registry_hub>/request-block:1.0.0
|
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.
|
Read this [document](https://istio.io/latest/docs/reference/config/proxy_extensions/wasm-plugin/) to learn more about wasmplugin.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: extensions.istio.io/v1alpha1
|
apiVersion: extensions.higress.io/v1alpha1
|
||||||
kind: WasmPlugin
|
kind: WasmPlugin
|
||||||
metadata:
|
metadata:
|
||||||
name: request-block
|
name: request-block
|
||||||
@@ -42,7 +42,7 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
higress: higress-system-higress-gateway
|
higress: higress-system-higress-gateway
|
||||||
pluginConfig:
|
defaultConfig:
|
||||||
block_urls:
|
block_urls:
|
||||||
- "swagger.html"
|
- "swagger.html"
|
||||||
url: oci://<your_registry_hub>/request-block:1.0.0
|
url: oci://<your_registry_hub>/request-block:1.0.0
|
||||||
@@ -64,7 +64,7 @@ content-length: 0
|
|||||||
## route-level & domain-level takes effect
|
## route-level & domain-level takes effect
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: extensions.istio.io/v1alpha1
|
apiVersion: extensions.higress.io/v1alpha1
|
||||||
kind: WasmPlugin
|
kind: WasmPlugin
|
||||||
metadata:
|
metadata:
|
||||||
name: request-block
|
name: request-block
|
||||||
@@ -73,29 +73,32 @@ spec:
|
|||||||
selector:
|
selector:
|
||||||
matchLabels:
|
matchLabels:
|
||||||
higress: higress-system-higress-gateway
|
higress: higress-system-higress-gateway
|
||||||
pluginConfig:
|
defaultConfig:
|
||||||
# this config will take effect globally (all incoming requests not matched by rules below)
|
# this config will take effect globally (all incoming requests not matched by rules below)
|
||||||
block_urls:
|
block_urls:
|
||||||
- "swagger.html"
|
- "swagger.html"
|
||||||
_rules_:
|
matchRules:
|
||||||
# route-level takes effect
|
# ingress-level takes effect
|
||||||
- _match_route_:
|
- ingress:
|
||||||
- default/foo
|
- default/foo
|
||||||
# the ingress foo in namespace default will use this config
|
# the ingress foo in namespace default will use this config
|
||||||
block_bodys:
|
config:
|
||||||
- "foo"
|
block_bodys:
|
||||||
- _match_route_:
|
- "foo"
|
||||||
- default/bar
|
- ingress:
|
||||||
# the ingress bar in namespace default will use this config
|
- default/bar
|
||||||
block_bodys:
|
# the ingress bar in namespace default will use this config
|
||||||
- "bar"
|
config:
|
||||||
# domain-level takes effect
|
block_bodys:
|
||||||
- _match_domain_:
|
- "bar"
|
||||||
- "*.example.com"
|
# domain-level takes effect
|
||||||
# if the request's domain matched, this config will be used
|
- domain:
|
||||||
block_bodys:
|
- "*.example.com"
|
||||||
- "foo"
|
# if the request's domain matched, this config will be used
|
||||||
- "bar"
|
config:
|
||||||
|
block_bodys:
|
||||||
|
- "foo"
|
||||||
|
- "bar"
|
||||||
url: oci://<your_registry_hub>/request-block:1.0.0
|
url: oci://<your_registry_hub>/request-block:1.0.0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user