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



##########
File path: doc/zh-cn/plugins/traffic-split.md
##########
@@ -0,0 +1,413 @@
+<!--
+#
+# 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.
+#
+-->
+
+- [English](../../plugins/traffic-split.md)
+
+# 目录
+
+- [名字](#名字)
+- [属性](#属性)
+- [如何启用](#如何启用)
+  - [灰度发布](#灰度发布)
+  - [蓝绿发布](#蓝绿发布)
+  - [自定义发布](#自定义发布)
+- [测试插件](#测试插件)
+  - [灰度测试](#灰度测试)
+  - [蓝绿测试](#蓝绿测试)
+  - [自定义测试](#自定义测试)
+- [禁用插件](#禁用插件)
+
+## 名字
+
+请求流量分割插件,对流量按指定的比例划分,并将其分流到对应的 upstream ;通过该插件可以实现灰度发布、蓝绿发布和自定义发布功能。
+
+注:由于插件中选择不同上游是根据 roundrobin 算法选择,因此存在算法状态重置的情况下,会对流量分配的比率并不完全精准。
+
+## 属性
+
+| 参数名        | 类型          | 可选项 | 默认值 | 有效值 | 描述                 |
+| ------------ | ------------- | ------ | ------ | ------ | 
-------------------- |
+| rules.match | array[object] | 可选  |        |        | 匹配规则列表  |
+| rules.match.vars | array[array]   | 可选   |        |        | 由一个或多个{var, 
operator, val}元素组成的列表,类似这样:{{var, operator, val}, {var, operator, val}, 
...}}。例如:{"arg_name", "==", "json"},表示当前请求参数 name 是 json。这里的 var 与 Nginx 
内部自身变量命名是保持一致,所以也可以使用 request_uri、host 等;对于 operator 部分,目前已支持的运算符有 
==、~=、~~、>、<、in、has 和 ! 。操作符的具体用法请看 
[lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list) 的 
`operator-list` 部分。 |
+| rules.weighted_upstreams    | array[object] | 可选   |        |        | 
上游配置规则列表。 |
+| rules.weighted_upstreams.upstream_id  | string or integer | 可选   |        |  
      | 通过上游 id 绑定对应上游(暂不支持)。 |
+| rules.weighted_upstreams.upstream     | object | 可选   |        |        | 
上游配置信息。 |
+| rules.weighted_upstreams.upstream.type | enum | 可选   |   roundrobin |  
[roundrobin, chash]      | roundrobin 支持权重的负载,chash 一致性哈希,两者是二选一的(目前只支持 
`roundrobin`)。 |
+| rules.weighted_upstreams.upstream.nodes | object | 可选   |        |        | 
哈希表,内部元素的 key 是上游机器地址 列表,格式为地址 + Port,其中地址部 分可以是 IP 也可以是域名,⽐如 
192.168.1.100:80、foo.com:80等。 value 则是节点的权重,特别的,当权重 值为 0 有特殊含义,通常代表该上游节点 
失效,永远不希望被选中。 |
+| rules.weighted_upstreams.upstream.timeout | object | 可选   |  15     |        
| 设置连接、发送消息、接收消息的超时时间(时间单位:秒,都默认为 15 秒)。 |
+| rules.weighted_upstreams.upstream.pass_host  | enum | 可选   | "pass"   | 
["pass", "node", "rewrite"]  | pass: 透传客户端请求的 host, node: 不透传客户端请求的 host; 使用 
upstream node 配置的 host, rewrite: 使用 upstream_host 配置的值重写 host 。 |
+| rules.weighted_upstreams.upstream.name  | string | 可选   |        |  | 
标识上游服务名称、使⽤场景等。 |
+| rules.weighted_upstreams.upstream.upstream_host | string | 可选   |        |   
     | 只在 pass_host 配置为 rewrite 时有效。 |
+| rules.weighted_upstreams.weight       | integer | 可选   |   weight = 1     |  
      | 根据 `weight` 值做流量划分,多个 weight 之间使用 roundrobin 算法划分。|
+
+## 如何启用
+
+在插件的 weighted_upstreams 中只有 `weight` 值,表示到达默认 `route` 上的 upstream 流量权重值。
+
+```json
+{
+    "weight": 2
+}
+```
+

Review comment:
       updated.




----------------------------------------------------------------
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