This is an automated email from the ASF dual-hosted git repository.
zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git
The following commit(s) were added to refs/heads/master by this push:
new b316705b docs: add ApisixPluginConfig and update examples (#1752)
b316705b is described below
commit b316705b373da02835e095feeaa5fa5f5053920a
Author: Navendu Pottekkat <[email protected]>
AuthorDate: Tue Apr 4 11:09:40 2023 +0530
docs: add ApisixPluginConfig and update examples (#1752)
---
docs/en/latest/concepts/apisix_plugin_config.md | 55 +++++++++++++++++++++++++
docs/en/latest/concepts/apisix_route.md | 34 +++++++++------
docs/en/latest/config.json | 1 +
3 files changed, 77 insertions(+), 13 deletions(-)
diff --git a/docs/en/latest/concepts/apisix_plugin_config.md
b/docs/en/latest/concepts/apisix_plugin_config.md
new file mode 100644
index 00000000..c259410a
--- /dev/null
+++ b/docs/en/latest/concepts/apisix_plugin_config.md
@@ -0,0 +1,55 @@
+---
+title: ApisixPluginConfig
+keywords:
+ - APISIX ingress
+ - Apache APISIX
+ - ApisixPluginConfig
+description: Guide to using ApisixPluginConfig custom Kubernetes resource.
+---
+
+`ApisixPluginConfig` is a Kubernetes CRD that can be used to extract commonly
used Plugins and can be bound directly to multiple Routes.
+
+See
[reference](https://apisix.apache.org/docs/ingress-controller/references/apisix_pluginconfig_v2)
for the full API documentation.
+
+The example below shows how you can configure an `ApisixPluginConfig` resource:
+
+```yaml
+apiVersion: apisix.apache.org/v2
+kind: ApisixPluginConfig
+metadata:
+ name: echo-and-cors-apc
+spec:
+ plugins:
+ - name: echo
+ enable: true
+ config:
+ before_body: "This is the prologue"
+ after_body: "This is the epilogue"
+ headers:
+ X-Foo: v1
+ X-Foo2: v2
+ - name: cors
+ enable: true
+```
+
+You can then configure a Route to use the `echo-and-cors-apc` Plugin
configuration:
+
+```yaml
+apiVersion: apisix.apache.org/v2beta3
+kind: ApisixRoute
+metadata:
+ name: httpbin-route
+spec:
+ http:
+ - name: rule1
+ match:
+ hosts:
+ - httpbin.org
+ paths:
+ - /ip
+ backends:
+ - serviceName: %s
+ servicePort: %d
+ weight: 10
+ plugin_config_name: echo-and-cors-apc
+```
diff --git a/docs/en/latest/concepts/apisix_route.md
b/docs/en/latest/concepts/apisix_route.md
index 5f3232e8..5da39829 100644
--- a/docs/en/latest/concepts/apisix_route.md
+++ b/docs/en/latest/concepts/apisix_route.md
@@ -184,7 +184,7 @@ If the Plugin is not enabled in APISIX by default, you can
enable it by adding i
:::
-The example below configures
[cors](https://apisix.apache.org/docs/apisix/plugins/cors/) Plugin for the
route:
+The example below configures
[limit-count](https://apisix.apache.org/docs/apisix/plugins/limit-count) Plugin
for the route:
```yaml
apiVersion: apisix.apache.org/v2
@@ -193,20 +193,28 @@ metadata:
name: httpbin-route
spec:
http:
- - name: httpbin
- match:
- hosts:
- - local.httpbin.org
- paths:
- - /*
- backends:
- - serviceName: foo
- servicePort: 80
- plugins:
- - name: cors
- enable: true
+ - name: rule1
+ match:
+ hosts:
+ - httpbin.org
+ paths:
+ - /ip
+ backends:
+ - serviceName: %s
+ servicePort: %d
+ weight: 10
+ plugins:
+ - name: limit-count
+ enable: true
+ config:
+ rejected_code: 503
+ count: 2
+ time_window: 3
+ key: remote_addr
```
+You can also use the
[ApisixPluginConfig](https://apisix.apache.org/docs/ingress-controller/concepts/apisix_plugin_config)
CRD to extract and reuse commonly used Plugins and bind them directly to a
Route.
+
### Config with secretRef
Plugins are supported to be configured from kubernetes secret with `secretRef`.
diff --git a/docs/en/latest/config.json b/docs/en/latest/config.json
index 88f190b4..e3075855 100644
--- a/docs/en/latest/config.json
+++ b/docs/en/latest/config.json
@@ -66,6 +66,7 @@
"concepts/apisix_upstream",
"concepts/apisix_tls",
"concepts/apisix_cluster_config",
+ "concepts/apisix_plugin_config",
"concepts/annotations"
]
},