tokers commented on a change in pull request #2935:
URL: https://github.com/apache/apisix/pull/2935#discussion_r548793999



##########
File path: doc/plugins/traffic-split.md
##########
@@ -0,0 +1,409 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+- [中文](../zh-cn/plugins/traffic-split.md)
+
+# Summary
+
+- [**Name**](#name)
+- [**Attributes**](#attributes)
+- [**How To Enable**](#how-to-enable)
+  - [**Grayscale Release**](#grayscale-release)
+  - [**Blue-green Release**](#blue-green-release)
+  - [**Custom Release**](#custom-release)
+- [**Disable Plugin**](#disable-plugin)
+
+## Name
+
+The traffic split plugin allows users to incrementally direct percentages of 
traffic between various upstreams.
+
+Note: The ratio between each upstream may not so accurate since the drawback 
of weighted round robin algorithm (especially when the wrr state is reset).
+
+## Attributes
+
+| Name             | Type    | Requirement | Default | Valid   | Description   
                                                                           |
+| ---------------- | ------- | ----------- | ------- | ------- | 
----------------------------------------------------------------------------------------
 |
+| rules.match      | array[object]  | optional    |         |  | List of 
matching rules.                                                                 
   |
+| rules.match.vars | array[array] | optional    |     |  | A list consisting 
of one or more {var, operator, val} elements, like this: {{var, operator, val}, 
{var, operator, val}, ...}}. For example: {"arg_name", "==", "json"}, which 
means that the current request parameter name is json. The var here is 
consistent with the naming of Nginx internal variables, so request_uri, host, 
etc. can also be used; for the operator part, the currently supported operators 
are ==, ~=, ~~, >, <, in, has and !. For specific usage of operators, please 
see the `operator-list` part of 
[lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list). |
+| rules.weighted_upstreams  | array[object] | optional    |    |         | 
List of upstream configuration rules.                                           
        |
+| rules.weighted_upstreams.upstream_id  | string or integer | optional    |    
     |         | The upstream id is bound to the corresponding upstream(not 
currently supported).            |
+| rules.weighted_upstreams.upstream   | object | optional    |     |      | 
Upstream configuration information.                                             
       |
+| rules.weighted_upstreams.upstream.type | enum | optional    | roundrobin  | 
[roundrobin, chash] | roundrobin supports weighted load, chash consistent 
hashing, the two are alternatives.   |
+| rules.weighted_upstreams.upstream.nodes  | object | optional    |       |  | 
In the hash table, the key of the internal element is the list of upstream 
machine addresses, in the format of address + Port, where the address part can 
be an IP or a domain name, such as 192.168.1.100:80, foo.com:80, etc. value is 
the weight of the node. In particular, when the weight value is 0, it has 
special meaning, which usually means that the upstream node is invalid and 
never wants to be selected. |
+| rules.weighted_upstreams.upstream.timeout  | object | optional    |  15     
|   | Set the timeout period for connecting, sending and receiving messages 
(time unit: second, all default to 15 seconds).  |
+| rules.weighted_upstreams.upstream.pass_host | enum | optional    | "pass"  | 
["pass", "node", "rewrite"]  | pass: pass the host requested by the client, 
node: pass the host requested by the client; use the host configured with the 
upstream node, rewrite: rewrite the host with the value configured by the 
upstream_host. |
+| rules.weighted_upstreams.upstream.name      | string | optional    |        
|   | Identify the upstream service name, usage scenario, etc.  |
+| rules.weighted_upstreams.upstream.upstream_host | string | optional    |    
|   | Only valid when pass_host is configured as rewrite.    |
+| rules.weighted_upstreams.weight | integer | optional    | weight = 1   |  | 
The traffic is divided according to the `weight` value, and the roundrobin 
algorithm is used to divide multiple `weight`. |
+
+The traffic-split plugin is mainly composed of two parts: `match` and 
`weighted_upstreams`. `match` is a custom conditional rule, and 
`weighted_upstreams` is upstream configuration information. If you configure 
`match` and `weighted_upstreams` information, then after the `match` rule is 
verified, it will be based on the `weight` value in `weighted_upstreams`; the 
ratio of traffic between each upstream in the plug-in will be guided, 
otherwise, all traffic will be directly Reach the `upstream` configured on 
`route` or `service`. Of course, you can also configure only the 
`weighted_upstreams` part, which will directly guide the traffic ratio between 
each upstream in the plugin based on the `weight` value in `weighted_upstreams`.
+
+>Note: 1. In `match`, the expression in vars is the relationship of `and`, and 
the relationship between multiple `vars` is the relationship of `or`.  2. There 
is only a `weight` value in the weighted_upstreams of the plug-in, which means 
reaching the upstream traffic weight value configured on `route` or `service`. 
Such as:
+
+```json
+{
+    "weight": 2
+}
+```
+
+## How To Enable
+
+The following provides examples of plugin usage, which will help you 
understand the use of plugin.

Review comment:
       Here you just need to add the necessary steps to enable this plugin.
   
   The `Grayscale`, `BlueGreenVersion` is some features we can implement 
resorting to this plugin, it should't be written inside `How to Enable`, they 
are Best Practices.

##########
File path: doc/plugins/traffic-split.md
##########
@@ -0,0 +1,409 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+- [中文](../zh-cn/plugins/traffic-split.md)
+
+# Summary
+
+- [**Name**](#name)
+- [**Attributes**](#attributes)
+- [**How To Enable**](#how-to-enable)
+  - [**Grayscale Release**](#grayscale-release)
+  - [**Blue-green Release**](#blue-green-release)
+  - [**Custom Release**](#custom-release)
+- [**Disable Plugin**](#disable-plugin)
+
+## Name
+
+The traffic split plugin allows users to incrementally direct percentages of 
traffic between various upstreams.
+
+Note: The ratio between each upstream may not so accurate since the drawback 
of weighted round robin algorithm (especially when the wrr state is reset).
+
+## Attributes
+
+| Name             | Type    | Requirement | Default | Valid   | Description   
                                                                           |
+| ---------------- | ------- | ----------- | ------- | ------- | 
----------------------------------------------------------------------------------------
 |
+| rules.match      | array[object]  | optional    |         |  | List of 
matching rules.                                                                 
   |
+| rules.match.vars | array[array] | optional    |     |  | A list consisting 
of one or more {var, operator, val} elements, like this: {{var, operator, val}, 
{var, operator, val}, ...}}. For example: {"arg_name", "==", "json"}, which 
means that the current request parameter name is json. The var here is 
consistent with the naming of Nginx internal variables, so request_uri, host, 
etc. can also be used; for the operator part, the currently supported operators 
are ==, ~=, ~~, >, <, in, has and !. For specific usage of operators, please 
see the `operator-list` part of 
[lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list). |
+| rules.weighted_upstreams  | array[object] | optional    |    |         | 
List of upstream configuration rules.                                           
        |
+| rules.weighted_upstreams.upstream_id  | string or integer | optional    |    
     |         | The upstream id is bound to the corresponding upstream(not 
currently supported).            |
+| rules.weighted_upstreams.upstream   | object | optional    |     |      | 
Upstream configuration information.                                             
       |
+| rules.weighted_upstreams.upstream.type | enum | optional    | roundrobin  | 
[roundrobin, chash] | roundrobin supports weighted load, chash consistent 
hashing, the two are alternatives.   |
+| rules.weighted_upstreams.upstream.nodes  | object | optional    |       |  | 
In the hash table, the key of the internal element is the list of upstream 
machine addresses, in the format of address + Port, where the address part can 
be an IP or a domain name, such as 192.168.1.100:80, foo.com:80, etc. value is 
the weight of the node. In particular, when the weight value is 0, it has 
special meaning, which usually means that the upstream node is invalid and 
never wants to be selected. |
+| rules.weighted_upstreams.upstream.timeout  | object | optional    |  15     
|   | Set the timeout period for connecting, sending and receiving messages 
(time unit: second, all default to 15 seconds).  |
+| rules.weighted_upstreams.upstream.pass_host | enum | optional    | "pass"  | 
["pass", "node", "rewrite"]  | pass: pass the host requested by the client, 
node: pass the host requested by the client; use the host configured with the 
upstream node, rewrite: rewrite the host with the value configured by the 
upstream_host. |
+| rules.weighted_upstreams.upstream.name      | string | optional    |        
|   | Identify the upstream service name, usage scenario, etc.  |
+| rules.weighted_upstreams.upstream.upstream_host | string | optional    |    
|   | Only valid when pass_host is configured as rewrite.    |
+| rules.weighted_upstreams.weight | integer | optional    | weight = 1   |  | 
The traffic is divided according to the `weight` value, and the roundrobin 
algorithm is used to divide multiple `weight`. |
+
+The traffic-split plugin is mainly composed of two parts: `match` and 
`weighted_upstreams`. `match` is a custom conditional rule, and 
`weighted_upstreams` is upstream configuration information. If you configure 
`match` and `weighted_upstreams` information, then after the `match` rule is 
verified, it will be based on the `weight` value in `weighted_upstreams`; the 
ratio of traffic between each upstream in the plug-in will be guided, 
otherwise, all traffic will be directly Reach the `upstream` configured on 
`route` or `service`. Of course, you can also configure only the 
`weighted_upstreams` part, which will directly guide the traffic ratio between 
each upstream in the plugin based on the `weight` value in `weighted_upstreams`.
+
+>Note: 1. In `match`, the expression in vars is the relationship of `and`, and 
the relationship between multiple `vars` is the relationship of `or`.  2. There 
is only a `weight` value in the weighted_upstreams of the plug-in, which means 
reaching the upstream traffic weight value configured on `route` or `service`. 
Such as:
+
+```json
+{
+    "weight": 2
+}
+```
+
+## How To Enable
+
+The following provides examples of plugin usage, which will help you 
understand the use of plugin.

Review comment:
       Here you just need to add the necessary steps to enable this plugin.
   
   The `Grayscale`, `BlueGreenVersion` is some features we can implement 
resorting to this plugin, it should't be written inside `How to Enable`, they 
are Best Practices.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to