[apisix] branch master updated (18909a2 -> ea1ac0f)

2021-02-19 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 18909a2  feat: allow disabling search option in resolv.conf (#3609)
 add ea1ac0f  test: ensure all plugins have unique priority (#3582)

No new revisions were added by this update.

Summary of changes:
 t/plugin/plugin.t| 25 +
 t/stream-plugin/plugin.t | 24 
 2 files changed, 49 insertions(+)



[apisix] branch master updated: feat: allow disabling search option in resolv.conf (#3609)

2021-02-19 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 18909a2  feat: allow disabling search option in resolv.conf (#3609)
18909a2 is described below

commit 18909a2a0bf62fd5dc5e1dbcc59ef563545ff359
Author: 罗泽轩 
AuthorDate: Sat Feb 20 15:38:45 2021 +0800

feat: allow disabling search option in resolv.conf (#3609)

Also disable it in the test to avoid occassional DNS query timeout.
---
 apisix/core/utils.lua|  7 +++
 conf/config-default.yaml |  1 +
 t/APISIX.pm  |  1 +
 t/core/utils.t   | 28 
 4 files changed, 37 insertions(+)

diff --git a/apisix/core/utils.lua b/apisix/core/utils.lua
index 788f3e2..f302790 100644
--- a/apisix/core/utils.lua
+++ b/apisix/core/utils.lua
@@ -88,6 +88,8 @@ local function dns_parse(domain)
 if dns_resolvers ~= current_inited_resolvers then
 local local_conf = config_local.local_conf()
 local valid = table.try_read_attr(local_conf, "apisix", 
"dns_resolver_valid")
+local enable_resolv_search_opt = table.try_read_attr(local_conf, 
"apisix",
+ 
"enable_resolv_search_opt")
 
 local opts = {
 ipv6 = true,
@@ -97,6 +99,11 @@ local function dns_parse(domain)
 order = {"last", "A", "", "CNAME"}, -- avoid querying SRV (we 
don't support it yet)
 validTtl = valid,
 }
+
+if not enable_resolv_search_opt then
+opts.search = {}
+end
+
 local ok, err = dns_client.init(opts)
 if not ok then
 return nil, "failed to init the dns client: " .. err
diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index 885007d..14b5168 100644
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -110,6 +110,7 @@ apisix:
   #  - 8.8.8.8
   # dns_resolver_valid: 30# if given, override the TTL of the valid 
records. The unit is second.
   resolver_timeout: 5 # resolver timeout
+  enable_resolv_search_opt: true  # enable search option in resolv.conf
   ssl:
 enable: true
 enable_http2: true
diff --git a/t/APISIX.pm b/t/APISIX.pm
index 618443b..d5880cb 100644
--- a/t/APISIX.pm
+++ b/t/APISIX.pm
@@ -93,6 +93,7 @@ apisix:
 tcp:
   - 9100
   admin_key: null
+  enable_resolv_search_opt: false
 _EOC_
 
 my $etcd_enable_auth = $ENV{"ETCD_ENABLE_AUTH"} || "false";
diff --git a/t/core/utils.t b/t/core/utils.t
index 42cba26..0e0b8ee 100644
--- a/t/core/utils.t
+++ b/t/core/utils.t
@@ -271,6 +271,10 @@ ip_info: 
{"address":"127.0.0.1","class":1,"name":"test.com","ttl":31536,"typ
 
 
 === TEST 8: search host with '.org' suffix
+--- yaml_config
+apisix:
+  node_listen: 1984
+  enable_resolv_search_opt: true
 --- config
 location /t {
 content_by_lua_block {
@@ -289,3 +293,27 @@ GET /t
 .+"name":"apisix\.apache\.org".+
 --- no_error_log
 [error]
+
+
+
+=== TEST 9: disable search option
+--- yaml_config
+apisix:
+  node_listen: 1984
+  enable_resolv_search_opt: false
+--- config
+location /t {
+content_by_lua_block {
+local core = require("apisix.core")
+local ip_info, err = core.utils.dns_parse("apisix")
+if not ip_info then
+core.log.error("failed to parse domain: ", host, ", error: 
",err)
+return
+end
+ngx.say("ip_info: ", require("toolkit.json").encode(ip_info))
+}
+}
+--- request
+GET /t
+--- error_log
+error: failed to query the DNS server



[apisix-dashboard] branch docs-main-image created (now f26643a)

2021-02-13 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch docs-main-image
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git.


  at f26643a  docs: update architecture diagram.

This branch includes the following new commits:

 new f26643a  docs: update architecture diagram.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[apisix-dashboard] 01/01: docs: update architecture diagram.

2021-02-13 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch docs-main-image
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git

commit f26643a46f21b6e9e7db9c212800849c91daba14
Author: Yuansheng 
AuthorDate: Sun Feb 14 11:01:58 2021 +0800

docs: update architecture diagram.
---
 docs/images/architecture.png | Bin 162681 -> 386018 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/docs/images/architecture.png b/docs/images/architecture.png
index 2fee176..d73ab53 100644
Binary files a/docs/images/architecture.png and b/docs/images/architecture.png 
differ



[apisix] branch master updated (fcc1630 -> 7bdb05a)

2021-02-10 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from fcc1630  docs: update README (#3580)
 add 7bdb05a  test: add fuzzing on apisix dp (#3525)

No new revisions were added by this update.

Summary of changes:
 .github/workflows/fuzzing-ci.yaml  | 61 +++
 t/fuzzing/public.py| 45 +++
 t/fuzzing/route_test.py| 88 ++
 .../server/conf => t/fuzzing/upstream}/nginx.conf  | 32 +---
 4 files changed, 215 insertions(+), 11 deletions(-)
 create mode 100644 .github/workflows/fuzzing-ci.yaml
 create mode 100644 t/fuzzing/public.py
 create mode 100644 t/fuzzing/route_test.py
 copy {benchmark/server/conf => t/fuzzing/upstream}/nginx.conf (68%)



[apisix] branch master updated: docs: update README (#3580)

2021-02-10 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new fcc1630  docs: update README (#3580)
fcc1630 is described below

commit fcc1630094831beae6b211cb6ad3dc1da97e8dc0
Author: idbeta 
AuthorDate: Thu Feb 11 14:05:05 2021 +0800

docs: update README (#3580)

Since from version 2.3, Apache APISIX needs to be installed OpenSSL develop 
library first to start.
---
 README.md| 2 +-
 README_CN.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 943f7a5..ba2f3bc 100644
--- a/README.md
+++ b/README.md
@@ -186,7 +186,7 @@ There are several ways to install the Apache Release 
version of APISIX:
The Docker image does not include `etcd`, you can refer to [docker compose 
example](https://github.com/apache/apisix-docker/tree/master/example) to start 
a test cluster.
 
 3. RPM package(only for CentOS 7)
-   - Installation runtime dependencies: OpenResty and etcd, refer to [install 
dependencies documentation](doc/install-dependencies.md#centos-7)
+   - Installation runtime dependencies: OpenResty, etcd and OpenSSL develop 
library, refer to [install dependencies 
documentation](doc/install-dependencies.md#centos-7)
- install APISIX:
 
```shell
diff --git a/README_CN.md b/README_CN.md
index 5a0b021..18e69d5 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -184,7 +184,7 @@ CentOS 7, Ubuntu 16.04, Ubuntu 18.04, Debian 9, Debian 10, 
macOS, **ARM64** Ubun
Docker 镜像中并不包含 etcd,你可以参考 [docker compose 
的示例](https://github.com/apache/apisix-docker/tree/master/example)来启动一个测试集群。
 
 3. RPM 包(只适用于 CentOS 7)
-   - 安装依赖:OpenResty 和 
etcd,参考[依赖安装文档](doc/zh-cn/install-dependencies.md#centos-7)
+   - 安装依赖:OpenResty, etcd 和 OpenSSL develop 
library,参考[依赖安装文档](doc/zh-cn/install-dependencies.md#centos-7)
- 安装 APISIX:
 
```shell



[apisix] branch master updated: docs: fix grammar (#3539)

2021-02-06 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new e5cd46e  docs: fix grammar (#3539)
e5cd46e is described below

commit e5cd46e38e09d1025817381a3bf0b85a4f02a528
Author: John Bampton 
AuthorDate: Sun Feb 7 00:55:48 2021 +1000

docs: fix grammar (#3539)
---
 apisix/plugins/tcp-logger.lua | 2 +-
 doc/architecture-design.md| 2 +-
 doc/plugins/authz-keycloak.md | 2 +-
 doc/plugins/echo.md   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/apisix/plugins/tcp-logger.lua b/apisix/plugins/tcp-logger.lua
index 66e8e2f..dc4cb21 100644
--- a/apisix/plugins/tcp-logger.lua
+++ b/apisix/plugins/tcp-logger.lua
@@ -79,7 +79,7 @@ local function send_tcp_data(conf, log_message)
 if conf.tls then
 ok, err = sock:sslhandshake(true, conf.tls_options, false)
 if not ok then
-return false, "failed to to perform TLS handshake to TCP server: 
host["
+return false, "failed to perform TLS handshake to TCP server: 
host["
   .. conf.host .. "] port[" .. tostring(conf.port) .. 
"] err: " .. err
 end
 end
diff --git a/doc/architecture-design.md b/doc/architecture-design.md
index 1edc311..fca94b1 100644
--- a/doc/architecture-design.md
+++ b/doc/architecture-design.md
@@ -81,7 +81,7 @@ The following image shows an example of some Route rules. 
When some attribute va
 
 
 
-We configure all the parameters directly in the Route, it's easy to set up, 
and each Route has a relatively high degree of freedom. But when our Route has 
more repetitive configurations (such as enabling the same plugin configuration 
or upstream information), once we need update these same properties, we have to 
traverse all the Routes and modify them, so it adding a lot of complexity of 
management and maintenance.
+We configure all the parameters directly in the Route, it's easy to set up, 
and each Route has a relatively high degree of freedom. But when our Route has 
more repetitive configurations (such as enabling the same plugin configuration 
or upstream information), once we need update these same properties, we have to 
traverse all the Routes and modify them, so it's adding a lot of complexity of 
management and maintenance.
 
 The shortcomings mentioned above are independently abstracted in APISIX by the 
two concepts [Service](#service) and [Upstream](#upstream).
 
diff --git a/doc/plugins/authz-keycloak.md b/doc/plugins/authz-keycloak.md
index f2979c7..415e313 100644
--- a/doc/plugins/authz-keycloak.md
+++ b/doc/plugins/authz-keycloak.md
@@ -31,7 +31,7 @@
 ## Name
 
 `authz-keycloak` is an authorization plugin to be used with the Keycloak 
Identity Server. Keycloak is an OAuth/OIDC and
-UMA compliant Identity Server. Although, its developed to working in 
conjunction with Keycloak it should work with any
+UMA compliant Identity Server. Although, it's developed working in conjunction 
with Keycloak it should work with any
 OAuth/OIDC and UMA compliant identity providers as well.
 
 For more information on Keycloak, refer to [Keycloak Authorization 
Docs](https://www.keycloak.org/docs/latest/authorization_services) for more 
information.
diff --git a/doc/plugins/echo.md b/doc/plugins/echo.md
index 2430cbf..118671a 100644
--- a/doc/plugins/echo.md
+++ b/doc/plugins/echo.md
@@ -29,7 +29,7 @@
 
 ## Name
 
-`echo` is a a useful plugin to help users understand as fully as possible how 
to develop an APISIX plugin.
+`echo` is a useful plugin to help users understand as fully as possible how to 
develop an APISIX plugin.
 
 This plugin addresses the corresponding functionality in the common phases 
such as init, rewrite, access, balancer, header filer, body filter and log.
 



[apisix] branch master updated: docs: standardize link anchors to lower case (#3510)

2021-02-05 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 5bd740a  docs: standardize link anchors to lower case (#3510)
5bd740a is described below

commit 5bd740a13165ff7cd8ec4c524af0da52379e984f
Author: John Bampton 
AuthorDate: Sat Feb 6 02:06:30 2021 +1000

docs: standardize link anchors to lower case (#3510)

many thx @jbampton
---
 README.md   |  4 ++--
 README_CN.md|  2 +-
 doc/admin-api.md| 12 ++--
 doc/discovery.md|  2 +-
 doc/plugins/batch-requests.md   |  6 +++---
 doc/plugins/cors.md |  6 +++---
 doc/plugins/dubbo-proxy.md  | 14 +++---
 doc/plugins/response-rewrite.md |  2 +-
 doc/plugins/skywalking.md   | 12 ++--
 9 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/README.md b/README.md
index 13e1c50..9bd721e 100644
--- a/README.md
+++ b/README.md
@@ -121,7 +121,7 @@ A/B testing, canary release, blue-green deployment, limit 
rate, defense against
   - Version Control: Supports rollbacks of operations.
   - CLI: start\stop\reload APISIX through the command line.
   - [Stand-alone mode](doc/stand-alone.md): Supports to load route rules from 
local yaml file, it is more friendly such as under the kubernetes(k8s).
-  - [Global Rule](doc/architecture-design.md#Global-Rule): Allows to run any 
plugin for all request, eg: limit rate, IP filter etc.
+  - [Global Rule](doc/architecture-design.md#global-rule): Allows to run any 
plugin for all request, eg: limit rate, IP filter etc.
   - High performance: The single-core QPS reaches 18k with an average delay of 
less than 0.2 milliseconds.
   - [Fault Injection](doc/plugins/fault-injection.md)
   - [REST Admin API](doc/admin-api.md): Using the REST Admin API to control 
Apache APISIX, which only allows 127.0.0.1 access by default, you can modify 
the `allow_admin` field in `conf/config.yaml` to specify a list of IPs that are 
allowed to call the Admin API. Also note that the Admin API uses key auth to 
verify the identity of the caller. **The `admin_key` field in 
`conf/config.yaml` needs to be modified before deployment to ensure security**.
@@ -227,7 +227,7 @@ There are several ways to install the Apache Release 
version of APISIX:
 
The getting started guide is a great way to learn the basics of APISIX, 
just follow the steps in [Getting Started](doc/getting-started.md).
 
-   Further, you can follow the documentation to try more 
[plugins](doc/README.md#Plugins).
+   Further, you can follow the documentation to try more 
[plugins](doc/README.md#plugins).
 
 3. Admin API
 
diff --git a/README_CN.md b/README_CN.md
index 9407d85..f772510 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -119,7 +119,7 @@ A/B 测试、金丝雀发布(灰度发布)、蓝绿部署、限流限速、抵
   - 版本控制:支持操作的多次回滚。
   - CLI: 使用命令行来启动、关闭和重启 APISIX。
   - [单机模式](doc/zh-cn/stand-alone.md): 支持从本地配置文件中加载路由规则,在 kubernetes(k8s) 
等环境下更友好。
-  - 
[全局规则](doc/zh-cn/architecture-design.md#Global-Rule):允许对所有请求执行插件,比如黑白名单、限流限速等。
+  - 
[全局规则](doc/zh-cn/architecture-design.md#global-rule):允许对所有请求执行插件,比如黑白名单、限流限速等。
   - 高性能:在单核上 QPS 可以达到 18k,同时延迟只有 0.2 毫秒。
   - [故障注入](doc/zh-cn/plugins/fault-injection.md)
   - [REST Admin API](doc/zh-cn/admin-api.md): 使用 REST Admin API 来控制 Apache 
APISIX,默认只允许 127.0.0.1 访问,你可以修改 `conf/config.yaml` 中的 `allow_admin` 字段,指定允许调用 
Admin API 的 IP 列表。同时需要注意的是,Admin API 使用 key auth 来校验调用者身份,**在部署前需要修改 
`conf/config.yaml` 中的 `admin_key` 字段,来保证安全。**
diff --git a/doc/admin-api.md b/doc/admin-api.md
index f1cc0c5..852f24f 100644
--- a/doc/admin-api.md
+++ b/doc/admin-api.md
@@ -265,7 +265,7 @@ After successful execution, status nodes will be updated to:
 
 Return response from etcd currently.
 
-[Back to TOC](#Table-of-Contents)
+[Back to TOC](#table-of-contents)
 
 ## Service
 
@@ -414,7 +414,7 @@ After successful execution, upstream nodes will not retain 
the original data, an
 
 Return response from etcd currently.
 
-[Back to TOC](#Table-of-Contents)
+[Back to TOC](#table-of-contents)
 
 ## Consumer
 
@@ -485,7 +485,7 @@ Since `v2.2`, we can bind multiple authentication plugins 
to the same consumer.
 
 Return response from etcd currently.
 
-[Back to TOC](#Table-of-Contents)
+[Back to TOC](#table-of-contents)
 
 ## Upstream
 
@@ -653,7 +653,7 @@ After the execution is successful, nodes will not retain 
the original data, and
 
 Return response from etcd currently.
 
-[Back to TOC](#Table-of-Contents)
+[Back to TOC](#table-of-contents)
 
 ## SSL
 
@@ -752,7 +752,7 @@ Date: Thu, 26 Dec 2019 04:19:34 GMT
 Content-Type: text/plain
 ```
 
-[Back to TOC](#Table-of-Contents)
+[Back to TOC](#table-of-contents)
 
 ## Plugin
 
@@ -791,4 +791,4 @@ $ curl 
"http://127.0.0.1:9080/apisix/admin/plugins/key-auth" -H 'X-API-KEY:
 |-|-|-

[apisix] branch master updated: chore: fixed install luarocks (#3536)

2021-02-05 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 004f95a  chore: fixed install luarocks (#3536)
004f95a is described below

commit 004f95abe8b88a509a8135ab7e380f313927dce0
Author: idbeta 
AuthorDate: Sat Feb 6 00:01:08 2021 +0800

chore: fixed install luarocks (#3536)

close #3529
---
 doc/install-dependencies.md   | 8 
 doc/zh-cn/install-dependencies.md | 8 
 utils/linux-install-luarocks.sh   | 3 +--
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/doc/install-dependencies.md b/doc/install-dependencies.md
index bd1f612..542f197 100644
--- a/doc/install-dependencies.md
+++ b/doc/install-dependencies.md
@@ -56,7 +56,7 @@ sudo yum-config-manager --add-repo 
https://openresty.org/package/centos/openrest
 sudo yum install -y openresty curl git gcc openresty-openssl-devel unzip
 
 # install LuaRocks
-curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | sudo bash -
+curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | bash -
 
 # start etcd server
 nohup etcd &
@@ -79,7 +79,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
 sudo yum install -y openresty curl git gcc openresty-openssl-devel
 
 # install LuaRocks
-curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | sudo bash -
+curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | bash -
 
 # start etcd server
 nohup etcd &
@@ -105,7 +105,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
 sudo apt-get install -y git openresty curl openresty-openssl-dev
 
 # install LuaRocks
-curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | sudo bash -
+curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | bash -
 
 # start etcd server
 nohup etcd &
@@ -136,7 +136,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
 sudo apt-get install -y git openresty curl make openresty-openssl-dev
 
 # install LuaRocks
-curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | sudo bash -
+curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | bash -
 
 # start etcd server
 nohup etcd &
diff --git a/doc/zh-cn/install-dependencies.md 
b/doc/zh-cn/install-dependencies.md
index 57fc1fd..8e986c9 100644
--- a/doc/zh-cn/install-dependencies.md
+++ b/doc/zh-cn/install-dependencies.md
@@ -55,7 +55,7 @@ sudo yum-config-manager --add-repo 
https://openresty.org/package/centos/openrest
 sudo yum install -y openresty curl git gcc openresty-openssl-devel unzip
 
 # 安装 LuaRocks
-curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | sudo bash -
+curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | bash -
 
 # 开启 etcd server
 nohup etcd &
@@ -78,7 +78,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
 sudo yum install -y openresty curl git gcc openresty-openssl-devel
 
 # 安装 LuaRocks
-curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | sudo bash -
+curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | bash -
 
 # 开启 etcd server
 nohup etcd &
@@ -104,7 +104,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
 sudo apt-get install -y git openresty curl openresty-openssl-dev
 
 # 安装 LuaRocks
-curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | sudo bash -
+curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | bash -
 
 # 开启 etcd server
 nohup etcd &
@@ -135,7 +135,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
 sudo apt-get install -y git openresty curl make openresty-openssl-dev
 
 # 安装 LuaRocks
-curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | sudo bash -
+curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | bash -
 
 # 开启 etcd server
 nohup etcd &
diff --git a/utils/linux-install-luarocks.sh b/utils/linux-install-luarocks.sh
index e1070df..2694035 100755
--- a/utils/linux-install-luarocks.sh
+++ b/utils/linux-install-luarocks.sh
@@ -16,7 +16,6 @@
 # limitations under the License.
 #
 
-# you might need sudo to run this script
 if [ -z ${OPENRESTY_PREFIX} ]; then
 OPENRESTY_PREFIX="/usr/local/openresty"
 fi
@@ -38,7 +37,7 @@ fi
 > build.log 2>&1 || (cat build.log && exit 1)
 
 make build > build.log 2

[apisix] branch master updated: fix(zipkin): always delivery x-b3-sampled header (#3519)

2021-02-04 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 7aa6c12  fix(zipkin): always delivery x-b3-sampled header (#3519)
7aa6c12 is described below

commit 7aa6c123b0f06621a2bf5d6cb318bf51c69e16d6
Author: 罗泽轩 
AuthorDate: Thu Feb 4 23:39:46 2021 +0800

fix(zipkin): always delivery x-b3-sampled header (#3519)

According to
https://github.com/openzipkin/b3-propagation#sampling-state:

> sampling applies consistently per-trace: once the sampling decision is
made, the same value should be consistently sent downstream

We should pass the right x-b3-sampled according to our decision.
---
 apisix/plugins/zipkin.lua   |   7 +-
 apisix/plugins/zipkin/codec.lua |  12 ++--
 t/lib/server.lua|  10 +++
 t/plugin/zipkin.t   | 144 
 4 files changed, 164 insertions(+), 9 deletions(-)

diff --git a/apisix/plugins/zipkin.lua b/apisix/plugins/zipkin.lua
index 01234ba..fddcd6c 100644
--- a/apisix/plugins/zipkin.lua
+++ b/apisix/plugins/zipkin.lua
@@ -67,7 +67,7 @@ local function create_tracer(conf,ctx)
 
 local headers = core.request.headers(ctx)
 
--- X-B3-Sampled: if an upstream decided to sample this request, we do too.
+-- X-B3-Sampled: if the client decided to sample this request, we do too.
 local sample = headers["x-b3-sampled"]
 if sample == "1" or sample == "true" then
 conf.sample_ratio = 1
@@ -75,8 +75,8 @@ local function create_tracer(conf,ctx)
 conf.sample_ratio = 0
 end
 
--- X-B3-Flags: if it equals '1' then it overrides sampling policy
--- We still want to warn on invalid sample header, so do this after the above
+-- X-B3-Flags: if it equals '1' then it overrides sampling policy
+-- We still want to warn on invalid sample header, so do this after the 
above
 local debug = headers["x-b3-flags"]
 if debug == "1" then
 conf.sample_ratio = 1
@@ -105,6 +105,7 @@ function _M.rewrite(plugin_conf, ctx)
 
 ctx.opentracing_sample = tracer.sampler:sample()
 if not ctx.opentracing_sample then
+core.request.set_header("x-b3-sampled", "0")
 return
 end
 
diff --git a/apisix/plugins/zipkin/codec.lua b/apisix/plugins/zipkin/codec.lua
index f1dad87..7ad4743 100644
--- a/apisix/plugins/zipkin/codec.lua
+++ b/apisix/plugins/zipkin/codec.lua
@@ -38,6 +38,9 @@ local function new_extractor()
 local had_invalid_id = false
 
 local trace_id = headers["x-b3-traceid"]
+local parent_span_id = headers["x-b3-parentspanid"]
+local request_span_id = headers["x-b3-spanid"]
+
 -- Validate trace id
 if trace_id and
 ((#trace_id ~= 16 and #trace_id ~= 32) or trace_id:match("%X")) 
then
@@ -45,7 +48,6 @@ local function new_extractor()
 had_invalid_id = true
 end
 
-local parent_span_id = headers["x-b3-parentspanid"]
 -- Validate parent_span_id
 if parent_span_id and
 (#parent_span_id ~= 16 or parent_span_id:match("%X")) then
@@ -53,7 +55,6 @@ local function new_extractor()
 had_invalid_id = true
 end
 
-local request_span_id = headers["x-b3-spanid"]
 -- Validate request_span_id
 if request_span_id and
 (#request_span_id ~= 16 or request_span_id:match("%X")) then
@@ -79,7 +80,7 @@ local function new_extractor()
 request_span_id = from_hex(request_span_id)
 
 return new_span_context(trace_id, request_span_id, parent_span_id,
- baggage)
+baggage)
 end
 end
 
@@ -90,9 +91,8 @@ local function new_injector()
 headers["x-b3-parentspanid"] = span_context.parent_id
 and to_hex(span_context.parent_id) or nil
 headers["x-b3-spanid"] = to_hex(span_context.span_id)
-local flags = core.request.header(nil, "x-b3-flags")
-headers["x-b3-flags"] = flags
-headers["x-b3-sampled"] = (not flags)
+-- when we call this function, we already start to sample
+headers["x-b3-sampled"] = "1"
 for key, value in span_context:each_baggage_item() do
 -- XXX: https://github.com/opentracing/specification/issues/117
 headers["uberctx-"..key] = ngx.escape_uri(value)
diff --git a/t/lib/server.lua b/t/lib/server.lua
index b9eef33..924163d 100644
--- a/t/lib/server.lua
+++ b/t/lib/server.lua
@@ -340,6 +340,16 @@ function _M.headers()
 end
 
 
+function _M.echo()
+ngx.req.rea

[apisix] branch master updated: test: make 'not unwanted data, GET' stable (#3513)

2021-02-03 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 1d0e38a  test: make 'not unwanted data, GET' stable (#3513)
1d0e38a is described below

commit 1d0e38a1d2a0ad35a6585dbbf3126888a6678d4b
Author: 罗泽轩 
AuthorDate: Thu Feb 4 12:48:28 2021 +0800

test: make 'not unwanted data, GET' stable (#3513)
---
 t/admin/consumers2.t  | 11 ---
 t/admin/global-rules.t| 11 ---
 t/admin/plugin-metadata.t |  7 ---
 t/admin/routes2.t | 11 ---
 t/admin/services2.t   | 11 ---
 t/admin/ssl2.t| 19 +++
 t/admin/stream-routes.t   |  6 +++---
 t/admin/upstream2.t   | 11 ---
 8 files changed, 58 insertions(+), 29 deletions(-)

diff --git a/t/admin/consumers2.t b/t/admin/consumers2.t
index eda7671..2b86380 100644
--- a/t/admin/consumers2.t
+++ b/t/admin/consumers2.t
@@ -87,13 +87,18 @@ __DATA__
 end
 
 res = json.decode(res)
-res.node.value.create_time = nil
-res.node.value.update_time = nil
+local value = res.node.value
+assert(value.create_time ~= nil)
+value.create_time = nil
+assert(value.update_time ~= nil)
+value.update_time = nil
+assert(res.count ~= nil)
+res.count = nil
 ngx.say(json.encode(res))
 }
 }
 --- response_body
-{"action":"get","count":"1","node":{"key":"/apisix/consumers/jack","value":{"username":"jack"}}}
+{"action":"get","node":{"key":"/apisix/consumers/jack","value":{"username":"jack"}}}
 
 
 
diff --git a/t/admin/global-rules.t b/t/admin/global-rules.t
index 564f2b4..001ad04 100644
--- a/t/admin/global-rules.t
+++ b/t/admin/global-rules.t
@@ -544,13 +544,18 @@ GET /t
 end
 
 res = json.decode(res)
-res.node.value.create_time = nil
-res.node.value.update_time = nil
+local value = res.node.value
+assert(value.create_time ~= nil)
+value.create_time = nil
+assert(value.update_time ~= nil)
+value.update_time = nil
+assert(res.count ~= nil)
+res.count = nil
 ngx.say(json.encode(res))
 }
 }
 --- response_body
-{"action":"get","count":"1","node":{"key":"/apisix/global_rules/1","value":{"id":"1","plugins":{"proxy-rewrite":{"uri":"/"}
+{"action":"get","node":{"key":"/apisix/global_rules/1","value":{"id":"1","plugins":{"proxy-rewrite":{"uri":"/"}
 --- request
 GET /t
 --- no_error_log
diff --git a/t/admin/plugin-metadata.t b/t/admin/plugin-metadata.t
index df3dd24..4a92f8a 100644
--- a/t/admin/plugin-metadata.t
+++ b/t/admin/plugin-metadata.t
@@ -543,13 +543,14 @@ GET /t
 end
 
 res = json.decode(res)
-res.node.value.create_time = nil
-res.node.value.update_time = nil
+local value = res.node.value
+assert(res.count ~= nil)
+res.count = nil
 ngx.say(json.encode(res))
 }
 }
 --- response_body
-{"action":"get","count":"1","node":{"key":"/apisix/plugin_metadata/example-plugin","value":{"ikey":1,"skey":"val"}}}
+{"action":"get","node":{"key":"/apisix/plugin_metadata/example-plugin","value":{"ikey":1,"skey":"val"}}}
 --- request
 GET /t
 --- no_error_log
diff --git a/t/admin/routes2.t b/t/admin/routes2.t
index cde747e..fea3f62 100644
--- a/t/admin/routes2.t
+++ b/t/admin/routes2.t
@@ -309,15 +309,20 @@ GET /t
 end
 
 res = json.decode(res)
-res.node.value.create_time = nil
-res.node.value.update_time = nil
+local value = res.node.value
+assert(value.create_time ~= nil)
+value.create_time = nil
+assert(value.update_time ~= nil)
+value.update_time = nil
+assert(res.count ~= nil)
+res.count = nil
 ngx.say(json.encode(res))
 }
 }
 --- request
 GET /t
 --- response_body
-{"action":"get","count":"1","node":{"key":"/apisix/routes/1",&

[apisix] branch master updated: fix(CI): roll our own Markdown link checker (#3197)

2021-02-03 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 0d63c0a  fix(CI): roll our own Markdown link checker (#3197)
0d63c0a is described below

commit 0d63c0aec3c4d1c6599472dcaed1f2fccdf47354
Author: John Bampton 
AuthorDate: Thu Feb 4 01:55:53 2021 +1000

fix(CI): roll our own Markdown link checker (#3197)

Due to the ASF's policies changing we cannot use the original GitHub 
Actions for linting as they are not approved.

Change Action to only rull on pull request.
---
 .github/workflows/markdown-link-checker.yml | 29 +
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/.github/workflows/markdown-link-checker.yml 
b/.github/workflows/markdown-link-checker.yml
index 515a415..209a368 100644
--- a/.github/workflows/markdown-link-checker.yml
+++ b/.github/workflows/markdown-link-checker.yml
@@ -1,14 +1,27 @@
 name: Check Markdown links
 
-on: push
+on: [pull_request]
 
 jobs:
   markdown-link-check:
-runs-on: ubuntu-latest
+runs-on: ${{ matrix.os }}
+strategy:
+  matrix:
+os:
+  - macos-latest
+node_version:
+  - 14
+architecture:
+  - x64
+name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ 
matrix.os }}
 steps:
-- uses: actions/checkout@master
-- uses: gaurav-nelson/github-action-markdown-link-check@v1
-  with:
-use-quiet-mode: 'yes'
-use-verbose-mode: 'yes'
-check-modified-files-only: 'yes'
+  - uses: actions/checkout@v2
+  - name: Setup node
+uses: actions/setup-node@v2
+with:
+  node-version: ${{ matrix.node_version }}
+  architecture: ${{ matrix.architecture }}
+  - name: Install
+run: npm install -g markdown-link-check
+  - name: Run
+run: git ls-files . -m | xargs markdown-link-check -q -v  # modified 
files only, quiet mode, verbose mode



[apisix] branch master updated: fix: `make deps` should not require root. (#3500)

2021-02-03 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 19e2d70  fix: `make deps` should not require root. (#3500)
19e2d70 is described below

commit 19e2d70ec7f78f3c5539d8b580ab50316705ad22
Author: 罗泽轩 
AuthorDate: Wed Feb 3 22:38:27 2021 +0800

fix: `make deps` should not require root. (#3500)
---
 Makefile| 7 ++-
 utils/linux-install-luarocks.sh | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 473f74f..d1345c8 100644
--- a/Makefile
+++ b/Makefile
@@ -55,9 +55,14 @@ help: default
 .PHONY: deps
 deps: default
 ifeq ($(LUAROCKS_VER),luarocks 3.)
-   mkdir ~/.luarocks || true
+   mkdir -p ~/.luarocks
+ifeq ($(shell whoami),root)
luarocks config variables.OPENSSL_LIBDIR $(addprefix $(OR_PREFIX), 
openssl/lib)
luarocks config variables.OPENSSL_INCDIR $(addprefix $(OR_PREFIX), 
openssl/include)
+else
+   luarocks config --local variables.OPENSSL_LIBDIR $(addprefix 
$(OR_PREFIX), openssl/lib)
+   luarocks config --local variables.OPENSSL_INCDIR $(addprefix 
$(OR_PREFIX), openssl/include)
+endif
luarocks install rockspec/apisix-master-0.rockspec --tree=deps 
--only-deps --local
 else
@echo "WARN: You're not using LuaRocks 3.x, please add the following 
items to your LuaRocks config file:"
diff --git a/utils/linux-install-luarocks.sh b/utils/linux-install-luarocks.sh
index 92276e8..e1070df 100755
--- a/utils/linux-install-luarocks.sh
+++ b/utils/linux-install-luarocks.sh
@@ -16,6 +16,7 @@
 # limitations under the License.
 #
 
+# you might need sudo to run this script
 if [ -z ${OPENRESTY_PREFIX} ]; then
 OPENRESTY_PREFIX="/usr/local/openresty"
 fi



[apisix] branch master updated: chore: sync install-dependencies.md & polish it (#3467)

2021-02-01 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new b033a75  chore: sync install-dependencies.md & polish it (#3467)
b033a75 is described below

commit b033a75b896ae42cf6baffa59d08b817faaba23c
Author: 罗泽轩 
AuthorDate: Tue Feb 2 10:47:59 2021 +0800

chore: sync install-dependencies.md & polish it (#3467)
---
 doc/install-dependencies.md   | 14 +-
 doc/zh-cn/install-dependencies.md | 28 +++-
 utils/centos7-ci.sh   | 13 -
 utils/linux-install-luarocks.sh   | 14 +-
 utils/linux-install-openresty.sh  |  2 +-
 5 files changed, 42 insertions(+), 29 deletions(-)

diff --git a/doc/install-dependencies.md b/doc/install-dependencies.md
index d132597..145607b 100644
--- a/doc/install-dependencies.md
+++ b/doc/install-dependencies.md
@@ -35,15 +35,13 @@
 
 - If you want use Tengine instead of OpenResty, please take a look at this 
installation step script [Install Tengine at 
Ubuntu](../.travis/linux_tengine_runner.sh).
 
-- By default Apache APISIX runs with LuaJIT of OpenResty 1.19 (priority) or 
Lua 5.1. If you run in to an issue `luajit: lj_asm_x86.h:2819: asm_loop_fixup: 
Assertion '((intptr_t)target & 15) == 0' failed`, it is caused by to the 
compatibility of OpenResty version. OpenResty 1.19 is recommended, please take 
a look at this installation step script 
[linux-install-openresty](../utils/linux-install-openresty.sh).
+- If it is OpenResty 1.19, APISIX will use OpenResty's built-in LuaJIT to run 
`bin/apisix`; otherwise it will use Lua 5.1. If you encounter `luajit: 
lj_asm_x86.h:2819: asm_loop_ fixup: Assertion '((intptr_t)target & 15) == 0' 
failed`, this is a problem with the low version of OpenResty's built-in LuaJIT 
under certain compilation conditions.
+
+- - On some platforms, installing LuaRocks via the package manager will cause 
Lua to be upgraded to Lua 5.3, so we recommend installing LuaRocks via source 
code. if you install OpenResty and its OpenSSL develop library 
(openresty-openssl-devel for rpm and openresty-openssl-dev for deb) via the 
official repository, then [we provide a script for automatic installation](. 
/... /utils/linux-install-luarocks.sh). If you compile OpenResty yourself, you 
can refer to the above script and change  [...]
 
 # CentOS 7
 
 ```shell
-# install epel, `luarocks` need it.
-wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-sudo rpm -ivh epel-release-latest-7.noarch.rpm
-
 # install etcd
 wget 
https://github.com/etcd-io/etcd/releases/download/v3.4.13/etcd-v3.4.13-linux-amd64.tar.gz
 tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
@@ -55,13 +53,11 @@ sudo yum install yum-utils
 sudo yum-config-manager --add-repo 
https://openresty.org/package/centos/openresty.repo
 
 # install OpenResty and some compilation tools
-sudo yum install -y openresty curl git gcc lua-devel openresty-openssl-devel
+sudo yum install -y openresty curl git gcc openresty-openssl-devel
 
 # install LuaRocks
 curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | sudo bash -
 
-# configure
-
 # start etcd server
 nohup etcd &
 ```
@@ -80,7 +76,7 @@ tar -xvf etcd-v3.4.13-linux-amd64.tar.gz && \
 sudo cp -a etcd etcdctl /usr/bin/
 
 # install OpenResty and some compilation tools
-sudo yum install -y openresty curl git gcc lua-devel openresty-openssl-devel
+sudo yum install -y openresty curl git gcc openresty-openssl-devel
 
 # install LuaRocks
 curl 
https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh
 -sL | sudo bash -
diff --git a/doc/zh-cn/install-dependencies.md 
b/doc/zh-cn/install-dependencies.md
index 6026c97..2e54d49 100644
--- a/doc/zh-cn/install-dependencies.md
+++ b/doc/zh-cn/install-dependencies.md
@@ -34,15 +34,13 @@
 
 - 如果你要想使用 Tengine 替代 OpenResty,请参考 [Install Tengine at 
Ubuntu](../../.travis/linux_tengine_runner.sh)。
 
-- Apache APISIX 运行默认使用 OpenResty 1.19 内置的 LuaJIT(优先推荐)或 Lua 5.1。若运行过程中出现问题 
`luajit: lj_asm_x86.h:2819: asm_loop_fixup: Assertion '((intptr_t)target & 15) 
== 0' failed`,是因 OpenResty 版本兼容性问题,建议更换 OpenResty 版本为 1.19,请参考 
[linux-install-openresty](../../utils/linux-install-openresty.sh)。
+- 如果是 OpenResty 1.19,APISIX 会使用 OpenResty 内置的 LuaJIT 来运行 `bin/apisix`;否则会使用 
Lua 5.1。如果运行过程中遇到 `luajit: lj_asm_x86.h:2819: asm_loop_fixup: Assertion 
'((intptr_t)target & 15) == 0' failed`,这是低版本 OpenResty 内置的 LuaJIT 在特定编译条件下的问题。
+
+- 在某些平台上,通过包管理器安装 LuaRocks 会导致 Lua 被升级为 Lua 5.3,所以我们建议通过源代码的方式安装 
LuaRocks。如果你通过官方仓库安装 OpenResty 和 OpenResty 的 OpenSSL 开发库(rpm 
版本:openresty-openssl-devel,deb 版本:openresty-openssl-dev),那么 
[我们提供了自动安装的脚本](../../utils/linux-install-luarocks.sh)。如果你是自己编译的 
OpenResty,可以参考上述脚本并修

[apisix] branch master updated: docs: clarify the default value of Upstream.pass_host (#3468)

2021-02-01 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new dffc517  docs: clarify the default value of Upstream.pass_host (#3468)
dffc517 is described below

commit dffc5178a15b1677894d7630f114a465e0a214ed
Author: 罗泽轩 
AuthorDate: Mon Feb 1 19:22:20 2021 +0800

docs: clarify the default value of Upstream.pass_host (#3468)

Fix #2134
---
 doc/admin-api.md   | 2 +-
 doc/zh-cn/admin-api.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/admin-api.md b/doc/admin-api.md
index 29eae70..f1cc0c5 100644
--- a/doc/admin-api.md
+++ b/doc/admin-api.md
@@ -522,7 +522,7 @@ In addition to the basic complex equalization algorithm 
selection, APISIX's Upst
 |timeout|optional| Set the timeout for connection, sending and receiving 
messages. |
 |name |optional|Identifies upstream names|
 |desc |optional|upstream usage scenarios, and more.|
-|pass_host|optional|`pass` pass the client request host, `node` 
not pass the client request host, using the upstream node host, `rewrite` 
rewrite host by the configured `upstream_host`.|
+|pass_host|optional|`pass` pass the client request host, `node` 
not pass the client request host, using the upstream node host, `rewrite` 
rewrite host by the configured `upstream_host`. Default to `pass`.|
 |upstream_host|optional|This option is only valid if the `pass_host` is 
`rewrite`.|
 |scheme|optional |The scheme used when talk with the upstream. The value is 
one of ['http', 'https', 'grpc', 'grpcs'], default to 'http'.|
 |labels|optional |Key/value pairs to specify 
attributes|{"version":"v2","build":"16","env":"production"}|
diff --git a/doc/zh-cn/admin-api.md b/doc/zh-cn/admin-api.md
index 771b072..024550d 100644
--- a/doc/zh-cn/admin-api.md
+++ b/doc/zh-cn/admin-api.md
@@ -531,7 +531,7 @@ APISIX 的 Upstream 除了基本的复杂均衡算法选择外,还支持对上
 |hash_on |可选|辅助|`hash_on` 支持的类型有 
`vars`(Nginx内置变量),`header`(自定义header),`cookie`,`consumer`,默认值为 `vars`|
 |name |可选 |辅助|标识上游服务名称、使用场景等。||
 |desc |可选 |辅助|上游服务描述、使用场景等。||
-|pass_host|可选|枚举|`pass` 透传客户端请求的 host, `node` 不透传客户端请求的 host, 使用 
upstream node 配置的 host, `rewrite` 使用 `upstream_host` 配置的值重写 host 。||
+|pass_host|可选|枚举|`pass` 透传客户端请求的 host, `node` 不透传客户端请求的 host, 使用 
upstream node 配置的 host, `rewrite` 使用 `upstream_host` 配置的值重写 host 。默认为 `pass`。||
 |upstream_host|可选|辅助|只在 `pass_host` 配置为 `rewrite` 时有效。||
 |scheme|可选 |辅助|跟上游通信时使用的 scheme。需要是 ['http', 'https', 'grpc', 'grpcs'] 
其中的一个,默认是 'http'。|
 |labels   |可选 
|匹配规则|标识附加属性的键值对|{"version":"v2","build":"16","env":"production"}|



[apisix] branch master updated (44074bb -> 3cbf153)

2021-02-01 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 44074bb  docs(api-breaker): the plugin docs is synchronized with the 
schema (#3470)
 add 3cbf153  chore: sync 'ignore stale nginx.pid'(#3416) to Makefile 
(#3471)

No new revisions were added by this update.

Summary of changes:
 Makefile | 4 
 1 file changed, 4 deletions(-)



[apisix] branch master updated: fix: use luajit by default when run apisix (#3335)

2021-01-29 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 98be489  fix: use luajit by default when run apisix (#3335)
98be489 is described below

commit 98be48978f60fb3ce03917d65778456048791618
Author: fukiki <59835099+fuk...@users.noreply.github.com>
AuthorDate: Fri Jan 29 23:57:46 2021 +0800

fix: use luajit by default when run apisix (#3335)

Fix : #3281
---
 Makefile|  4 ++-
 bin/apisix => apisix/cli/apisix.lua |  9 ++---
 apisix/cli/ngx_tpl.lua  |  6 
 bin/apisix  | 72 +
 doc/install-dependencies.md |  2 ++
 doc/zh-cn/install-dependencies.md   |  2 ++
 6 files changed, 59 insertions(+), 36 deletions(-)

diff --git a/Makefile b/Makefile
index 576b78b..b61c24d 100644
--- a/Makefile
+++ b/Makefile
@@ -33,8 +33,10 @@ RELEASE_SRC = apache-apisix-${VERSION}-src
 default:
 ifeq ($(OR_EXEC), )
 ifeq ("$(wildcard /usr/local/openresty-debug/bin/openresty)", "")
-   @echo "ERROR: OpenResty not found. You have to install OpenResty and 
add the binary file to PATH before install Apache APISIX."
+   @echo "WARNING: OpenResty not found. You have to install OpenResty and 
add the binary file to PATH before install Apache APISIX."
exit 1
+else
+   OR_EXEC=/usr/local/openresty-debug/bin/openresty
 endif
 endif
 
diff --git a/bin/apisix b/apisix/cli/apisix.lua
similarity index 82%
copy from bin/apisix
copy to apisix/cli/apisix.lua
index c3962ac..3d6049f 100755
--- a/bin/apisix
+++ b/apisix/cli/apisix.lua
@@ -1,5 +1,3 @@
-#!/usr/bin/env lua
-
 --
 -- Licensed to the Apache Software Foundation (ASF) under one or more
 -- contributor license agreements.  See the NOTICE file distributed with
@@ -22,8 +20,11 @@ local pkg_path_org = package.path
 
 local apisix_home = "/usr/local/apisix"
 local pkg_cpath = apisix_home .. "/deps/lib64/lua/5.1/?.so;"
-  .. apisix_home .. "/deps/lib/lua/5.1/?.so;;"
-local pkg_path = apisix_home .. "/deps/share/lua/5.1/?.lua;;"
+  .. apisix_home .. "/deps/lib/lua/5.1/?.so;"
+  .. "/usr/lib64/lua/5.1/?.so;"
+  .. "/usr/lib/lua/5.1/?.so;;"
+local pkg_path = apisix_home .. "/deps/share/lua/5.1/?.lua;"
+  .. "/usr/share/lua/5.1/?.lua;;"
 
 -- modify the load path to load our dependencies
 package.cpath = pkg_cpath .. pkg_cpath_org
diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua
index 38081ad..e0a229f 100644
--- a/apisix/cli/ngx_tpl.lua
+++ b/apisix/cli/ngx_tpl.lua
@@ -57,9 +57,12 @@ env {*name*};
 {% if stream_proxy then %}
 stream {
 lua_package_path  
"{*extra_lua_path*}$prefix/deps/share/lua/5.1/?.lua;$prefix/deps/share/lua/5.1/?/init.lua;]=]
+  .. 
[=[/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua;]=]
   .. 
[=[{*apisix_lua_home*}/?.lua;{*apisix_lua_home*}/?/init.lua;;{*lua_path*};";
 lua_package_cpath "{*extra_lua_cpath*}$prefix/deps/lib64/lua/5.1/?.so;]=]
   .. [=[$prefix/deps/lib/lua/5.1/?.so;;]=]
+  .. [=[/usr/lib64/lua/5.1/?.so;]=]
+  .. [=[/usr/lib/lua/5.1/?.so;]=]
   .. [=[{*lua_cpath*};";
 lua_socket_log_errors off;
 
@@ -120,9 +123,12 @@ http {
 # put extra_lua_path in front of the builtin path
 # so user can override the source code
 lua_package_path  
"{*extra_lua_path*}$prefix/deps/share/lua/5.1/?.lua;$prefix/deps/share/lua/5.1/?/init.lua;]=]
+   .. 
[=[/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua;]=]
.. 
[=[{*apisix_lua_home*}/?.lua;{*apisix_lua_home*}/?/init.lua;;{*lua_path*};";
 lua_package_cpath "{*extra_lua_cpath*}$prefix/deps/lib64/lua/5.1/?.so;]=]
   .. [=[$prefix/deps/lib/lua/5.1/?.so;;]=]
+  .. [=[/usr/lib64/lua/5.1/?.so;]=]
+  .. [=[/usr/lib/lua/5.1/?.so;]=]
   .. [=[{*lua_cpath*};";
 
 lua_shared_dict internal_status  10m;
diff --git a/bin/apisix b/bin/apisix
index c3962ac..992bd4e 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -1,36 +1,46 @@
-#!/usr/bin/env lua
+#!/bin/bash
 
---
--- 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 

[apisix] branch master updated: feat: chaos test on route could still works when etcd is down (#3404)

2021-01-29 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new a38cbf7  feat: chaos test on route could still works when etcd is down 
(#3404)
a38cbf7 is described below

commit a38cbf78b7223ac5017fdff4df45ae45380cb55d
Author: Shuyang Wu 
AuthorDate: Fri Jan 29 19:22:43 2021 +0800

feat: chaos test on route could still works when etcd is down (#3404)
---
 .github/workflows/chaos.yml |  52 ++
 kubernetes/deployment.yaml  |   3 +-
 t/chaos/go.mod  |   8 ++
 t/chaos/go.sum  |  97 ++
 t/chaos/kill-etcd.yaml  |  29 ++
 t/chaos/kill-etcd_test.go   | 240 
 t/chaos/utils.sh|  62 
 7 files changed, 490 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/chaos.yml b/.github/workflows/chaos.yml
new file mode 100644
index 000..1b31730
--- /dev/null
+++ b/.github/workflows/chaos.yml
@@ -0,0 +1,52 @@
+name: Chaos Test
+
+on: [pull_request]
+
+jobs:
+  build:
+runs-on: ubuntu-latest
+steps:
+  - uses: actions/checkout@v2
+  - name: setup go
+uses: actions/setup-go@v2.1.3
+with:
+  go-version: "1.14"
+
+  - name: Creating minikube cluster
+run: |
+  bash ./t/chaos/utils.sh start_minikube
+
+  - name: Print cluster information
+run: |
+  kubectl config view
+  kubectl cluster-info
+  kubectl get nodes
+  kubectl get pods -n kube-system
+  kubectl version
+
+  # TODO: should not use personal repo, while it's hard to modify a lot in 
an archived repo. Could we use api7's repo?
+  - name: Deploy Etcd Operator
+run: |
+  git clone https://github.com/yiyiyimu/etcd-operator.git --depth 1
+  bash etcd-operator/example/rbac/create_role.sh
+  kubectl create -f etcd-operator/example/deployment.yaml
+  bash ./t/chaos/utils.sh ensure_pods_ready etcd-operator "True" 30
+  kubectl create -f etcd-operator/example/example-etcd-cluster.yaml
+  bash ./t/chaos/utils.sh ensure_pods_ready etcd "True True True" 30
+
+  - name: Deploy APISIX
+run: |
+  bash ./t/chaos/utils.sh modify_config
+  kubectl create configmap apisix-gw-config.yaml 
--from-file=./conf/config.yaml
+  kubectl apply -f ./kubernetes/deployment.yaml
+  kubectl apply -f ./kubernetes/service.yaml
+  bash ./t/chaos/utils.sh ensure_pods_ready apisix-gw "True" 30
+  nohup kubectl port-forward svc/apisix-gw-lb 9080:9080 >/dev/null 
2>&1 &
+
+  - name: Deploy Chaos mesh
+run: |
+  curl -sSL https://mirrors.chaos-mesh.org/v1.1.1/install.sh | bash
+
+  - name: run test
+working-directory: ./t/chaos
+run: go test -v
diff --git a/kubernetes/deployment.yaml b/kubernetes/deployment.yaml
index 34f2091..0413db4 100644
--- a/kubernetes/deployment.yaml
+++ b/kubernetes/deployment.yaml
@@ -23,7 +23,7 @@ metadata:
   name: apisix-gw-deployment
   # namespace: default
 spec:
-  replicas: 2
+  replicas: 1
   selector:
 matchLabels:
   app: apisix-gw
@@ -57,6 +57,7 @@ spec:
   sysctl -w fs.inotify.max_user_watches=524288
   sysctl -w fs.inotify.max_queued_events=16384
   image: busybox:latest
+  imagePullPolicy: IfNotPresent
   name: init-sysctl
   resources: {}
   securityContext:
diff --git a/t/chaos/go.mod b/t/chaos/go.mod
new file mode 100644
index 000..b24abf3
--- /dev/null
+++ b/t/chaos/go.mod
@@ -0,0 +1,8 @@
+module github.com/apache/apisix/t/chaos
+
+require (
+   github.com/gavv/httpexpect/v2 v2.1.0
+   github.com/onsi/gomega v1.9.0
+)
+
+go 1.14
diff --git a/t/chaos/go.sum b/t/chaos/go.sum
new file mode 100644
index 000..5d88022
--- /dev/null
+++ b/t/chaos/go.sum
@@ -0,0 +1,97 @@
+github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
+github.com/ajg/form v1.5.1/go.mod 
h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
+github.com/davecgh/go-spew v1.1.0 
h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
+github.com/davecgh/go-spew v1.1.0/go.mod 
h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+github.com/fasthttp/websocket v1.4.2 
h1:AU/zSiIIAuJjBMf5o+vO0syGOnEfvZRu40xIhW/3RuM=
+github.com/fasthttp/websocket v1.4.2/go.mod 
h1:smsv/h4PBEBaU0XDTY5UwJTpZv69fQ0FfcLJr21mA6Y=
+github.com/fatih/structs v1.0.0 h1:BrX964Rv5uQ3wwS+KRUAJCBBw5PQmgJfJ6v4yly5QwU=
+github.com/fatih/structs v1.0.0/go.mod 
h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M=
+github.com/fsnotify/fsnotify v1.4.7 
h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
+github.com/fsnotify/fsnotify v1.4.7/go.mod 
h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.co

[apisix] branch master updated: feat: ewma use p2c to improve performance (#3300)

2021-01-29 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new ba11e7f  feat: ewma use p2c to improve performance (#3300)
ba11e7f is described below

commit ba11e7fa0a005a6a60cf9360bcbb83c22aa25028
Author: 大可 
AuthorDate: Fri Jan 29 17:17:22 2021 +0800

feat: ewma use p2c to improve performance (#3300)
---
 apisix/balancer/ewma.lua | 158 +---
 t/node/ewma.t| 166 ++-
 2 files changed, 270 insertions(+), 54 deletions(-)

diff --git a/apisix/balancer/ewma.lua b/apisix/balancer/ewma.lua
index b66b07a..e1b2762 100644
--- a/apisix/balancer/ewma.lua
+++ b/apisix/balancer/ewma.lua
@@ -3,28 +3,50 @@
 -- Inspiration drawn from:
 -- 
https://github.com/twitter/finagle/blob/1bc837c4feafc0096e43c0e98516a8e1c50c4421
 --   
/finagle-core/src/main/scala/com/twitter/finagle/loadbalancer/PeakEwma.scala
-
 local core = require("apisix.core")
+local resty_lock = require("resty.lock")
+
+local nkeys = core.table.nkeys
+local table_insert = core.table.insert
 local ngx = ngx
 local ngx_shared = ngx.shared
 local ngx_now = ngx.now
 local math = math
 local pairs = pairs
+local ipairs = ipairs
 local next = next
+local error = error
 
-local _M = {}
 local DECAY_TIME = 10 -- this value is in seconds
+local LOCK_KEY = ":ewma_key"
 
 local shm_ewma = ngx_shared.balancer_ewma
-local shm_last_touched_at= ngx_shared.balancer_ewma_last_touched_at
+local shm_last_touched_at = ngx_shared.balancer_ewma_last_touched_at
+
+local lrucache_addr = core.lrucache.new({ttl = 300, count = 1024})
+local lrucache_trans_format = core.lrucache.new({ttl = 300, count = 256})
+
+local ewma_lock, ewma_lock_err = resty_lock:new("balancer_ewma_locks", 
{timeout = 0, exptime = 0.1})
 
-local lrucache_addr = core.lrucache.new({
-ttl = 300, count = 1024
-})
-local lrucache_trans_format = core.lrucache.new({
-ttl = 300, count = 256
-})
+local _M = {name = "ewma"}
 
+local function lock(upstream)
+local _, err = ewma_lock:lock(upstream .. LOCK_KEY)
+if err and err ~= "timeout" then
+core.log.error("EWMA Balancer failed to lock: ", err)
+end
+
+return err
+end
+
+local function unlock()
+local ok, err = ewma_lock:unlock()
+if not ok then
+core.log.error("EWMA Balancer failed to unlock: ", err)
+end
+
+return err
+end
 
 local function decay_ewma(ewma, last_touched_at, rtt, now)
 local td = now - last_touched_at
@@ -35,73 +57,68 @@ local function decay_ewma(ewma, last_touched_at, rtt, now)
 return ewma
 end
 
-
 local function store_stats(upstream, ewma, now)
 local success, err, forcible = shm_last_touched_at:set(upstream, now)
 if not success then
-core.log.error("balancer_ewma_last_touched_at:set failed ", err)
+core.log.error("shm_last_touched_at:set failed: ", err)
 end
 if forcible then
-core.log.warn("balancer_ewma_last_touched_at:set valid items forcibly 
overwritten")
+core.log.warn("shm_last_touched_at:set valid items forcibly 
overwritten")
 end
 
 success, err, forcible = shm_ewma:set(upstream, ewma)
 if not success then
-core.log.error("balancer_ewma:set failed ", err)
+core.log.error("shm_ewma:set failed: ", err)
 end
 if forcible then
-core.log.warn("balancer_ewma:set valid items forcibly overwritten")
+core.log.warn("shm_ewma:set valid items forcibly overwritten")
 end
 end
 
-
 local function get_or_update_ewma(upstream, rtt, update)
+if update then
+local lock_err = lock(upstream)
+if lock_err ~= nil then
+return 0, lock_err
+end
+end
+
 local ewma = shm_ewma:get(upstream) or 0
+
 local now = ngx_now()
 local last_touched_at = shm_last_touched_at:get(upstream) or 0
 ewma = decay_ewma(ewma, last_touched_at, rtt, now)
 
 if not update then
-return ewma
+return ewma, nil
 end
 
 store_stats(upstream, ewma, now)
 
-return ewma
+unlock()
+
+return ewma, nil
 end
 
+local function get_upstream_name(upstream)
+return upstream.host .. ":" .. upstream.port
+end
 
 local function score(upstream)
 -- Original implementation used names
--- Endpoints don't have names, so passing in host:Port as key instead
-local upstream_name = upstream.host .. ":" .. upstream.port
+-- Endpoints don't have names, so passing in IP:Port as key instead
+local upstream_name = get_upstream_name(upstream)
 return get_or_update_ewma(upstream_name, 0, false)
 end
 
-
-local function pick_and_score(peers)
-local lo

[apisix] branch master updated (75c6923 -> 6415b29)

2021-01-28 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 75c6923  test: sort the output data of the plugin_proxy_rewrite_args 
method (#3448)
 add 6415b29  feat: customed config.yaml when apisix start (#2101)

No new revisions were added by this update.

Summary of changes:
 .travis/apisix_cli_test/test_main.sh | 39 
 Makefile |  2 +-
 apisix/cli/etcd.lua  |  5 +
 apisix/cli/ops.lua   | 31 
 doc/architecture-design.md   | 30 ++-
 doc/zh-cn/architecture-design.md | 32 ++---
 rockspec/apisix-master-0.rockspec|  1 +
 7 files changed, 101 insertions(+), 39 deletions(-)



[apisix] branch master updated: test: use the same buffer size across different platforms (#3436)

2021-01-27 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new b32cec7  test: use the same buffer size across different platforms 
(#3436)
b32cec7 is described below

commit b32cec71aac63138b0f3fb24493b0ed9f44edf60
Author: 罗泽轩 
AuthorDate: Wed Jan 27 22:38:09 2021 +0800

test: use the same buffer size across different platforms (#3436)

The buffer size in x86 is 8k while the one in arm64 is 16k.

Fix #3355
---
 t/APISIX.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/t/APISIX.pm b/t/APISIX.pm
index 304327d..90417e1 100644
--- a/t/APISIX.pm
+++ b/t/APISIX.pm
@@ -382,6 +382,7 @@ _EOC_
 
 underscores_in_headers on;
 lua_socket_log_errors off;
+client_body_buffer_size 8k;
 
 upstream apisix_backend {
 server 0.0.0.1;



[apisix] branch master updated: fix: ignore stale nginx.pid (#3416)

2021-01-27 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 97a0956  fix: ignore stale nginx.pid (#3416)
97a0956 is described below

commit 97a095661497eb25df051a1274c331f4491ba1be
Author: 罗泽轩 
AuthorDate: Wed Jan 27 22:36:35 2021 +0800

fix: ignore stale nginx.pid (#3416)

Fix #2948
Fix #3202

Signed-off-by: spacewander 
Co-authored-by: limiao 
---
 .travis/apisix_cli_test/test_main.sh | 38 +++-
 apisix/cli/ops.lua   | 16 ---
 2 files changed, 37 insertions(+), 17 deletions(-)

diff --git a/.travis/apisix_cli_test/test_main.sh 
b/.travis/apisix_cli_test/test_main.sh
index e422e82..1a2026d 100755
--- a/.travis/apisix_cli_test/test_main.sh
+++ b/.travis/apisix_cli_test/test_main.sh
@@ -23,20 +23,6 @@
 
 . ./.travis/apisix_cli_test/common.sh
 
-# validate extra_lua_path
-echo '
-apisix:
-extra_lua_path: ";"
-' > conf/config.yaml
-
-out=$(make init 2>&1 || true)
-if ! echo "$out" | grep 'invalid extra_lua_path'; then
-echo "failed: can't detect invalid extra_lua_path"
-exit 1
-fi
-
-echo "passed: detect invalid extra_lua_path"
-
 git checkout conf/config.yaml
 
 # check 'Server: APISIX' is not in nginx.conf. We already added it in Lua code.
@@ -1030,3 +1016,27 @@ if grep "failed to load plugin [3rd-party]" 
logs/error.log > /dev/null; then
 exit 1
 fi
 echo "passed: 3rd-party plugin can be loaded"
+
+# validate extra_lua_path
+echo '
+apisix:
+extra_lua_path: ";"
+' > conf/config.yaml
+
+out=$(make init 2>&1 || true)
+if ! echo "$out" | grep 'invalid extra_lua_path'; then
+echo "failed: can't detect invalid extra_lua_path"
+exit 1
+fi
+
+echo "passed: detect invalid extra_lua_path"
+
+# check restart with old nginx.pid exist
+echo "-1" > logs/nginx.pid
+out=$(./bin/apisix start 2>&1 || true)
+if echo "$out" | grep "APISIX is running"; then
+echo "failed: should ignore stale nginx.pid"
+exit 1
+fi
+
+echo "pass: ignore stale nginx.pid"
diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index 4e03c5b..f9ebcbf 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -426,13 +426,23 @@ local function start(env, ...)
 -- check running
 local pid_path = env.apisix_home .. "/logs/nginx.pid"
 local pid = util.read_file(pid_path)
+pid = tonumber(pid)
 if pid then
-local hd = popen("lsof -p " .. pid)
+local lsof_cmd = "lsof -p " .. pid
+local hd = popen(lsof_cmd)
 local res = hd:read("*a")
-if res and res ~= "" then
-print("APISIX is running...")
+if not (res and res == "") then
+if not res then
+print("failed to read the result of command: " .. lsof_cmd)
+else
+print("APISIX is running...")
+end
+
 return
 end
+
+print("nginx.pid exists but there's no corresponding process with pid 
", pid,
+  ", the file will be overwritten")
 end
 
 init(env, ...)



[apisix] branch master updated: feat: allow to pass SNI in HTTPS proxy (#3420)

2021-01-26 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new da62190  feat: allow to pass SNI in HTTPS proxy (#3420)
da62190 is described below

commit da62190d952811477cf9d0e7e1c9b455794263f3
Author: 罗泽轩 
AuthorDate: Tue Jan 26 23:36:12 2021 +0800

feat: allow to pass SNI in HTTPS proxy (#3420)

Fix #2988
---
 apisix/cli/ngx_tpl.lua   |  5 
 conf/config-default.yaml |  4 +++
 t/APISIX.pm  |  8 ++
 t/node/proxy_https.t | 73 
 4 files changed, 90 insertions(+)

diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua
index 18f6632..e0c44e8 100644
--- a/apisix/cli/ngx_tpl.lua
+++ b/apisix/cli/ngx_tpl.lua
@@ -483,6 +483,11 @@ http {
 proxy_set_header   X-Real-IP $remote_addr;
 proxy_pass_header  Date;
 
+{% if http.proxy_ssl_server_name then %}
+proxy_ssl_name $host;
+proxy_ssl_server_name on;
+{% end %}
+
 ### the following x-forwarded-* headers is to send to upstream 
server
 
 set $var_x_forwarded_for$remote_addr;
diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index ed8ec4c..9fa47b6 100644
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -180,6 +180,10 @@ nginx_config: # config for render the 
template to generate n
 # lua_shared_dicts:# add custom shared cache to nginx.conf
 #  ipc_shared_dict: 100m   # custom shared cache, format: `cache-key: 
cache-size`
 
+# Enables or disables passing of the server name through TLS Server Name 
Indication extension (SNI, RFC 6066)
+# when establishing a connection with the proxied HTTPS server.
+proxy_ssl_server_name: true
+
 etcd:
   host:   # it's possible to define multiple etcd 
hosts addresses of the same etcd cluster.
 - "http://127.0.0.1:2379"; # multiple etcd address, if your etcd 
cluster enables TLS, please use https scheme,
diff --git a/t/APISIX.pm b/t/APISIX.pm
index 9dcea3a..63b54f7 100644
--- a/t/APISIX.pm
+++ b/t/APISIX.pm
@@ -372,6 +372,9 @@ _EOC_
 lua_shared_dict plugin-api-breaker   10m;
 lua_capture_error_log 1m;# plugin error-log-logger
 
+proxy_ssl_name \$host;
+proxy_ssl_server_name on;
+
 resolver $dns_addrs_str;
 resolver_timeout 5;
 
@@ -448,6 +451,11 @@ _EOC_
 
 server_tokens off;
 
+ssl_certificate_by_lua_block {
+local ngx_ssl = require "ngx.ssl"
+ngx.log(ngx.WARN, "Receive SNI: ", ngx_ssl.server_name())
+}
+
 location / {
 content_by_lua_block {
 require("lib.server").go()
diff --git a/t/node/proxy_https.t b/t/node/proxy_https.t
new file mode 100644
index 000..0c3daf0
--- /dev/null
+++ b/t/node/proxy_https.t
@@ -0,0 +1,73 @@
+#
+# 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.
+#
+use t::APISIX 'no_plan';
+
+repeat_each(1);
+no_long_string();
+no_root_location();
+log_level("info");
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: add route
+--- config
+location /t {
+content_by_lua_block {
+local t = require("lib.test_admin").test
+local code, body = t('/apisix/admin/routes/1',
+ngx.HTTP_PUT,
+[[{
+"methods": ["GET"],
+"plugins": {
+"proxy-rewrite": {
+"scheme": "https"
+}
+},
+"upstream": {
+"type": "roundrobin",
+"nodes": {
+"127.0.0.1:1983": 1
+}
+},
+"uri": "/hello"
+ 

[apisix] branch master updated (c2385c7 -> 5250592)

2021-01-26 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from c2385c7  test: move test requires root privilege to ci_only group 
(#3419)
 add 5250592  chore: require more environment info (#3418)

No new revisions were added by this update.

Summary of changes:
 .github/ISSUE_TEMPLATE/bug.md  | 2 ++
 .github/ISSUE_TEMPLATE/request-help.md | 2 ++
 2 files changed, 4 insertions(+)



[apisix] branch master updated (a3c7c40 -> c2385c7)

2021-01-26 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from a3c7c40  fix: remove stale checker before adding new one (#3427)
 add c2385c7  test: move test requires root privilege to ci_only group 
(#3419)

No new revisions were added by this update.

Summary of changes:
 .travis/apisix_cli_test/test_ci_only.sh | 21 +
 .travis/apisix_cli_test/test_main.sh| 21 -
 2 files changed, 21 insertions(+), 21 deletions(-)



[apisix] branch master updated (8c7a688 -> a3c7c40)

2021-01-26 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 8c7a688  ci: address yamllint warnings (#3422)
 add a3c7c40  fix: remove stale checker before adding new one (#3427)

No new revisions were added by this update.

Summary of changes:
 apisix/upstream.lua| 14 +++---
 t/node/healthcheck-discovery.t |  2 ++
 2 files changed, 9 insertions(+), 7 deletions(-)



[apisix] branch master updated: test: make ci stable (#3413)

2021-01-25 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 8439c8d  test: make ci stable (#3413)
8439c8d is described below

commit 8439c8d98d9672cc707ed914275622b4be9a3a37
Author: 罗泽轩 
AuthorDate: Tue Jan 26 00:01:48 2021 +0800

test: make ci stable (#3413)
---
 t/admin/plugins-reload.t  | 2 +-
 t/node/healthcheck-stop-checker.t | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/admin/plugins-reload.t b/t/admin/plugins-reload.t
index 61ae4e2..e035970 100644
--- a/t/admin/plugins-reload.t
+++ b/t/admin/plugins-reload.t
@@ -71,7 +71,7 @@ location /t {
 content_by_lua_block {
 local core = require "apisix.core"
 local config_util   = require("apisix.core.config_util")
-ngx.sleep(0.1) -- make sure the sync happened when admin starts is 
already finished
+ngx.sleep(0.5) -- make sure the sync happened when admin starts is 
already finished
 
 local before_reload = true
 local plugins_conf, err
diff --git a/t/node/healthcheck-stop-checker.t 
b/t/node/healthcheck-stop-checker.t
index 1a0720b..a706292 100644
--- a/t/node/healthcheck-stop-checker.t
+++ b/t/node/healthcheck-stop-checker.t
@@ -209,6 +209,7 @@ create new checker: table: 0x
 ngx.say(body)
 return
 end
+ngx.sleep(0.5) -- wait for routes delete event synced
 
 code, _, body = t('/apisix/admin/upstreams/stopchecker', "DELETE")
 



[apisix] branch master updated: fix: SSL resource supports PATCH with sub path (#3405)

2021-01-25 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new c90f0dc  fix: SSL resource supports PATCH with sub path (#3405)
c90f0dc is described below

commit c90f0dcfb4218a9c6ade70b21b7974342aad5ed4
Author: 罗泽轩 
AuthorDate: Mon Jan 25 23:57:34 2021 +0800

fix: SSL resource supports PATCH with sub path (#3405)

Fix #3351
---
 apisix/admin/ssl.lua | 13 +++--
 t/admin/ssl2.t   | 40 
 2 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/apisix/admin/ssl.lua b/apisix/admin/ssl.lua
index b97a194..3a6136e 100644
--- a/apisix/admin/ssl.lua
+++ b/apisix/admin/ssl.lua
@@ -172,7 +172,7 @@ function _M.delete(id)
 end
 
 
-function _M.patch(id, conf)
+function _M.patch(id, conf, sub_path)
 if not id then
 return 400, {error_msg = "missing route id"}
 end
@@ -206,7 +206,16 @@ function _M.patch(id, conf)
 local node_value = res_old.body.node.value
 local modified_index = res_old.body.node.modifiedIndex
 
-node_value = core.table.merge(node_value, conf);
+if sub_path and sub_path ~= "" then
+local code, err, node_val = core.table.patch(node_value, sub_path, 
conf)
+node_value = node_val
+if code then
+return code, err
+end
+else
+node_value = core.table.merge(node_value, conf);
+end
+
 
 utils.inject_timestamp(node_value, nil, conf)
 
diff --git a/t/admin/ssl2.t b/t/admin/ssl2.t
index 6614eef..0c68cd2 100644
--- a/t/admin/ssl2.t
+++ b/t/admin/ssl2.t
@@ -365,3 +365,43 @@ wzarryret/7GFW1/3cz+hTj9/d45i25zArr3Pocfpur5mfz3fJO8jg==
 --- error_code: 400
 --- response_body
 {"error_msg":"invalid configuration: property \"snis\" validation failed: 
expect array to have at least 1 items"}
+
+
+
+=== TEST 11: update snis, PATCH with sub path
+--- config
+location /t {
+content_by_lua_block {
+local json = require("toolkit.json")
+local t = require("lib.test_admin")
+local ssl_cert = t.read_file("t/certs/apisix.crt")
+local ssl_key =  t.read_file("t/certs/apisix.key")
+local data = {cert = ssl_cert, key = ssl_key, snis = {"test.com"}}
+local code, message, res = t.test('/apisix/admin/ssl/1',
+ngx.HTTP_PUT,
+json.encode(data)
+)
+
+if code >= 300 then
+ngx.status = code
+ngx.say(message)
+return
+end
+
+
+local data = {"update1.com", "update2.com"}
+local code, message, res = t.test('/apisix/admin/ssl/1/snis',
+ngx.HTTP_PATCH,
+json.encode(data)
+)
+
+if code >= 300 then
+ngx.status = code
+ngx.say(message)
+return
+end
+ngx.say(res)
+}
+}
+--- response_body_like eval
+qr/"snis":\["update1.com","update2.com"\]/



[apisix] branch master updated: chore: fix kubernetes yaml not working (#3410)

2021-01-25 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 923e504  chore: fix kubernetes yaml not working (#3410)
923e504 is described below

commit 923e504e1942522e98cf38262ffd4c728d1a0b90
Author: Shuyang Wu 
AuthorDate: Mon Jan 25 23:57:00 2021 +0800

chore: fix kubernetes yaml not working (#3410)
---
 conf/config.yaml   |  6 ++--
 kubernetes/deployment.yaml | 68 +++---
 kubernetes/service.yaml| 12 
 3 files changed, 42 insertions(+), 44 deletions(-)

diff --git a/conf/config.yaml b/conf/config.yaml
index 04fb1f7..bed00a2 100644
--- a/conf/config.yaml
+++ b/conf/config.yaml
@@ -32,10 +32,8 @@
 # If the configured environment variable can't be found, an error will be 
thrown.
 apisix:
   admin_key:
--
-  name: "admin"
+- name: "admin"
   # yamllint disable rule:comments-indentation
-  key: edd1c9f034335f136f87ad84b625c8f1  # using fixed API token has 
security risk, please
- # update it when you deploy to 
production environment
+  key: edd1c9f034335f136f87ad84b625c8f1 # using fixed API token has 
security risk, please update it when you deploy to production environment
   # yamllint enable rule:comments-indentation
   role: admin
diff --git a/kubernetes/deployment.yaml b/kubernetes/deployment.yaml
index 522beef..069f72e 100644
--- a/kubernetes/deployment.yaml
+++ b/kubernetes/deployment.yaml
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-apiVersion: apps/v1beta2  # for versions before 1.8.0 use apps/v1beta1
+apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1, before 1.9.0 
use apps/v1beta2
 kind: Deployment
 metadata:
   labels:
@@ -35,33 +35,33 @@ spec:
   affinity:
 podAntiAffinity:
   preferredDuringSchedulingIgnoredDuringExecution:
-  - podAffinityTerm:
-  labelSelector:
-matchExpressions:
-- key: app
-  operator: In
-  values:
-  - apisix-gw
-  topologyKey: kubernetes.io/hostname
-weight: 100
+- podAffinityTerm:
+labelSelector:
+  matchExpressions:
+- key: app
+  operator: In
+  values:
+- apisix-gw
+topologyKey: kubernetes.io/hostname
+  weight: 100
   initContainers:
-  - command:
-- /bin/sh
-- -c
-- |
-  sysctl -w net.core.somaxconn=65535
-  sysctl -w net.ipv4.ip_local_port_range="1024 65535"
-  sysctl -w net.ipv4.tcp_max_syn_backlog=8192
-  sysctl -w fs.file-max=1048576
-  sysctl -w fs.inotify.max_user_instances=16384
-  sysctl -w fs.inotify.max_user_watches=524288
-  sysctl -w fs.inotify.max_queued_events=16384
-image: busybox:latest
-name: init-sysctl
-resources: {}
-securityContext:
-  privileged: true
-  procMount: Default
+- command:
+- /bin/sh
+- -c
+- |
+  sysctl -w net.core.somaxconn=65535
+  sysctl -w net.ipv4.ip_local_port_range="1024 65535"
+  sysctl -w net.ipv4.tcp_max_syn_backlog=8192
+  sysctl -w fs.file-max=1048576
+  sysctl -w fs.inotify.max_user_instances=16384
+  sysctl -w fs.inotify.max_user_watches=524288
+  sysctl -w fs.inotify.max_queued_events=16384
+  image: busybox:latest
+  name: init-sysctl
+  resources: {}
+  securityContext:
+privileged: true
+procMount: Default
   restartPolicy: Always
 
   containers:
@@ -76,16 +76,16 @@ spec:
 fieldRef:
   apiVersion: v1
   fieldPath: metadata.namespace
-  image: 'apache/apisix:latest'
+  image: "apache/apisix:latest"
   imagePullPolicy: IfNotPresent
   name: apisix-gw-deployment
   ports:
-  - containerPort: 9080
-name: http
-protocol: TCP
-  - containerPort: 9443
-name: https
-protocol: TCP
+- containerPort: 9080
+  name: http
+  protocol: TCP
+- containerPort: 9443
+  name: https
+  protocol: TCP
   readinessProbe:
 failureThreshold: 6
 initialDelaySeconds: 10
diff --git a/kubernetes/service.yaml b/kubernetes/service.yaml
index 2990bc8..59cd829 100644
--- a/kubernetes/service.yaml
+++ b/kubernetes/service.yaml
@@ -21,7 +21,7 @@ metadata:

[apisix] branch master updated: feat(fault-injection): support conditional fault injection using nginx variables (#3363)

2021-01-25 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new fb9123d  feat(fault-injection): support conditional fault injection 
using nginx variables (#3363)
fb9123d is described below

commit fb9123d4298372820e4969ac74751435fd5b4ed8
Author: Yuelin Zheng <2226815...@qq.com>
AuthorDate: Mon Jan 25 23:44:00 2021 +0800

feat(fault-injection): support conditional fault injection using nginx 
variables (#3363)

close #2511
---
 apisix/plugins/fault-injection.lua   |  64 ++-
 doc/plugins/fault-injection.md   | 329 +
 doc/zh-cn/plugins/fault-injection.md | 329 +
 t/plugin/fault-injection.t   | 345 +++
 4 files changed, 1063 insertions(+), 4 deletions(-)

diff --git a/apisix/plugins/fault-injection.lua 
b/apisix/plugins/fault-injection.lua
index 7a5afb1..ac2846d 100644
--- a/apisix/plugins/fault-injection.lua
+++ b/apisix/plugins/fault-injection.lua
@@ -15,9 +15,11 @@
 -- limitations under the License.
 --
 local core = require("apisix.core")
+local expr = require("resty.expr.v1")
 
 local sleep = core.sleep
 local random = math.random
+local ipairs = ipairs
 
 local plugin_name   = "fault-injection"
 
@@ -30,7 +32,11 @@ local schema = {
 properties = {
 http_status = {type = "integer", minimum = 200},
 body = {type = "string", minLength = 0},
-percentage = {type = "integer", minimum = 0, maximum = 100}
+percentage = {type = "integer", minimum = 0, maximum = 100},
+vars = {
+type = "array",
+maxItems = 20
+}
 },
 required = {"http_status"},
 },
@@ -38,7 +44,11 @@ local schema = {
 type = "object",
 properties = {
 duration = {type = "number", minimum = 0},
-percentage = {type = "integer", minimum = 0, maximum = 100}
+percentage = {type = "integer", minimum = 0, maximum = 100},
+vars = {
+type = "array",
+maxItems = 20
+}
 },
 required = {"duration"},
 }
@@ -64,12 +74,46 @@ local function sample_hit(percentage)
 end
 
 
+local function vars_match(vars, ctx)
+local match_result
+for _, var in ipairs(vars) do
+local expr, _ = expr.new(var)
+match_result = expr:eval(ctx.var)
+if match_result then
+break
+end
+end
+
+return match_result
+end
+
+
 function _M.check_schema(conf)
 local ok, err = core.schema.check(schema, conf)
 if not ok then
 return false, err
 end
 
+if conf.abort and conf.abort.vars then
+for _, var in ipairs(conf.abort.vars) do
+local _, err = expr.new(var)
+if err then
+core.log.error("failed to create vars expression: ", err)
+return false, err
+end
+end
+end
+
+if conf.delay and conf.delay.vars then
+for _, var in ipairs(conf.delay.vars) do
+local _, err = expr.new(var)
+if err then
+core.log.error("failed to create vars expression: ", err)
+return false, err
+end
+end
+end
+
 return true
 end
 
@@ -77,11 +121,23 @@ end
 function _M.rewrite(conf, ctx)
 core.log.info("plugin rewrite phase, conf: ", core.json.delay_encode(conf))
 
-if conf.delay and sample_hit(conf.delay.percentage) then
+local abort_vars = true
+if conf.abort and conf.abort.vars then
+abort_vars = vars_match(conf.abort.vars, ctx)
+end
+core.log.info("abort_vars: ", abort_vars)
+
+local delay_vars = true
+if conf.delay and conf.delay.vars then
+delay_vars = vars_match(conf.delay.vars, ctx)
+end
+core.log.info("delay_vars: ", delay_vars)
+
+if conf.delay and sample_hit(conf.delay.percentage) and delay_vars then
 sleep(conf.delay.duration)
 end
 
-if conf.abort and sample_hit(conf.abort.percentage) then
+if conf.abort and sample_hit(conf.abort.percentage) and abort_vars then
 return conf.abort.http_status, core.utils.resolve_var(conf.abort.body, 
ctx.var)
 end
 end
diff --git a/doc/plugins/fault-injection.md b/doc/plugins/fault-injection.md
index 3e96c27..c0b2556 100644
--- a/doc/plugins/fault-injection.md
+++ b/doc/plugins/fault-injection.md
@@ -30,11 +30,29 @@ Fault injection plugin, this plugin can

[apisix] branch master updated (d698220 -> c8d35cd)

2021-01-22 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from d698220  fix: ignore the case of configured host (#3377)
 add c8d35cd  fix(standalone): require consumer's id to be the same as 
username (#3394)

No new revisions were added by this update.

Summary of changes:
 apisix/consumer.lua | 26 +-
 t/config-center-yaml/consumer.t | 29 +
 2 files changed, 50 insertions(+), 5 deletions(-)



[apisix-ingress-controller] branch master updated: doc: Add Apache APISIX link in README (#194)

2021-01-21 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis 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 7cbd15f  doc: Add Apache APISIX link in README (#194)
7cbd15f is described below

commit 7cbd15fc680c6aec00b34034ac1e1660a084cff9
Author: fukiki <59835099+fuk...@users.noreply.github.com>
AuthorDate: Thu Jan 21 23:50:43 2021 +0800

doc: Add Apache APISIX link in README (#194)
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index d0485f1..16fe40e 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@
 
 [![Go Report 
Card](https://goreportcard.com/badge/github.com/apache/apisix-ingress-controller)](https://goreportcard.com/report/github.com/apache/apisix-ingress-controller)
 
-Use Apache APISIX for Kubernetes 
[Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/)
+Use [Apache APISIX](https://github.com/apache/apisix#apache-apisix) for 
Kubernetes 
[Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/).
 
 All configurations in `apisix-ingress-controller` are defined with Kubernetes 
CRDs (Custom Resource Definitions). Such as configure 
[plugins](https://github.com/apache/apisix/tree/master/doc/plugins), Support 
service registration discovery mechanism for upstreams, load balancing and more 
in Apache APISIX.
 



[apisix] branch master updated: test: avoid unstable case caused by delete upstream 1 (#3385)

2021-01-21 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new bf16615  test: avoid unstable case caused by delete upstream 1 (#3385)
bf16615 is described below

commit bf16615583c7645d51473f66fd5a970c9740afc4
Author: 罗泽轩 
AuthorDate: Thu Jan 21 09:40:58 2021 -0600

test: avoid unstable case caused by delete upstream 1 (#3385)

Test cases from other files may still refer upstream 1.
---
 t/node/healthcheck-stop-checker.t | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/node/healthcheck-stop-checker.t 
b/t/node/healthcheck-stop-checker.t
index e6105f0..1a0720b 100644
--- a/t/node/healthcheck-stop-checker.t
+++ b/t/node/healthcheck-stop-checker.t
@@ -146,7 +146,7 @@ create new checker: table: 0x
 content_by_lua_block {
 local t = require("lib.test_admin").test
 
-local code, _, body = t('/apisix/admin/upstreams/1',
+local code, _, body = t('/apisix/admin/upstreams/stopchecker',
 "PUT",
 
[[{"type":"roundrobin","nodes":{"127.0.0.1:1980":1,"127.0.0.1:1981":1},"checks":{"active":{"http_path":"/status","healthy":{"interval":1,"successes":1},"unhealthy":{"interval":1,"http_failures":2]]
 )
@@ -160,7 +160,7 @@ create new checker: table: 0x
 -- release the clean handler of previous test
 local code, _, body = t('/apisix/admin/routes/1',
 "PUT",
-[[{"uri":"/server_port","upstream_id":1}]]
+[[{"uri":"/server_port","upstream_id":"stopchecker"}]]
 )
 
 if code > 300 then
@@ -181,7 +181,7 @@ create new checker: table: 0x
 ngx.sleep(0.5)
 
 -- update
-code, _, body = t('/apisix/admin/upstreams/1',
+code, _, body = t('/apisix/admin/upstreams/stopchecker',
 "PUT",
 
[[{"type":"roundrobin","nodes":{"127.0.0.1:1980":1,"127.0.0.1:1981":1},"checks":{"active":{"http_path":"/void","healthy":{"interval":1,"successes":1},"unhealthy":{"interval":1,"http_failures":1]]
 )
@@ -210,7 +210,7 @@ create new checker: table: 0x
 return
 end
 
-code, _, body = t('/apisix/admin/upstreams/1', "DELETE")
+code, _, body = t('/apisix/admin/upstreams/stopchecker', "DELETE")
 
 if code > 300 then
 ngx.status = code



[apisix] branch master updated: fix: support upstream_id & consumer with grpc (#3387)

2021-01-21 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new c030783  fix: support upstream_id & consumer with grpc (#3387)
c030783 is described below

commit c03078360761e51aceb25f8edd018724ac071abd
Author: 罗泽轩 
AuthorDate: Thu Jan 21 09:38:19 2021 -0600

fix: support upstream_id & consumer with grpc (#3387)

Fix #1646.
---
 apisix/init.lua | 74 
 t/node/grpc-proxy.t | 97 +
 2 files changed, 103 insertions(+), 68 deletions(-)

diff --git a/apisix/init.lua b/apisix/init.lua
index 4f13603..a33248f 100644
--- a/apisix/init.lua
+++ b/apisix/init.lua
@@ -379,10 +379,6 @@ function _M.http_access_phase()
 core.log.info("matched route: ",
   core.json.delay_encode(api_ctx.matched_route, true))
 
-if route.value.service_protocol == "grpc" then
-return ngx.exec("@grpc_pass")
-end
-
 local enable_websocket = route.value.enable_websocket
 if route.value.service_id then
 local service = service_fetch(route.value.service_id)
@@ -523,6 +519,11 @@ function _M.http_access_phase()
 
 set_upstream_host(api_ctx)
 
+if route.value.service_protocol == "grpc" then
+ngx_var.ctx_ref = ctxdump.stash_ngx_ctx()
+return ngx.exec("@grpc_pass")
+end
+
 if api_ctx.dubbo_proxy_enabled then
 ngx_var.ctx_ref = ctxdump.stash_ngx_ctx()
 return ngx.exec("@dubbo_pass")
@@ -536,70 +537,7 @@ end
 
 
 function _M.grpc_access_phase()
-local ngx_ctx = ngx.ctx
-local api_ctx = ngx_ctx.api_ctx
-
-if not api_ctx then
-api_ctx = core.tablepool.fetch("api_ctx", 0, 32)
-ngx_ctx.api_ctx = api_ctx
-end
-
-core.ctx.set_vars_meta(api_ctx)
-
-router.router_http.match(api_ctx)
-
-core.log.info("route: ",
-  core.json.delay_encode(api_ctx.matched_route, true))
-
-local route = api_ctx.matched_route
-if not route then
-return core.response.exit(404)
-end
-
-if route.value.service_id then
--- core.log.info("matched route: ", 
core.json.delay_encode(route.value))
-local service = service_fetch(route.value.service_id)
-if not service then
-core.log.error("failed to fetch service configuration by ",
-   "id: ", route.value.service_id)
-return core.response.exit(404)
-end
-
-local changed
-route, changed = plugin.merge_service_route(service, route)
-api_ctx.matched_route = route
-
-if changed then
-api_ctx.conf_type = "route&service"
-api_ctx.conf_version = route.modifiedIndex .. "&"
-   .. service.modifiedIndex
-api_ctx.conf_id = route.value.id .. "&"
-  .. service.value.id
-else
-api_ctx.conf_type = "service"
-api_ctx.conf_version = service.modifiedIndex
-api_ctx.conf_id = service.value.id
-end
-
-else
-api_ctx.conf_type = "route"
-api_ctx.conf_version = route.modifiedIndex
-api_ctx.conf_id = route.value.id
-end
-
--- todo: support upstream id
-
-api_ctx.matched_upstream = (route.dns_value and
-route.dns_value.upstream)
-   or route.value.upstream
-
-local plugins = core.tablepool.fetch("plugins", 32, 0)
-api_ctx.plugins = plugin.filter(route, plugins)
-
-run_plugin("rewrite", plugins, api_ctx)
-run_plugin("access", plugins, api_ctx)
-
-set_upstream(route, api_ctx)
+ngx.ctx = ctxdump.apply_ngx_ctx(ngx_var.ctx_ref)
 end
 
 
diff --git a/t/node/grpc-proxy.t b/t/node/grpc-proxy.t
new file mode 100644
index 000..02ee658
--- /dev/null
+++ b/t/node/grpc-proxy.t
@@ -0,0 +1,97 @@
+#
+# 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 s

[apisix] branch master updated (5e00a73 -> 62b5f7c)

2021-01-21 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 5e00a73  chore: update lua-resty-expr to v1.1.0 (#3386)
 add 62b5f7c  docs(traffic-split): update the vars example of the docs 
(#3366)

No new revisions were added by this update.

Summary of changes:
 doc/plugins/traffic-split.md   | 29 +
 doc/zh-cn/plugins/traffic-split.md | 19 ---
 2 files changed, 29 insertions(+), 19 deletions(-)



[apisix] branch master updated: chore: update lua-resty-expr to v1.1.0 (#3386)

2021-01-21 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 5e00a73  chore: update lua-resty-expr to v1.1.0 (#3386)
5e00a73 is described below

commit 5e00a731ef50bfdd15acbd01e3f1e5fbbf5c7180
Author: Yuelin Zheng <2226815...@qq.com>
AuthorDate: Thu Jan 21 19:20:35 2021 +0800

chore: update lua-resty-expr to v1.1.0 (#3386)
---
 rockspec/apisix-master-0.rockspec | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rockspec/apisix-master-0.rockspec 
b/rockspec/apisix-master-0.rockspec
index 78b74bc..2ee5009 100644
--- a/rockspec/apisix-master-0.rockspec
+++ b/rockspec/apisix-master-0.rockspec
@@ -58,7 +58,7 @@ dependencies = {
 "binaryheap = 0.4",
 "dkjson = 2.5-2",
 "resty-redis-cluster = 1.02-4",
-"lua-resty-expr = 1.0.0",
+"lua-resty-expr = 1.1.0",
 "graphql = 0.0.2",
 "luasocket = 3.0rc1-2",
 }



[apisix-ingress-controller] branch master updated: doc: add doc about how to run on tke (#187)

2021-01-20 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis 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 271be10  doc: add doc about how to run on tke (#187)
271be10 is described below

commit 271be10f20baa499b7114b730f007ebb644c040d
Author: Alex Zhang 
AuthorDate: Wed Jan 20 18:12:54 2021 +0800

doc: add doc about how to run on tke (#187)
---
 docs/deployments/tke.md | 81 +
 docs/install.md |  3 +-
 2 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/docs/deployments/tke.md b/docs/deployments/tke.md
new file mode 100644
index 000..c818daa
--- /dev/null
+++ b/docs/deployments/tke.md
@@ -0,0 +1,81 @@
+
+
+# Install Ingress APISIX on Tencent TKE
+
+This document explains how to install Ingress APISIX on [Tencent 
TKE](https://cloud.tencent.com/product/tke).
+
+## Prerequisites
+
+* Create a TKE Service on Tencent Cloud and make sure the API Server is 
accessible from your workspace.
+* Install [Helm](https://helm.sh/).
+* Download the kube config for your TKE Console.
+* Clone [Apache APISIX Charts](https://github.com/apache/apisix-helm-chart).
+* Clone 
[apisix-ingress-controller](https://github.com/apache/apisix-ingress-controller).
+* Make sure your target namespace exists, kubectl operations thorough this 
document will be executed in namespace `ingress-apisix`.
+
+## Install APISIX
+
+[Apache APISIX](http://apisix.apache.org/) as the proxy plane of 
apisix-ingress-controller, should be deployed in advance.
+
+```shell
+cd /path/to/apisix-helm-chart
+helm repo add bitnami https://charts.bitnami.com/bitnami
+helm dependency update ./chart/apisix
+helm install apisix ./chart/apisix \
+  --set gateway.type=LoadBalancer \
+  --set allow.ipList="{0.0.0.0/0}" \
+  --set etcd.persistence.size=10Gi \
+  --namespace ingress-apisix \
+kubectl get service --namespace ingress-apisix
+```
+
+Please be careful you must configure the `etcd.persistence.size` to multiplese 
of 10Gi (it's a limitation on TKE), otherwise the 
[PersistentVolumeClaim](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)
 creation will fail.
+
+Two Service resources were created, one is `apisix-gateway`, which processes 
the real traffic; another is `apisix-admin`, which acts as the control plane to 
process all the configuration changes.
+
+The gateway service type is set to `LoadBalancer` (see [TKE Service 
Management](https://cloud.tencent.com/document/product/457/45487?from=10680) 
for more details), so that clients can access Apache APISIX through a load 
balancer. You can find the load balancer ip by running:
+
+```shell
+kubectl get service apisix-gateway --namespace ingress-apisix -o 
jsonpath='{.status.loadBalancer.ingress[].ip}'
+```
+
+Another thing should be concerned that the `allow.ipList` field should be 
customized according to the [TKE Network 
Settings](https://cloud.tencent.com/document/product/457/50353), so that the 
apisix-ingress-controller instances can access the APISIX instances (resources 
pushing).
+
+## Install apisix-ingress-controller
+
+You can also install apisix-ingress-controller by Helm Charts, it's 
recommended to install it in the same namespace with Apache APISIX.
+
+```shell
+cd /path/to/apisix-ingress-controller
+# install base resources, e.g. ServiceAccount.
+helm install ingress-apisix-base -n ingress-apisix ./charts/base
+# install apisix-ingress-controller
+helm install ingress-apisix ./charts/ingress-apisix \
+  --set ingressController.image.tag=dev \
+  --set 
ingressController.config.apisix.baseURL=http://apisix-admin:9180/apisix/admin \
+  --set 
ingressController.config.apisix.adminKey=edd1c9f034335f136f87ad84b625c8f1 \
+  --namespace ingress-apisix
+```
+
+Change the `ingressController.image.tag` to the Apache APISIX version that you 
desire. You have to wait for while until the correspdoning pods are running.
+
+Now open your [TKE console](https://console.cloud.tencent.com/tke2/overview), 
choosing your cluster and clicking the Workloads tag, you'll see all pods of 
Apache APISIX, etcd and apisix-ingress-controller are ready.
+
+Try to create some [resources](../CRD-specification.md) to verify the running 
status. As a minimalist example, see 
[proxy-the-httpbin-service](../samples/proxy-the-httpbin-service.md) to learn 
how to apply resources to drive the apisix-ingress-controller.
diff --git a/docs/install.md b/docs/install.md
index bb51a89..279303a 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -22,9 +22,10 @@
 This is an index page about installing Ingress APISIX in several environments. 
Click the following links on demands.
 
 * [Install Ingress APISIX on Minikube](deployments/minikube.md)
-* [Install Ingress APISIX on K3S](deployments/k3s-rke.md)
+* [Install Ingress APISIX on K3S and RKE](

[apisix] branch master updated (319c3eb -> 95c0170)

2021-01-20 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 319c3eb  test: make ci stable (#3329)
 add 95c0170  feat: allow getting health check status via control API 
(#3345)

No new revisions were added by this update.

Summary of changes:
 apisix/control/v1.lua | 116 
 apisix/upstream.lua   |   8 +-
 doc/control-api.md|  99 +
 doc/health-check.md   |   5 +
 doc/zh-cn/health-check.md |   5 +
 t/control/healthcheck.t   | 271 ++
 6 files changed, 503 insertions(+), 1 deletion(-)
 create mode 100644 t/control/healthcheck.t



[apisix-ingress-controller] branch master updated (e11f7e0 -> 0615aea)

2021-01-20 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git.


from e11f7e0  docs: add flowcharts of the logic during synchronization 
(#184)
 add 0615aea  doc: also run on Rancher RKE (#185)

No new revisions were added by this update.

Summary of changes:
 docs/deployments/{k3s.md => k3s-rke.md} | 15 ---
 docs/install.md |  2 +-
 2 files changed, 9 insertions(+), 8 deletions(-)
 rename docs/deployments/{k3s.md => k3s-rke.md} (80%)



[apisix] branch master updated: test: make ci stable (#3329)

2021-01-19 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 319c3eb  test: make ci stable (#3329)
319c3eb is described below

commit 319c3ebefd22cd2949b84d97d196fd2a80630d38
Author: 罗泽轩 
AuthorDate: Wed Jan 20 01:58:44 2021 -0600

test: make ci stable (#3329)
---
 apisix/http/service.lua   |  2 +-
 apisix/router.lua |  2 +-
 apisix/upstream.lua   |  2 +-
 t/admin/plugin-metadata.t | 16 +++-
 t/admin/upstream.t| 29 ++--
 t/admin/upstream2.t   | 16 
 t/node/upstream.t | 49 +++
 7 files changed, 48 insertions(+), 68 deletions(-)

diff --git a/apisix/http/service.lua b/apisix/http/service.lua
index 2872ef0..0e36f9a 100644
--- a/apisix/http/service.lua
+++ b/apisix/http/service.lua
@@ -85,7 +85,7 @@ local function filter(service)
 service.value.upstream.nodes = new_nodes
 end
 
-core.log.info("filter service: ", core.json.delay_encode(service))
+core.log.info("filter service: ", core.json.delay_encode(service, true))
 end
 
 
diff --git a/apisix/router.lua b/apisix/router.lua
index 1012a15..51f03bd 100644
--- a/apisix/router.lua
+++ b/apisix/router.lua
@@ -70,7 +70,7 @@ local function filter(route)
 route.value.upstream.nodes = new_nodes
 end
 
-core.log.info("filter route: ", core.json.delay_encode(route))
+core.log.info("filter route: ", core.json.delay_encode(route, true))
 end
 
 
diff --git a/apisix/upstream.lua b/apisix/upstream.lua
index da19e45..c0c0889 100644
--- a/apisix/upstream.lua
+++ b/apisix/upstream.lua
@@ -237,7 +237,7 @@ function _M.init_worker()
 upstream.value.nodes = new_nodes
 end
 
-core.log.info("filter upstream: ", 
core.json.delay_encode(upstream))
+core.log.info("filter upstream: ", 
core.json.delay_encode(upstream, true))
 end,
 })
 if not upstreams then
diff --git a/t/admin/plugin-metadata.t b/t/admin/plugin-metadata.t
index e157971..df3dd24 100644
--- a/t/admin/plugin-metadata.t
+++ b/t/admin/plugin-metadata.t
@@ -330,8 +330,22 @@ passed
 
 
 === TEST 10: hit prometheus route
+--- config
+location /t {
+content_by_lua_block {
+ngx.sleep(1) -- wait for data synced
+local t = require("lib.test_admin").test
+local code, body = t('/apisix/prometheus/metrics',
+ngx.HTTP_GET)
+
+if code >= 300 then
+ngx.status = code
+end
+ngx.say(body)
+}
+}
 --- request
-GET /apisix/prometheus/metrics
+GET /t
 --- error_code: 403
 
 
diff --git a/t/admin/upstream.t b/t/admin/upstream.t
index 453a301..15485af 100644
--- a/t/admin/upstream.t
+++ b/t/admin/upstream.t
@@ -26,13 +26,14 @@ run_tests;
 
 __DATA__
 
-=== TEST 1: set upstream(id: 1)
+=== TEST 1: set upstream (use an id can't be referred by other route
+so that we can delete it later)
 --- config
 location /t {
 content_by_lua_block {
 local t = require("lib.test_admin").test
 local etcd = require("apisix.core.etcd")
-local code, body = t('/apisix/admin/upstreams/1',
+local code, body = t('/apisix/admin/upstreams/admin_up',
 ngx.HTTP_PUT,
 [[{
 "nodes": {
@@ -50,7 +51,7 @@ __DATA__
 "type": "roundrobin",
 "desc": "new upstream"
 },
-"key": "/apisix/upstreams/1"
+"key": "/apisix/upstreams/admin_up"
 },
 "action": "set"
 }]]
@@ -59,7 +60,7 @@ __DATA__
 ngx.status = code
 ngx.say(body)
 
-local res = assert(etcd.get('/upstreams/1'))
+local res = assert(etcd.get('/upstreams/admin_up'))
 local create_time = res.body.node.value.create_time
 assert(create_time ~= nil, "create_time is nil")
 local update_time = res.body.node.value.update_time
@@ -75,12 +76,12 @@ passed
 
 
 
-=== TEST 2: get upstream(id: 1)
+=== TEST 2: get upstream
 --- config
 location /t {
 content_by_lua_block {
 local t = require("lib.test_admin").test
-local code, body = t('/apisix/admin/upstreams/1',
+local code, body = t('/apisix/admin/upstreams/admin_up',
  ngx.HTTP_G

[apisix-dashboard] branch master updated: chore: add e2e test coverage (#1270)

2021-01-19 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
 new b659dfc  chore: add e2e test coverage (#1270)
b659dfc is described below

commit b659dfc6aff50ffbe7553824575a61aa69cbc409
Author: Vinci Xu <277040...@qq.com>
AuthorDate: Tue Jan 19 23:03:31 2021 +0800

chore: add e2e test coverage (#1270)
---
 .github/workflows/backend-e2e-test.yml | 12 +++-
 api/cmd/manager/main_test.go   | 54 ++
 api/test/docker/Dockerfile |  6 ++--
 api/test/docker/docker-compose.yaml|  1 +
 4 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/backend-e2e-test.yml 
b/.github/workflows/backend-e2e-test.yml
index 7ba1cbd..6bf0fd0 100644
--- a/.github/workflows/backend-e2e-test.yml
+++ b/.github/workflows/backend-e2e-test.yml
@@ -9,7 +9,7 @@ on:
   - master
 
 jobs:
-  run-test:
+  backend-e2e-test:
 runs-on: ubuntu-latest
 
 steps:
@@ -52,3 +52,13 @@ jobs:
   - name: run test for plugin skywalking
 working-directory: ./api/test/e2e/skywalking
 run: go test -v
+
+  - name: output test coverage
+working-directory: ./api/test/testdata
+run: |
+  go tool cover -func=./integrationcover.out
+
+  - name: upload coverage profile
+working-directory: ./api/test/testdata
+run: |
+  bash <(curl -s https://codecov.io/bash) -f ./integrationcover.out
diff --git a/api/cmd/manager/main_test.go b/api/cmd/manager/main_test.go
new file mode 100644
index 000..1e7b51d
--- /dev/null
+++ b/api/cmd/manager/main_test.go
@@ -0,0 +1,54 @@
+/*
+ * 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.
+ */
+package main
+import (
+   "os"
+   "os/signal"
+   "strings"
+   "syscall"
+   "testing"
+)
+func TestMainWrapper(t *testing.T) {
+   if os.Getenv("ENV") == "test" {
+   t.Skip("skipping build binary when execute unit test")
+   }
+
+   var (
+   args []string
+   )
+   for _, arg := range os.Args {
+   switch {
+   case strings.HasPrefix(arg, "-test"):
+   default:
+   args = append(args, arg)
+   }
+   }
+   waitCh := make(chan int, 1)
+   os.Args = args
+   go func() {
+   main()
+   close(waitCh)
+   }()
+   signalCh := make(chan os.Signal, 1)
+   signal.Notify(signalCh, syscall.SIGINT, syscall.SIGQUIT, 
syscall.SIGTERM, syscall.SIGHUP)
+   select {
+   case <-signalCh:
+   return
+   case <-waitCh:
+   return
+   }
+}
diff --git a/api/test/docker/Dockerfile b/api/test/docker/Dockerfile
index 216aa53..9f8a170 100644
--- a/api/test/docker/Dockerfile
+++ b/api/test/docker/Dockerfile
@@ -25,7 +25,7 @@ RUN mkdir -p /go/manager-api/conf \
 && mkdir -p /go/manager-api/build-tools \
 && go env -w GOPROXY=https://goproxy.io,direct \
 && export GOPROXY=https://goproxy.io \
-&& go build -o /go/manager-api/manager-api ./cmd/manager \
+&& go test -c -cover -covermode=atomic -o /go/manager-api/manager-api 
-coverpkg "./..." ./cmd/manager \
 && mv /go/src/github.com/apisix/manager-api/entry.sh /go/manager-api/ \
 && mv /go/src/github.com/apisix/manager-api/build-tools/* 
/go/manager-api/build-tools/ \
 && mv /go/src/github.com/apisix/manager-api/conf/conf.yaml 
/go/manager-api/conf/conf.yaml \
@@ -60,5 +60,5 @@ RUN mkdir logs
 EXPOSE 9000
 
 RUN chmod +x ./entry.sh
-
-CMD ["/bin/ash", "-c", "/go/manager-api/entry.sh"]
+ENTRYPOINT ["/go/manager-api/manager-api"]
+CMD ["-test.coverprofile=./testdata/integrationcover.out"]
diff --git a/api/test/docker/docker-compose.yaml 
b/api/test/docker/docker-compose.yaml
index cb2d67e..e5762c8 100644
--- a/api/te

[apisix] branch membphis/patch-1 updated (964f34d -> a91355e)

2021-01-18 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch membphis/patch-1
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 964f34d  doc: delete the `http` part to avoid ambiguity
 add a91355e  doc: sync Chinese version.

No new revisions were added by this update.

Summary of changes:
 doc/zh-cn/admin-api.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[apisix] branch membphis/patch-1 created (now 964f34d)

2021-01-18 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch membphis/patch-1
in repository https://gitbox.apache.org/repos/asf/apisix.git.


  at 964f34d  doc: delete the `http` part to avoid ambiguity

This branch includes the following new commits:

 new 964f34d  doc: delete the `http` part to avoid ambiguity

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[apisix] 01/01: doc: delete the `http` part to avoid ambiguity

2021-01-18 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch membphis/patch-1
in repository https://gitbox.apache.org/repos/asf/apisix.git

commit 964f34d18c089f7f6e6904a559215660a8056234
Author: YuanSheng Wang 
AuthorDate: Tue Jan 19 14:50:36 2021 +0800

doc: delete the `http` part to avoid ambiguity
---
 doc/admin-api.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/admin-api.md b/doc/admin-api.md
index fe68321..b2e6681 100644
--- a/doc/admin-api.md
+++ b/doc/admin-api.md
@@ -73,7 +73,7 @@
 |upstream |False |Upstream|Enabled Upstream configuration, see 
[Upstream](architecture-design.md#upstream) for more||
 |upstream_id|False |Upstream|Enabled upstream id, see 
[Upstream](architecture-design.md#upstream) for more ||
 |service_id|False |Service|Binded Service configuration, see 
[Service](architecture-design.md#service) for more ||
-|service_protocol|False|Upstream protocol type|only `grpc` and `http` are 
supported|`http` is the default value; Must set `grpc` if using `gRPC proxy` or 
`gRPC transcode`|
+|service_protocol|False|Upstream protocol type|only `grpc`|Must set `grpc` if 
using `gRPC proxy` or `gRPC transcode`. |
 |labels   |False |Match Rules|Key/value pairs to specify 
attributes|{"version":"v2","build":"16","env":"production"}|
 |enable_websocket|False|Auxiliary| enable `websocket`(boolean), default 
`false`.||
 |status  |False|Auxiliary| enable this route, default `1`.|`1` to 
enable, `0` to disable|



[apisix-docker] branch master updated: chore: modify apisix version to 2.2 & apisix-dashboard version to 2.3 (#120)

2021-01-18 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


The following commit(s) were added to refs/heads/master by this push:
 new 71ff8f2  chore: modify apisix version to 2.2 & apisix-dashboard 
version to 2.3 (#120)
71ff8f2 is described below

commit 71ff8f27fd0e684804d9c5ea656787d3cf217e7f
Author: kv 
AuthorDate: Mon Jan 18 22:54:55 2021 +0800

chore: modify apisix version to 2.2 & apisix-dashboard version to 2.3 (#120)
---
 README.md  | 8 
 alpine/Dockerfile  | 2 +-
 build.md   | 4 ++--
 example/docker-compose.yml | 2 +-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 2740113..f62f0d7 100644
--- a/README.md
+++ b/README.md
@@ -8,9 +8,9 @@
 
 1. install release version:
 ```
-# Assign Apache release version number to variable `APISIX_VERSION`, for 
example: 2.1 . The latest version can be find at 
`https://github.com/apache/apisix/releases`
+# Assign Apache release version number to variable `APISIX_VERSION`, for 
example: 2.2 . The latest version can be find at 
`https://github.com/apache/apisix/releases`
 
-export APISIX_VERSION=2.1
+export APISIX_VERSION=2.2
 docker build -t apisix:${APISIX_VERSION}-alpine --build-arg 
APISIX_VERSION=${APISIX_VERSION} -f alpine/Dockerfile alpine
 ```
 
@@ -52,10 +52,10 @@ $ docker run -v 
`pwd`/all-in-one/apisix/config.yaml:/usr/local/apisix/conf/confi
 
 * All in one Docker container for Apache apisix-dashboard
 
-**The latest version of `apisix-dashboard` is 2.1.1 and should be used with 
APISIX 2.1. It is not recommended to use with other APISIX versions.**
+**The latest version of `apisix-dashboard` is 2.3 and should be used with 
APISIX 2.2.**
 
 ```shell
-$ docker build --build-arg APISIX_VERSION=2.1 --build-arg 
APISIX_DASHBOARD_VERSION=v2.1.1 -t apache/apisix-dashboard:whole -f 
./all-in-one/apisix-dashboard/Dockerfile .
+$ docker build --build-arg APISIX_VERSION=2.2 --build-arg 
APISIX_DASHBOARD_VERSION=v2.3 -t apache/apisix-dashboard:whole -f 
./all-in-one/apisix-dashboard/Dockerfile .
 $ docker run -v 
`pwd`/all-in-one/apisix/config.yaml:/usr/local/apisix/conf/config.yaml -v 
`pwd`/all-in-one/apisix-dashboard/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml
 -p 9080:9080 -p 2379:2379 -p 9000:9000 -d apache/apisix-dashboard:whole
 ```
 
diff --git a/alpine/Dockerfile b/alpine/Dockerfile
index 51abb01..07af102 100644
--- a/alpine/Dockerfile
+++ b/alpine/Dockerfile
@@ -2,7 +2,7 @@ ARG ENABLE_PROXY=false
 
 FROM openresty/openresty:alpine-fat AS production-stage
 
-ARG APISIX_VERSION=1.3
+ARG APISIX_VERSION=2.2
 LABEL apisix_version="${APISIX_VERSION}"
 
 ARG ENABLE_PROXY
diff --git a/build.md b/build.md
index 2a8e283..f4fe53a 100644
--- a/build.md
+++ b/build.md
@@ -4,9 +4,9 @@
 
 1. install release version (Apache releases are beginning from version 0.9):
 ```
-# Assign Apache release version number to variable `APISIX_VERSION`, for 
example: 1.2 . The latest version can be find at 
`https://github.com/apache/apisix/releases`
+# Assign Apache release version number to variable `APISIX_VERSION`, for 
example: 2.2 . The latest version can be find at 
`https://github.com/apache/apisix/releases`
 
-APISIX_VERSION=1.2
+APISIX_VERSION=2.2
 docker build -t apisix:${APISIX_VERSION}-alpine --build-arg 
APISIX_VERSION=${APISIX_VERSION} -f alpine/Dockerfile alpine
 ```
 
diff --git a/example/docker-compose.yml b/example/docker-compose.yml
index 5334871..4bd338e 100644
--- a/example/docker-compose.yml
+++ b/example/docker-compose.yml
@@ -2,7 +2,7 @@ version: "3"
 
 services:
   apisix:
-image: apache/apisix:2.1-alpine
+image: apache/apisix:2.2-alpine
 restart: always
 volumes:
   - ./apisix_log:/usr/local/apisix/logs



[apisix] branch master updated: feat: resolve var supports `${...}` format (#3320)

2021-01-18 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 1b3e547  feat: resolve var supports `${...}` format (#3320)
1b3e547 is described below

commit 1b3e547c5b041693e5a336486e9bc9f160435e53
Author: 罗泽轩 
AuthorDate: Mon Jan 18 08:23:15 2021 -0600

feat: resolve var supports `${...}` format (#3320)

Signed-off-by: spacewander 
---
 apisix/core/utils.lua | 2 +-
 t/core/utils.t| 6 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/apisix/core/utils.lua b/apisix/core/utils.lua
index ab9ba0a..8629d97 100644
--- a/apisix/core/utils.lua
+++ b/apisix/core/utils.lua
@@ -255,7 +255,7 @@ _M.sleep = sleep
 local resolve_var
 do
 local _ctx
-local pat = [[(?

[apisix] branch master updated: refactor: keep health checker with the upstream's parent (#3325)

2021-01-18 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 4cf30bf  refactor: keep health checker with the upstream's parent 
(#3325)
4cf30bf is described below

commit 4cf30bf2ac79d766355b89067e5e728bb02f232f
Author: 罗泽轩 
AuthorDate: Mon Jan 18 08:21:39 2021 -0600

refactor: keep health checker with the upstream's parent (#3325)

A upstream's parent can only have one running checker.
Previously, when a checker is evicted by lrucache, it is still running.
Now health checker & upstream in used is 1:1.
---
 apisix/core.lua| 39 ++-
 apisix/core/config_util.lua| 23 +
 apisix/upstream.lua| 46 --
 t/node/healthcheck-discovery.t |  5 +++--
 4 files changed, 72 insertions(+), 41 deletions(-)

diff --git a/apisix/core.lua b/apisix/core.lua
index f9432e0..f994de9 100644
--- a/apisix/core.lua
+++ b/apisix/core.lua
@@ -29,23 +29,24 @@ config.type = config_center
 
 
 return {
-version  = require("apisix.core.version"),
-log  = log,
-config   = config,
-sleep= utils.sleep,
-json = require("apisix.core.json"),
-table= require("apisix.core.table"),
-request  = require("apisix.core.request"),
-response = require("apisix.core.response"),
-lrucache = require("apisix.core.lrucache"),
-schema   = require("apisix.schema_def"),
-string   = require("apisix.core.string"),
-ctx  = require("apisix.core.ctx"),
-timer= require("apisix.core.timer"),
-id   = require("apisix.core.id"),
-utils= utils,
-etcd = require("apisix.core.etcd"),
-http = require("apisix.core.http"),
-tablepool= require("tablepool"),
-empty_tab= {},
+version = require("apisix.core.version"),
+log = log,
+config  = config,
+config_util = require("apisix.core.config_util"),
+sleep   = utils.sleep,
+json= require("apisix.core.json"),
+table   = require("apisix.core.table"),
+request = require("apisix.core.request"),
+response= require("apisix.core.response"),
+lrucache= require("apisix.core.lrucache"),
+schema  = require("apisix.schema_def"),
+string  = require("apisix.core.string"),
+ctx = require("apisix.core.ctx"),
+timer   = require("apisix.core.timer"),
+id  = require("apisix.core.id"),
+utils   = utils,
+etcd= require("apisix.core.etcd"),
+http= require("apisix.core.http"),
+tablepool   = require("tablepool"),
+empty_tab   = {},
 }
diff --git a/apisix/core/config_util.lua b/apisix/core/config_util.lua
index 1e39921..cc29ea4 100644
--- a/apisix/core/config_util.lua
+++ b/apisix/core/config_util.lua
@@ -14,6 +14,7 @@
 -- See the License for the specific language governing permissions and
 -- limitations under the License.
 --
+local core_tab = require("apisix.core.table")
 local setmetatable = setmetatable
 local type = type
 
@@ -42,4 +43,26 @@ function _M.iterate_values(tab)
 end
 
 
+-- Add a clean handler to a runtime configuration item.
+-- The clean handler will be called when the item is deleted from configuration
+-- or cancelled. Note that Nginx worker exit doesn't trigger the clean handler.
+-- Retuen an index so that we can cancel it later.
+function _M.add_clean_handler(item, func)
+local idx = #item.clean_handlers + 1
+item.clean_handlers[idx] = func
+return idx
+end
+
+
+-- cancel a clean handler added by add_clean_handler.
+-- If `fire` is true, call the clean handler.
+function _M.cancel_clean_handler(item, idx, fire)
+local f = item.clean_handlers[idx]
+core_tab.remove(item.clean_handlers, idx)
+if fire then
+f(item)
+end
+end
+
+
 return _M
diff --git a/apisix/upstream.lua b/apisix/upstream.lua
index ecd99bf..da19e45 100644
--- a/apisix/upstream.lua
+++ b/apisix/upstream.lua
@@ -26,11 +26,6 @@ local upstreams
 local healthcheck
 
 
-local lrucache_checker = core.lrucache.new({
-ttl = 300, count = 256
-})
-
-
 local _M = {}
 
 
@@ -57,12 +52,24 @@ end
 _M.set = set_directly
 
 
+local function release_checker(healthcheck_parent)
+local checker = healthcheck_parent.checker
+core.log.info("try to release checker: ", tostring(checker))
+checker:clear()
+checker:stop()
+end
+
+
 local function create_checker(upstream)
 if healthcheck == ni

[apisix-docker] branch master updated: chore: modify the dockerfiles arg & add comments under the path of all-in-one (#121)

2021-01-18 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-docker.git


The following commit(s) were added to refs/heads/master by this push:
 new 8cd9405  chore: modify the dockerfiles arg & add comments  under the 
path of all-in-one (#121)
8cd9405 is described below

commit 8cd94050d2c8ef9e7e6e431004588f46a2d14e13
Author: kv 
AuthorDate: Mon Jan 18 21:13:19 2021 +0800

chore: modify the dockerfiles arg & add comments  under the path of 
all-in-one (#121)
---
 all-in-one/apisix-dashboard/Dockerfile | 25 -
 all-in-one/apisix/Dockerfile   | 10 --
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/all-in-one/apisix-dashboard/Dockerfile 
b/all-in-one/apisix-dashboard/Dockerfile
index 021170d..6c1c166 100644
--- a/all-in-one/apisix-dashboard/Dockerfile
+++ b/all-in-one/apisix-dashboard/Dockerfile
@@ -1,11 +1,15 @@
 ARG ENABLE_PROXY=false
+ARG ETCD_VERSION=v3.4.14
+ARG APISIX_VERSION=master
+ARG APISIX_DASHBOARD_VERSION=master
 
+# Build Apache APISIX
 FROM openresty/openresty:alpine-fat AS production-stage
 
-ARG APISIX_VERSION=master
+ARG APISIX_VERSION
+ARG ENABLE_PROXY
 LABEL apisix_version="${APISIX_VERSION}"
 
-ARG ENABLE_PROXY
 RUN set -x \
 && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 
's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' 
/etc/apk/repositories) \
 && apk add --no-cache --virtual .builddeps \
@@ -23,9 +27,10 @@ RUN set -x \
 && apk del .builddeps build-base make unzip
 
 
+# Build etcd
 FROM alpine:3.11 AS etcd-stage
 
-ARG ETCD_VERSION=v3.4.14
+ARG ETCD_VERSION
 LABEL etcd_version="${ETCD_VERSION}"
 
 WORKDIR /tmp
@@ -34,20 +39,21 @@ RUN wget 
https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/etcd-
 && ln -s etcd-${ETCD_VERSION}-linux-amd64 etcd
 
 
+# Build APISIX Dashboard - 1. downlaod source code from github
 FROM alpine:latest as pre-build
 
-ARG APISIX_DASHBOARD_VERSION=master
+ARG APISIX_DASHBOARD_VERSION
 
 RUN set -x \
 && wget 
https://github.com/apache/apisix-dashboard/archive/${APISIX_DASHBOARD_VERSION}.tar.gz
 -O /tmp/apisix-dashboard.tar.gz \
 && mkdir /usr/local/apisix-dashboard \
 && tar -xvf /tmp/apisix-dashboard.tar.gz -C /usr/local/apisix-dashboard 
--strip 1
 
-
+# Build APISIX Dashboard - 2. build manager-api from source code
 FROM golang:1.14 as api-builder
 
+ARG APISIX_DASHBOARD_VERSION
 ARG ENABLE_PROXY
-ARG APISIX_DASHBOARD_VERSION=master
 
 WORKDIR /usr/local/apisix-dashboard
 
@@ -66,10 +72,10 @@ RUN mkdir -p ../output/conf \
 && go env -w GO111MODULE=on \
 && if [ "$APISIX_DASHBOARD_VERSION" = "master" ] || [ 
"$APISIX_DASHBOARD_VERSION" \> "v2.2" ]; then CGO_ENABLED=0 go build -o 
../output/manager-api ./cmd/manager; else CGO_ENABLED=0 go build -o 
../output/manager-api . ; fi;
 
-
+# Build APISIX Dashboard - 3. build dashboard web-UI from source code
 FROM node:14-alpine as fe-builder
 
-ARG ENABLE_PROXY=false
+ARG ENABLE_PROXY
 
 WORKDIR /usr/local/apisix-dashboard
 
@@ -81,10 +87,11 @@ RUN if [ "$ENABLE_PROXY" = "true" ] ; then yarn config set 
registry https://regi
 && yarn install \
 && yarn build
 
-
+# Finally combine all the resources into one image
 FROM alpine:3.11 AS last-stage
 
 ARG ENABLE_PROXY
+
 # add runtime for Apache APISIX
 RUN set -x \
 && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 
's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' 
/etc/apk/repositories) \
diff --git a/all-in-one/apisix/Dockerfile b/all-in-one/apisix/Dockerfile
index c3dd708..977242f 100644
--- a/all-in-one/apisix/Dockerfile
+++ b/all-in-one/apisix/Dockerfile
@@ -1,11 +1,15 @@
 ARG ENABLE_PROXY=false
+ARG APISIX_VERSION=master
+ARG ETCD_VERSION=v3.4.14
 
+# Build Apache APISIX
 FROM openresty/openresty:alpine-fat AS production-stage
 
-ARG APISIX_VERSION=master
+ARG APISIX_VERSION
 LABEL apisix_version="${APISIX_VERSION}"
 
 ARG ENABLE_PROXY
+
 RUN set -x \
 && (test "${ENABLE_PROXY}" != "true" || /bin/sed -i 
's,http://dl-cdn.alpinelinux.org,https://mirrors.aliyun.com,g' 
/etc/apk/repositories) \
 && apk add --no-cache --virtual .builddeps \
@@ -22,9 +26,10 @@ RUN set -x \
 && mv /usr/local/apisix/deps/share/lua/5.1/apisix /usr/local/apisix \
 && apk del .builddeps build-base make unzip
 
+# Build etcd
 FROM alpine:3.11 AS etcd-stage
 
-ARG ETCD_VERSION=v3.4.14
+ARG ETCD_VERSION
 LABEL etcd_version="${ETCD_VERSION}"
 
 WORKDIR /tmp
@@ -33,6 +38,7 @@ RUN wget 
https://github.com/etcd-io/etcd/releases/download/${ETCD_VERSION}/etcd-
 && tar -zxvf etcd-${ETCD_VERSION}-linux-amd64.tar.gz \
 && ln -s etcd-${ETCD_VERSION}-linux-amd64 etcd
 
+# Finally combine all the resources into one image
 FROM alpine:3.11 AS last-stage
 
 ARG ENABLE_PROXY



[apisix-dashboard] branch master updated: feat: implement a way to set etcd client (#1323)

2021-01-18 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
 new 5aaae95  feat: implement a way to set etcd client (#1323)
5aaae95 is described below

commit 5aaae956803f512982e8ce3e3f386750b9e30b67
Author: Peter Zhu 
AuthorDate: Mon Jan 18 20:29:57 2021 +0800

feat: implement a way to set etcd client (#1323)
---
 api/internal/core/storage/etcd.go | 48 ++-
 api/internal/core/store/store.go  |  2 +-
 api/internal/core/store/store_test.go |  2 +-
 3 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/api/internal/core/storage/etcd.go 
b/api/internal/core/storage/etcd.go
index fb879b3..4bd3ea8 100644
--- a/api/internal/core/storage/etcd.go
+++ b/api/internal/core/storage/etcd.go
@@ -33,6 +33,7 @@ var (
 )
 
 type EtcdV3Storage struct {
+   client *clientv3.Client
 }
 
 func InitETCDClient(etcdConf *conf.Etcd) error {
@@ -46,11 +47,38 @@ func InitETCDClient(etcdConf *conf.Etcd) error {
log.Errorf("init etcd failed: %s", err)
return fmt.Errorf("init etcd failed: %s", err)
}
+
Client = cli
utils.AppendToClosers(Close)
return nil
 }
 
+func GenEtcdStorage() *EtcdV3Storage {
+   return &EtcdV3Storage{
+   client: Client,
+   }
+}
+
+func NewETCDStorage(etcdConf *conf.Etcd) (*EtcdV3Storage, error) {
+   cli, err := clientv3.New(clientv3.Config{
+   Endpoints:   etcdConf.Endpoints,
+   DialTimeout: 5 * time.Second,
+   Username:etcdConf.Username,
+   Password:etcdConf.Password,
+   })
+   if err != nil {
+   log.Errorf("init etcd failed: %s", err)
+   return nil, fmt.Errorf("init etcd failed: %s", err)
+   }
+
+   s := &EtcdV3Storage{
+   client: cli,
+   }
+
+   utils.AppendToClosers(s.Close)
+   return s, nil
+}
+
 func Close() error {
if err := Client.Close(); err != nil {
log.Errorf("etcd client close failed: %s", err)
@@ -59,8 +87,16 @@ func Close() error {
return nil
 }
 
+func (s *EtcdV3Storage) Close() error {
+   if err := s.client.Close(); err != nil {
+   log.Errorf("etcd client close failed: %s", err)
+   return err
+   }
+   return nil
+}
+
 func (s *EtcdV3Storage) Get(ctx context.Context, key string) (string, error) {
-   resp, err := Client.Get(ctx, key)
+   resp, err := s.client.Get(ctx, key)
if err != nil {
log.Errorf("etcd get failed: %s", err)
return "", fmt.Errorf("etcd get failed: %s", err)
@@ -74,7 +110,7 @@ func (s *EtcdV3Storage) Get(ctx context.Context, key string) 
(string, error) {
 }
 
 func (s *EtcdV3Storage) List(ctx context.Context, key string) ([]Keypair, 
error) {
-   resp, err := Client.Get(ctx, key, clientv3.WithPrefix())
+   resp, err := s.client.Get(ctx, key, clientv3.WithPrefix())
if err != nil {
log.Errorf("etcd get failed: %s", err)
return nil, fmt.Errorf("etcd get failed: %s", err)
@@ -92,7 +128,7 @@ func (s *EtcdV3Storage) List(ctx context.Context, key 
string) ([]Keypair, error)
 }
 
 func (s *EtcdV3Storage) Create(ctx context.Context, key, val string) error {
-   _, err := Client.Put(ctx, key, val)
+   _, err := s.client.Put(ctx, key, val)
if err != nil {
log.Errorf("etcd put failed: %s", err)
return fmt.Errorf("etcd put failed: %s", err)
@@ -101,7 +137,7 @@ func (s *EtcdV3Storage) Create(ctx context.Context, key, 
val string) error {
 }
 
 func (s *EtcdV3Storage) Update(ctx context.Context, key, val string) error {
-   _, err := Client.Put(ctx, key, val)
+   _, err := s.client.Put(ctx, key, val)
if err != nil {
log.Errorf("etcd put failed: %s", err)
return fmt.Errorf("etcd put failed: %s", err)
@@ -111,7 +147,7 @@ func (s *EtcdV3Storage) Update(ctx context.Context, key, 
val string) error {
 
 func (s *EtcdV3Storage) BatchDelete(ctx context.Context, keys []string) error {
for i := range keys {
-   resp, err := Client.Delete(ctx, keys[i])
+   resp, err := s.client.Delete(ctx, keys[i])
if err != nil {
log.Errorf("delete etcd key[%s] failed: %s", keys[i], 
err)
return fmt.Errorf("delete etcd key[%s] failed: %s", 
keys[i], err)
@@ -125,7 +161,7 @@ func (s *EtcdV3Storage) BatchDelete(ctx context.Context, 
keys []string) error {
 }
 
 func (s *EtcdV3Storage) Watch(ctx context.Context, key string) 

[apisix] branch master updated (45f7dd6 -> d1d6533)

2021-01-14 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 45f7dd6  feat: benchmark support specify upstream count (#3292)
 add d1d6533  feat: support hash on vars_combinations (#3278)

No new revisions were added by this update.

Summary of changes:
 apisix/admin/upstreams.lua |  4 ++
 apisix/balancer/chash.lua  |  6 +++
 apisix/schema_def.lua  |  6 +++
 doc/admin-api.md   |  1 +
 t/node/chash-hashon.t  | 91 ++
 5 files changed, 108 insertions(+)



[apisix] branch master updated: feat: benchmark support specify upstream count (#3292)

2021-01-14 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 45f7dd6  feat: benchmark support specify upstream count (#3292)
45f7dd6 is described below

commit 45f7dd6c6dc7d75ca137a10707e6b28fa3516b7f
Author: 大可 
AuthorDate: Fri Jan 15 10:14:23 2021 +0800

feat: benchmark support specify upstream count (#3292)
---
 benchmark/run.sh | 30 +-
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/benchmark/run.sh b/benchmark/run.sh
index fa3fc3c..f3268f6 100755
--- a/benchmark/run.sh
+++ b/benchmark/run.sh
@@ -23,10 +23,15 @@ else
 worker_cnt=1
 fi
 
+if [ -n "$2" ]; then
+upstream_cnt=$2
+else
+upstream_cnt=1
+fi
+
 mkdir -p benchmark/server/logs
 mkdir -p benchmark/fake-apisix/logs
 
-sudo openresty -p $PWD/benchmark/server || exit 1
 
 make init
 
@@ -38,18 +43,33 @@ function onCtrlC () {
 sudo openresty -p $PWD/benchmark/server -s stop || exit 1
 }
 
+for up_cnt in $(seq 1 $upstream_cnt);
+do
+port=$((1979+$up_cnt))
+nginx_listen=$nginx_listen"listen $port;"
+upstream_nodes=$upstream_nodes"\"127.0.0.1:$port\":1"
+
+if [ $up_cnt -lt $upstream_cnt ]; then
+upstream_nodes=$upstream_nodes","
+fi
+done
+
 if [[ "$(uname)" == "Darwin" ]]; then
 sed  -i "" "s/worker_processes .*/worker_processes $worker_cnt;/g" 
conf/nginx.conf
+sed  -i "" "s/listen .*;/$nginx_listen/g" benchmark/server/conf/nginx.conf
 else
 sed  -i "s/worker_processes .*/worker_processes $worker_cnt;/g" 
conf/nginx.conf
+sed  -i "s/listen .*;/$nginx_listen/g" benchmark/server/conf/nginx.conf
 fi
 
+sudo openresty -p $PWD/benchmark/server || exit 1
+
 make run
 
 sleep 3
 
 #
-echo -e "\n\napisix: $worker_cnt worker + 1 upstream + no plugin"
+echo -e "\n\napisix: $worker_cnt worker + $upstream_cnt upstream + no plugin"
 
 curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
 {
@@ -59,7 +79,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 
'X-API-KEY: edd1c9f034335f13
 "upstream": {
 "type": "roundrobin",
 "nodes": {
-"127.0.0.1:1980": 1
+'$upstream_nodes'
 }
 }
 }'
@@ -75,7 +95,7 @@ wrk -d 5 -c 16 http://127.0.0.1:9080/hello
 sleep 1
 
 #
-echo -e "\n\napisix: $worker_cnt worker + 1 upstream + 2 plugins (limit-count 
+ prometheus)"
+echo -e "\n\napisix: $worker_cnt worker + $upstream_cnt upstream + 2 plugins 
(limit-count + prometheus)"
 
 curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
 {
@@ -92,7 +112,7 @@ curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 
'X-API-KEY: edd1c9f034335f13
 "upstream": {
 "type": "roundrobin",
 "nodes": {
-"127.0.0.1:1980": 1
+'$upstream_nodes'
 }
 }
 }'



[apisix] branch master updated (90be57f -> 1a1fe09)

2021-01-13 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 90be57f  docs: update rpm package to 2.2 (#3280)
 add 1a1fe09  fix: always inject disable field into plugin schema (#3272)

No new revisions were added by this update.

Summary of changes:
 apisix/plugin.lua   | 25 -
 apisix/plugins/error-log-logger.lua |  4 
 apisix/schema_def.lua   |  7 +--
 t/admin/plugins.t   |  2 +-
 t/control/schema.t  | 16 +---
 5 files changed, 43 insertions(+), 11 deletions(-)



[apisix-helm-chart] branch master updated: feat: support to expose admin api (#19)

2021-01-13 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
 new 7dce1da  feat: support to expose admin api (#19)
7dce1da is described below

commit 7dce1da72e6b5f6a8eb56429932d1bfa6ff041df
Author: Alex Zhang 
AuthorDate: Wed Jan 13 20:55:21 2021 +0800

feat: support to expose admin api (#19)
---
 chart/apisix/templates/configmap.yaml  |  6 ++-
 chart/apisix/templates/deployment.yaml |  5 +++
 .../{service-gateway.yaml => service-admin.yaml}   | 44 +-
 chart/apisix/templates/service-gateway.yaml|  2 +
 chart/apisix/values.yaml   |  9 +
 5 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/chart/apisix/templates/configmap.yaml 
b/chart/apisix/templates/configmap.yaml
index 36e500e..01e6987 100644
--- a/chart/apisix/templates/configmap.yaml
+++ b/chart/apisix/templates/configmap.yaml
@@ -82,7 +82,9 @@ data:
 - 0.0.0.0/0
   {{- end}}
   #   - "::/64"
-  # port_admin: 9180  # use a separate port
+  {{- if .Values.admin.enabled }}
+  port_admin: {{ .Values.admin.port }}
+  {{- end }}
 
   # Default token when use API to call for Admin API.
   # *NOTE*: Highly recommended to modify this value to protect APISIX's 
Admin API.
@@ -162,4 +164,4 @@ data:
 stream_plugins:
 {{- range $plugin := .Values.stream_plugins }}
   - {{ $plugin }}
-{{- end }}
\ No newline at end of file
+{{- end }}
diff --git a/chart/apisix/templates/deployment.yaml 
b/chart/apisix/templates/deployment.yaml
index e21bc23..f5ea61f 100644
--- a/chart/apisix/templates/deployment.yaml
+++ b/chart/apisix/templates/deployment.yaml
@@ -57,6 +57,11 @@ spec:
 - name: tls
   containerPort: {{ .Values.gateway.tls.containerPort }}
   protocol: TCP
+{{- if .Values.admin.enabled }}
+- name: admin
+  containerPort: {{ .Values.admin.port }}
+  protocol: TCP
+{{- end }}
   readinessProbe:
 failureThreshold: 6
 initialDelaySeconds: 10
diff --git a/chart/apisix/templates/service-gateway.yaml 
b/chart/apisix/templates/service-admin.yaml
similarity index 52%
copy from chart/apisix/templates/service-gateway.yaml
copy to chart/apisix/templates/service-admin.yaml
index 5866fe2..9d3b535 100644
--- a/chart/apisix/templates/service-gateway.yaml
+++ b/chart/apisix/templates/service-admin.yaml
@@ -13,53 +13,45 @@
 # 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.
-
+{{ if .Values.admin.enabled }}
 apiVersion: v1
 kind: Service
 metadata:
-  name: {{ include "apisix.fullname" . }}-gateway
+  name: {{ include "apisix.fullname" . }}-admin
   namespace: {{ .Release.Namespace }}
   annotations:
-{{- range $key, $value := .Values.gateway.annotations }}
+{{- range $key, $value := .Values.admin.annotations }}
   {{ $key }}: {{ $value | quote }}
 {{- end }}
   labels:
 {{- include "apisix.labels" . | nindent 4 }}
 spec:
-  type: {{ .Values.gateway.type }}
-  {{- if eq .Values.gateway.type "LoadBalancer" }}
-  {{- if .Values.gateway.loadBalancerIP }}
-  loadBalancerIP: {{ .Values.gateway.loadBalancerIP }}
+  type: {{ .Values.admin.type }}
+  {{- if eq .Values.admin.type "LoadBalancer" }}
+  {{- if .Values.admin.loadBalancerIP }}
+  loadBalancerIP: {{ .Values.admin.loadBalancerIP }}
   {{- end }}
-  {{- if .Values.gateway.loadBalancerSourceRanges }}
+  {{- if .Values.admin.loadBalancerSourceRanges }}
   loadBalancerSourceRanges:
-  {{- range $cidr := .Values.gateway.loadBalancerSourceRanges }}
+  {{- range $cidr := .Values.admin.loadBalancerSourceRanges }}
   - {{ $cidr }}
   {{- end }}
   {{- end }}
   {{- end }}
+  {{- if gt (len .Values.admin.externalIPs) 0 }}
   externalIPs:
-  {{- range $ip := .Values.gateway.externalIPs }}
+  {{- range $ip := .Values.admin.externalIPs }}
   - {{ $ip }}
   {{- end }}
-  ports:
-  {{- if .Values.gateway.http.enabled }}
-  - name: apisix-gateway
-port: {{ .Values.gateway.http.servicePort }}
-targetPort: {{ .Values.gateway.http.containerPort }}
-  {{- if (and (eq .Values.gateway.type "NodePort") (not (empty 
.Values.gateway.http.nodePort))) }}
-nodePort: {{ .Values.gateway.http.nodePort }}
-  {{- end }}
-protocol: TCP
   {{- end }}
-  {{- if or .Values.gateway.tls.enabled }}
-  - name: apisix-gateway-tls
-port: {{ .Values.gateway.tls.servicePort }}
-targetPort: {{ .Values.gateway.tls.containerPort }}
-  {{- if (and (eq .Values.gateway.type "NodePort") (not (empty 
.Values.gateway.tls.nodePort))) }}
-

[apisix-ingress-controller] branch master updated: chore: remove `conf/config-default.json` (#175)

2021-01-13 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis 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 5c8d7b0  chore: remove `conf/config-default.json` (#175)
5c8d7b0 is described below

commit 5c8d7b0f6e2936175c6645b6310658a2a1068e58
Author: 马胜杰 
AuthorDate: Wed Jan 13 20:41:36 2021 +0800

chore: remove `conf/config-default.json` (#175)

fix #145
---
 conf/config-default.json | 13 -
 1 file changed, 13 deletions(-)

diff --git a/conf/config-default.json b/conf/config-default.json
deleted file mode 100644
index c7f5051..000
--- a/conf/config-default.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-  "log_level": "info",
-  "log_output": "stderr",
-  "http_listen": ":8080",
-  "enable_profiling": true,
-  "kubernetes": {
-"kubeconfig": "",
-"resync_interval": "6h"
-  },
-  "apisix": {
-"base_url": "http://127.0.0.1:9080/apisix/admin";
-  }
-}



[apisix-ingress-controller] branch master updated: docs: use make cmd instead of docker build cmd (#171)

2021-01-13 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis 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 82d8fe8  docs: use make cmd instead of docker build cmd (#171)
82d8fe8 is described below

commit 82d8fe8933a81dd259823b106b52f03c8bb8577b
Author: kv 
AuthorDate: Wed Jan 13 16:56:37 2021 +0800

docs: use make cmd instead of docker build cmd (#171)
---
 docs/install.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/install.md b/docs/install.md
index e3bf5ad..42a72cf 100644
--- a/docs/install.md
+++ b/docs/install.md
@@ -71,7 +71,8 @@ helm install ingress-apisix -n ingress-apisix 
./charts/ingress-apisix
 ## Master branch builds
 
 ```shell
-docker build -t apache/ingress-controller:v0.1.0 ../.
+cd /path/to/apisix-ingress-controller
+make build-image
 ```
 
 ## Next



[apisix] branch master updated: chore: remove the obsolote etcd v2 protocol error (#3258)

2021-01-13 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 07e37bb  chore: remove the obsolote etcd v2 protocol error (#3258)
07e37bb is described below

commit 07e37bb63b7116aa603f6552cd390c9211f9ea1a
Author: 罗泽轩 
AuthorDate: Wed Jan 13 01:59:53 2021 -0600

chore: remove the obsolote etcd v2 protocol error (#3258)

The 401 error is only for v2, so it is safe to remove it now.
---
 apisix/core/config_etcd.lua | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/apisix/core/config_etcd.lua b/apisix/core/config_etcd.lua
index b3a5d13..303281c 100644
--- a/apisix/core/config_etcd.lua
+++ b/apisix/core/config_etcd.lua
@@ -320,13 +320,6 @@ local function sync_data(self)
 local res = dir_res.body.node
 local err_msg = dir_res.body.message
 if err_msg then
-if err_msg == "The event in requested index is outdated and cleared"
-   and dir_res.body.errorCode == 401 then
-self.need_reload = true
-log.warn("waitdir [", self.key, "] err: ", err_msg,
- ", need to fully reload")
-return false
-end
 return false, err
 end
 



[apisix] branch master updated (d68016e -> 57e3209)

2021-01-12 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from d68016e  docs: enrich stand alone mode's doc (#3264)
 add 57e3209  docs: fix table of contents Markdown link (#3256)

No new revisions were added by this update.

Summary of changes:
 doc/plugins/batch-requests.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[apisix] branch master updated (012484f -> 3e19b06)

2021-01-11 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 012484f  chore: enable Markdownlint rule MD038 (#3246)
 add 3e19b06  ci: support to run ci on Centos 7 (#3061)

No new revisions were added by this update.

Summary of changes:
 .github/workflows/centos7-ci.yml | 87 
 utils/centos7-ci.sh  | 85 +++
 2 files changed, 172 insertions(+)
 create mode 100644 .github/workflows/centos7-ci.yml
 create mode 100755 utils/centos7-ci.sh



[apisix] branch master updated: test: demonstrate http-logger works fine with JSON body (#3212)

2021-01-11 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new a2ad12b  test: demonstrate http-logger works fine with JSON body 
(#3212)
a2ad12b is described below

commit a2ad12bf475b9be2d5ee3e2157f70dba28d5624a
Author: 罗泽轩 
AuthorDate: Mon Jan 11 04:00:24 2021 -0600

test: demonstrate http-logger works fine with JSON body (#3212)

Close #1710
---
 t/plugin/http-logger-json.t | 64 +
 1 file changed, 64 insertions(+)

diff --git a/t/plugin/http-logger-json.t b/t/plugin/http-logger-json.t
new file mode 100644
index 000..ed727c2
--- /dev/null
+++ b/t/plugin/http-logger-json.t
@@ -0,0 +1,64 @@
+#
+# 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.
+#
+use t::APISIX 'no_plan';
+
+log_level('info');
+repeat_each(1);
+no_long_string();
+no_root_location();
+
+add_block_preprocessor(sub {
+my ($block) = @_;
+
+my $yaml_config = $block->yaml_config // <<_EOC_;
+apisix:
+node_listen: 1984
+config_center: yaml
+enable_admin: false
+_EOC_
+
+$block->set_value("yaml_config", $yaml_config);
+
+if (!$block->no_error_log) {
+$block->set_value("no_error_log", "[error]");
+}
+});
+
+run_tests;
+
+__DATA__
+
+=== TEST 1: json body
+--- apisix_yaml
+routes:
+  -
+uri: /hello
+upstream:
+nodes:
+"127.0.0.1:1980": 1
+type: roundrobin
+plugins:
+http-logger:
+batch_max_size: 1
+uri: http://127.0.0.1:1980/log
+include_req_body: true
+#END
+--- request
+POST /hello
+{"sample_payload":"hello"}
+--- error_log
+"body":"{\"sample_payload\":\"hello\"}"



[apisix-website] branch master updated: docs: update download page with correct date (#136)

2021-01-11 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
 new 6729792  docs: update download page with correct date (#136)
6729792 is described below

commit 6729792f0bd6a2181787c7154b6c990fce845726
Author: 琚致远 
AuthorDate: Mon Jan 11 16:56:44 2021 +0800

docs: update download page with correct date (#136)
---
 docs/download.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/docs/download.md b/docs/download.md
index 106eb3c..60bd36b 100644
--- a/docs/download.md
+++ b/docs/download.md
@@ -13,13 +13,13 @@ Use the links below to download the Apache APISIX™ from one 
of our mirrors.
 
 | Version | Release Date | Downloads   


   |
 | --- |  | 
--
 |
-| 2.2 | 08/01/2020   | 
[source](https://www.apache.org/dyn/closer.cgi/apisix/2.2/apache-apisix-2.2-src.tgz)
 ([asc](https://downloads.apache.org/apisix/2.2/apache-apisix-2.2-src.tgz.asc) 
[sha512](https://downloads.apache.org/apisix/2.2/apache-apisix-2.2-src.tgz.sha512))
 |
+| 2.2 | 08/01/2021   | 
[source](https://www.apache.org/dyn/closer.cgi/apisix/2.2/apache-apisix-2.2-src.tgz)
 ([asc](https://downloads.apache.org/apisix/2.2/apache-apisix-2.2-src.tgz.asc) 
[sha512](https://downloads.apache.org/apisix/2.2/apache-apisix-2.2-src.tgz.sha512))
 |
 
 ## APISIX™ Dashboard
 
 | Version | Release Date | Downloads   



|
 | --- |  | 
---
 |
-| 2.3 | 11/01/2020   | 
[source](https://www.apache.org/dyn/closer.cgi/apisix/dashboard/2.3/apisix-dashboard-2.3-src.tgz)
 
([asc](https://www.apache.org/dyn/closer.cgi/apisix/dashboard/2.3/apisix-dashboard-2.3-src.tgz.asc)
 
[sha512](https://www.apache.org/dyn/closer.cgi/apisix/dashboard/2.3/apisix-dashboard-2.3-src.tgz.sha512))
 |
+| 2.3 | 11/01/2021   | 
[source](https://www.apache.org/dyn/closer.cgi/apisix/dashboard/2.3/apisix-dashboard-2.3-src.tgz)
 
([asc](https://www.apache.org/dyn/closer.cgi/apisix/dashboard/2.3/apisix-dashboard-2.3-src.tgz.asc)
 
[sha512](https://www.apache.org/dyn/closer.cgi/apisix/dashboard/2.3/apisix-dashboard-2.3-src.tgz.sha512))
 |
 | 2.2 | 16/12/2020   | 
[source](https://www.apache.org/dyn/closer.cgi/apisix/apisix-dashboard-2.2/apache-apisix-dashboard-2.2-src.tgz)
 
([asc](https://downloads.apache.org/apisix/apisix-dashboard-2.2/apache-apisix-dashboard-2.2-src.tgz.asc)
 
[sha512](https://downloads.apache.org/apisix/apisix-dashboard-2.2/apache-apisix-dashboard-2.2-src.tgz.sha512))
 |
 
 ## APISIX™ Ingress Controller



[apisix] branch master updated: chore: capture the error while create new `healthchecker` (#3213)

2021-01-11 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 1727429  chore: capture the error while create new `healthchecker` 
(#3213)
1727429 is described below

commit 17274295bc496050d9c8a834fde01be8b8b4628c
Author: dabue <53054094+da...@users.noreply.github.com>
AuthorDate: Mon Jan 11 16:22:40 2021 +0800

chore: capture the error while create new `healthchecker` (#3213)

fix #3169
---
 apisix/balancer.lua | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/apisix/balancer.lua b/apisix/balancer.lua
index d80cb67..8523317 100644
--- a/apisix/balancer.lua
+++ b/apisix/balancer.lua
@@ -87,12 +87,17 @@ local function create_checker(upstream, healthcheck_parent)
 if healthcheck == nil then
 healthcheck = require("resty.healthcheck")
 end
-local checker = healthcheck.new({
+local checker, err = healthcheck.new({
 name = "upstream#" .. healthcheck_parent.key,
 shm_name = "upstream-healthcheck",
 checks = upstream.checks,
 })
 
+if not checker then
+core.log.error("fail to create healthcheck instance: ", err)
+return
+end
+
 local host = upstream.checks and upstream.checks.active and 
upstream.checks.active.host
 local port = upstream.checks and upstream.checks.active and 
upstream.checks.active.port
 for _, node in ipairs(upstream.nodes) do



[apisix] branch master updated: test: make admin/plugins-reload.t stable (#3192)

2021-01-10 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 9e2e5c8  test: make admin/plugins-reload.t stable (#3192)
9e2e5c8 is described below

commit 9e2e5c8a63d26d69323198b016f06c47cf994199
Author: 罗泽轩 
AuthorDate: Mon Jan 11 01:49:11 2021 -0600

test: make admin/plugins-reload.t stable (#3192)
---
 t/admin/plugins-reload.t | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/t/admin/plugins-reload.t b/t/admin/plugins-reload.t
index c84c955..61ae4e2 100644
--- a/t/admin/plugins-reload.t
+++ b/t/admin/plugins-reload.t
@@ -73,13 +73,15 @@ location /t {
 local config_util   = require("apisix.core.config_util")
 ngx.sleep(0.1) -- make sure the sync happened when admin starts is 
already finished
 
+local before_reload = true
 local plugins_conf, err
 plugins_conf, err = core.config.new("/plugins", {
 automatic = true,
 single_item = true,
 filter = function()
 -- called twice, one for readir, another for waitdir
-ngx.log(ngx.WARN, "reload plugins on node ")
+ngx.log(ngx.WARN, "reload plugins on node ",
+before_reload and "before reload" or "after reload")
 local plugins = {}
 for _, conf_value in 
config_util.iterate_values(plugins_conf.values) do
 core.table.insert_tail(plugins, unpack(conf_value.value))
@@ -91,6 +93,7 @@ location /t {
 error("failed to create etcd instance for fetching /plugins : "
 .. err)
 end
+ngx.sleep(0.5)
 
 local data = [[
 apisix:
@@ -103,6 +106,7 @@ stream_plugins:
 ]]
 require("lib.test_admin").set_config_yaml(data)
 
+before_reload = false
 local t = require("lib.test_admin").test
 local code, _, org_body = t('/apisix/admin/plugins/reload',
 ngx.HTTP_PUT)
@@ -117,10 +121,10 @@ GET /t
 --- response_body
 done
 --- grep_error_log eval
-qr/reload plugins on node/
+qr/reload plugins on node \w+ reload/
 --- grep_error_log_out
-reload plugins on node
-reload plugins on node
+reload plugins on node before reload
+reload plugins on node after reload
 --- error_log
 filter(): [{"name":"jwt-auth"},{"name":"mqtt-proxy","stream":true}]
 



[apisix-helm-chart] branch master updated: fix: asf labels (#18)

2021-01-10 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-helm-chart.git


The following commit(s) were added to refs/heads/master by this push:
 new 3f607d7  fix: asf labels (#18)
3f607d7 is described below

commit 3f607d7030a7fbf3c5a4142510458e582e93e6fc
Author: kv 
AuthorDate: Mon Jan 11 15:27:40 2021 +0800

fix: asf labels (#18)
---
 .asf.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.asf.yaml b/.asf.yaml
index 42f9bc6..e4e115c 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -20,9 +20,10 @@ github:
 homepage: https://apisix.apache.org/
 labels:
   - apisix
-  - helm chart
+  - helm
+  - chart
   - k8s
-  - Kubernetes
+  - kubernetes
 
 features:
   issues: true



[apisix-ingress-controller] branch master updated: chore: version info in Makefile (#158)

2021-01-06 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis 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 4935200  chore: version info in Makefile (#158)
4935200 is described below

commit 49352000c923dffa9a96afa3213335bd79ac15ce
Author: Alex Zhang 
AuthorDate: Thu Jan 7 13:39:35 2021 +0800

chore: version info in Makefile (#158)
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index b99752a..180f171 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@
 #
 default: help
 
-VERSION ?= 0.0.0
+VERSION ?= 0.1.0
 IMAGE_TAG ?= "latest"
 GITSHA ?= $(shell git rev-parse --short=7 HEAD)
 OSNAME ?= $(shell uname -s | tr A-Z a-z)



[apisix] branch master updated: ci: update the title of ci (#3172)

2021-01-05 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 2b18ccc  ci: update the title of ci (#3172)
2b18ccc is described below

commit 2b18cccf4758316179a067455610717f765b4dc9
Author: dabue <53054094+da...@users.noreply.github.com>
AuthorDate: Tue Jan 5 21:08:14 2021 +0800

ci: update the title of ci (#3172)

fix #3167
---
 .github/workflows/build.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index fba8558..b921db0 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,4 +1,4 @@
-name: build
+name: CI
 
 on:
   push:



[apisix] branch master updated: docs: sync English version (#2605)

2021-01-04 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new ad4a222  docs: sync English version (#2605)
ad4a222 is described below

commit ad4a222403381402e1acb1d0b44408177a264f78
Author: idbeta 
AuthorDate: Tue Jan 5 12:22:46 2021 +0800

docs: sync English version (#2605)

fix #2583
---
 FAQ.md | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/FAQ.md b/FAQ.md
index 3a87dac..873e0b6 100644
--- a/FAQ.md
+++ b/FAQ.md
@@ -293,6 +293,17 @@ By default, APISIX only listens on port 9080 when handling 
HTTP requests. If you
 
 2. Reload or restart APISIX
 
+## How does APISIX use etcd to achieve millisecond-level configuration 
synchronization
+
+etcd provides subscription funtions to monitor whether the specified keyword 
or directory is changed (for example: 
[watch](https://github.com/api7/lua-resty-etcd/blob/master/api_v3.md#watch), 
[watchdir](https://github.com/api7/lua-resty-etcd/blob/master/api_v3.md#watchdir)).
+
+APISIX uses 
[etcd.watchdir](https://github.com/api7/lua-resty-etcd/blob/master/api_v3.md#watchdir)
 to monitor directory content changes:
+
+* If there is no data update in the monitoring directory: the process will be 
blocked until timeout or other errors occurred.
+* If the monitoring directory has data updates: etcd will return the new 
subscribed data immediately (in milliseconds), and APISIX will update it to the 
memory cache.
+
+With the help of etcd which incremental notification feature is 
millisecond-level , APISIX achieve millisecond-level of configuration 
synchronization.
+
 ## How to customize the APISIX instance id?
 
 By default, APISIX will read the instance id from `conf/apisix.uid`. If it is 
not found, and no id is configured, APISIX will generate a `uuid` as the 
instance id.



[apisix] 01/01: chore: enable plugin `server-info` by default.

2020-12-31 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch membphis/patch-1
in repository https://gitbox.apache.org/repos/asf/apisix.git

commit 1a85c97e10c04e45fdf4cd97450bec3e132a21a3
Author: YuanSheng Wang 
AuthorDate: Thu Dec 31 17:17:22 2020 +0800

chore: enable plugin `server-info` by default.
---
 conf/config-default.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index 7638f04..c9c372f 100644
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -248,7 +248,7 @@ plugins:  # plugin list (sorted in 
alphabetical order)
   - uri-blocker
   - wolf-rbac
   - zipkin
-  # - server-info
+  - server-info
   - traffic-split
 
 stream_plugins:



[apisix] branch membphis/patch-1 created (now 1a85c97)

2020-12-31 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch membphis/patch-1
in repository https://gitbox.apache.org/repos/asf/apisix.git.


  at 1a85c97  chore: enable plugin `server-info` by default.

This branch includes the following new commits:

 new 1a85c97  chore: enable plugin `server-info` by default.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[apisix] branch master updated: feat: allow host with underscore (#3165)

2020-12-30 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 65579fc  feat: allow host with underscore (#3165)
65579fc is described below

commit 65579fc45b97b450185e9e6e30aaa596f5bee68e
Author: 罗泽轩 
AuthorDate: Thu Dec 31 11:48:54 2020 +0800

feat: allow host with underscore (#3165)
---
 apisix/schema_def.lua|  2 +-
 t/admin/routes.t |  8 
 t/config-center-yaml/route.t | 26 ++
 3 files changed, 31 insertions(+), 5 deletions(-)

diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua
index 322f289..4992ea9 100644
--- a/apisix/schema_def.lua
+++ b/apisix/schema_def.lua
@@ -37,7 +37,7 @@ local id_schema = {
 }
 }
 
-local host_def_pat = "^\\*?[0-9a-zA-Z-.]+$"
+local host_def_pat = "^\\*?[0-9a-zA-Z-._]+$"
 local host_def = {
 type = "string",
 pattern = host_def_pat,
diff --git a/t/admin/routes.t b/t/admin/routes.t
index 72b0dd4..7f51420 100644
--- a/t/admin/routes.t
+++ b/t/admin/routes.t
@@ -798,8 +798,8 @@ passed
 --- request
 GET /t
 --- error_code: 400
 response_body
-{"error_msg":"invalid configuration: property \"host\" validation failed: 
failed to match pattern \"^*?[0-9a-zA-Z-.]+$\" with \"a.*.foo.com\""}
+--- response_body_like
+{"error_msg":"invalid configuration: property \\"host\\" validation failed: 
failed to match pattern .*
 --- no_error_log
 [error]
 
@@ -831,8 +831,8 @@ GET /t
 --- request
 GET /t
 --- error_code: 400
 response_body
-{"error_msg":"invalid configuration: property \"host\" validation failed: 
failed to match pattern \"^*?[0-9a-zA-Z-.]+$\" with \"*.a.*.foo.com\""}
+--- response_body_like
+{"error_msg":"invalid configuration: property \\"host\\" validation failed: 
failed to match pattern .*
 --- no_error_log
 [error]
 
diff --git a/t/config-center-yaml/route.t b/t/config-center-yaml/route.t
index 9c5e30c..55653a4 100644
--- a/t/config-center-yaml/route.t
+++ b/t/config-center-yaml/route.t
@@ -255,3 +255,29 @@ routes:
 --- request
 GET /hello
 --- error_code: 200
+
+
+
+=== TEST 10: hosts with '_' is valid
+--- yaml_config eval: $::yaml_config
+--- apisix_yaml
+routes:
+  -
+id: 1
+uri: /hello
+hosts:
+- foo.com
+- v1_test-api.com
+upstream:
+nodes:
+"127.0.0.1:1980": 1
+type: roundrobin
+#END
+--- more_headers
+host: v1_test-api.com
+--- request
+GET /hello
+--- response_body
+hello world
+--- no_error_log
+[error]



[apisix-website] branch master updated: Revert "fix: modify the download link of ingress-controller 0.1.0 (#121)" (#122)

2020-12-30 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
 new 274f35d  Revert "fix: modify the download link of ingress-controller 
0.1.0 (#121)" (#122)
274f35d is described below

commit 274f35d90df81affdda1648796529158074e410e
Author: 琚致远 
AuthorDate: Wed Dec 30 19:30:20 2020 -0600

Revert "fix: modify the download link of ingress-controller 0.1.0 (#121)" 
(#122)

This reverts commit b85b7c6e11155ea9c3c7028d5487511bc4cde0bb.
---
 docs/download.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/download.md b/docs/download.md
index 8bd2486..6cfdcad 100644
--- a/docs/download.md
+++ b/docs/download.md
@@ -24,7 +24,7 @@ Use the links below to download the Apache APISIX™ from one 
of our mirrors.
 
 | Version | Release Date | Downloads   



|
 | --- |  | 
---
 |
-| 0.1.0 | 24/12/2020   | 
[source](https://www.apache.org/dyn/closer.cgi/apisix/apisix-ingress-controller-0.1.0/apache-apisix-ingress-controller-0.1.0-rc2-src.tar.gz)
 
([asc](https://www.apache.org/dyn/closer.cgi/apisix/apisix-ingress-controller-0.1.0/apache-apisix-ingress-controller-0.1.0-rc2-src.tar.gz.asc)
 
[sha512](https://www.apache.org/dyn/closer.cgi/apisix/apisix-ingress-controller-0.1.0/apache-apisix-ingress-controller-0.1.0-rc2-src.tar.gz.sha512))
 |
+| 0.1.0 | 24/12/2020   | 
[source](https://www.apache.org/dyn/closer.cgi/apisix/apisix-ingress-controller-0.1.0/apache-apisix-ingress-controller-0.1.0-src.tar.gz)
 
([asc](https://www.apache.org/dyn/closer.cgi/apisix/apisix-ingress-controller-0.1.0/apache-apisix-ingress-controller-0.1.0-src.tar.gz.asc)
 
[sha512](https://www.apache.org/dyn/closer.cgi/apisix/apisix-ingress-controller-0.1.0/apache-apisix-ingress-controller-0.1.0-src.tar.gz.sha512))
 |
 
 ## Verify the releases
 



[apisix] branch master updated: chore: improve HTTPS doc (#3149)

2020-12-30 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 13ab490  chore: improve HTTPS doc (#3149)
13ab490 is described below

commit 13ab4903b4581f60466d4563ed74443c90acf943
Author: 罗泽轩 
AuthorDate: Wed Dec 30 22:57:00 2020 +0800

chore: improve HTTPS doc (#3149)
---
 apisix/schema_def.lua  |   3 +-
 doc/admin-api.md   |   5 +-
 doc/https.md   |  75 
 doc/stand-alone.md |   3 +-
 doc/zh-cn/admin-api.md |   5 +-
 doc/zh-cn/https.md |  77 +
 doc/zh-cn/stand-alone.md   |   3 +-
 t/admin/ssl2.t |  29 
 t/config-center-yaml/ssl.t | 168 +
 9 files changed, 293 insertions(+), 75 deletions(-)

diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua
index 2732edb..322f289 100644
--- a/apisix/schema_def.lua
+++ b/apisix/schema_def.lua
@@ -621,7 +621,8 @@ _M.ssl = {
 items = {
 type = "string",
 pattern = [[^\*?[0-9a-zA-Z-.]+$]],
-}
+},
+minItems = 1,
 },
 certs = {
 type = "array",
diff --git a/doc/admin-api.md b/doc/admin-api.md
index 94ea65c..ffa8df4 100644
--- a/doc/admin-api.md
+++ b/doc/admin-api.md
@@ -667,10 +667,11 @@ Return response from etcd currently.
 |key|True|Private key|https private key||
 |certs|False|An array of certificate|when you need to configure multiple 
certificate for the same domain, you can pass extra https certificates 
(excluding the one given as cert) in this field||
 |keys|False|An array of private key|https private keys. The keys should be 
paired with certs above||
-|sni|True|Match Rules|https SNI||
+|snis|True|Match Rules|a non-empty arrays of https SNI||
 |labels|False |Match Rules|Key/value pairs to specify 
attributes|{"version":"v2","build":"16","env":"production"}|
 |create_time|False| Auxiliary|epoch timestamp in second, will be created 
automatically if missing | 1602883670|
 |update_time|False| Auxiliary|epoch timestamp in second, will be created 
automatically if missing | 1602883670|
+|status|False|Auxiliary|enable this SSL, default `1`.|`1` to enable, `0` to 
disable|
 
 Config Example:
 
@@ -679,7 +680,7 @@ Config Example:
 "id": "1",  # id
 "cert": "cert", # Certificate
 "key": "key",   # Private key
-"sni": "sni"# https SNI
+"snis": ["t.com"]# https SNI
 }
 ```
 
diff --git a/doc/https.md b/doc/https.md
index 7e4bd7a..53092a5 100644
--- a/doc/https.md
+++ b/doc/https.md
@@ -29,14 +29,53 @@ It is most common for an SSL certificate to contain only 
one domain. We can crea
 
 * `cert`: PEM-encoded public certificate of the SSL key pair.
 * `key`: PEM-encoded private key of the SSL key pair.
-* `sni`: Hostname to associate with this certificate as SNIs. To set this 
attribute this certificate must have a valid private key associated with it.
+* `snis`: Hostname(s) to associate with this certificate as SNIs. To set this 
attribute this certificate must have a valid private key associated with it.
+
+We will use the python script below to simplify the example:
+```python
+#!/usr/bin/env python
+# coding: utf-8
+# save this file as ssl.py
+import sys
+# sudo pip install requests
+import requests
+
+if len(sys.argv) <= 3:
+print("bad argument")
+sys.exit(1)
+with open(sys.argv[1]) as f:
+cert = f.read()
+with open(sys.argv[2]) as f:
+key = f.read()
+sni = sys.argv[3]
+api_key = "edd1c9f034335f136f87ad84b625c8f1"
+resp = requests.put("http://127.0.0.1:9080/apisix/admin/ssl/1";, json={
+"cert": cert,
+"key": key,
+"snis": [sni],
+}, headers={
+"X-API-KEY": api_key,
+})
+print(resp.status_code)
+print(resp.text)
+```
 
 ```shell
-curl http://127.0.0.1:9080/apisix/admin/ssl/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+# create SSL object
+./ssl.py t.crt t.key test.com
+
+# create Router object
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -i -d '
 {
-"cert": "...",
-"key": "",
-"sni": "test.com"
+"uri": "/hello",
+"hosts": ["test.com"],
+"methods": ["GET"],
+"upstream": {
+"type": "roundrobin",
+"nodes": {
+"127.0.0.1:1980": 1
+}
+}
 }'
 
 # make a test
@@ -66,14 +

[apisix] branch master updated: change: don't treat route segment with ':' as parameter by default (#3154)

2020-12-30 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 81c1c7c  change: don't treat route segment with ':' as parameter by 
default (#3154)
81c1c7c is described below

commit 81c1c7c0778b11bdef274be1d5c4e54e1429cc21
Author: 罗泽轩 
AuthorDate: Wed Dec 30 22:13:05 2020 +0800

change: don't treat route segment with ':' as parameter by default (#3154)

Fix #3134
---
 apisix/admin/init.lua  |   2 +-
 apisix/api_router.lua  |   2 +-
 apisix/control/router.lua  |   2 +-
 apisix/http/router/{radixtree_uri.lua => base.lua} |  43 ++-
 apisix/http/router/radixtree_host_uri.lua  |  29 +
 apisix/http/router/radixtree_uri.lua   |  99 +--
 .../http/router/radixtree_uri_with_parameter.lua   |  46 +++
 apisix/router.lua  |  23 
 apisix/ssl/router/radixtree_sni.lua|   4 +-
 apisix/utils/router.lua|  34 +
 conf/config-default.yaml   |   3 +
 doc/architecture-design.md |   1 +
 doc/router-radixtree.md|  20 +++
 doc/zh-cn/architecture-design.md   |   1 +
 rockspec/apisix-master-0.rockspec  |   2 +-
 t/router/radixtree-host-uri2.t | 139 +
 t/router/radixtree-uri-host.t  |  53 
 .../radixtree-uri-with-parameter.t}|  16 +++
 18 files changed, 362 insertions(+), 157 deletions(-)

diff --git a/apisix/admin/init.lua b/apisix/admin/init.lua
index b5a20af..12f63f4 100644
--- a/apisix/admin/init.lua
+++ b/apisix/admin/init.lua
@@ -16,7 +16,7 @@
 --
 local require = require
 local core = require("apisix.core")
-local route = require("resty.radixtree")
+local route = require("apisix.utils.router")
 local plugin = require("apisix.plugin")
 local ngx = ngx
 local get_method = ngx.req.get_method
diff --git a/apisix/api_router.lua b/apisix/api_router.lua
index 3f1cebc..f382258 100644
--- a/apisix/api_router.lua
+++ b/apisix/api_router.lua
@@ -15,7 +15,7 @@
 -- limitations under the License.
 --
 local require = require
-local router = require("resty.radixtree")
+local router = require("apisix.utils.router")
 local plugin_mod = require("apisix.plugin")
 local ip_restriction = require("apisix.plugins.ip-restriction")
 local core = require("apisix.core")
diff --git a/apisix/control/router.lua b/apisix/control/router.lua
index 86ea769..821cee8 100644
--- a/apisix/control/router.lua
+++ b/apisix/control/router.lua
@@ -15,7 +15,7 @@
 -- limitations under the License.
 --
 local require = require
-local router = require("resty.radixtree")
+local router = require("apisix.utils.router")
 local builtin_v1_routes = require("apisix.control.v1")
 local plugin_mod = require("apisix.plugin")
 local core = require("apisix.core")
diff --git a/apisix/http/router/radixtree_uri.lua b/apisix/http/router/base.lua
similarity index 81%
copy from apisix/http/router/radixtree_uri.lua
copy to apisix/http/router/base.lua
index 41ceb68..1cef301 100644
--- a/apisix/http/router/radixtree_uri.lua
+++ b/apisix/http/router/base.lua
@@ -15,23 +15,20 @@
 -- limitations under the License.
 --
 local require = require
-local router = require("resty.radixtree")
+local radixtree = require("resty.radixtree")
+local router = require("apisix.utils.router")
 local core = require("apisix.core")
 local http_route = require("apisix.http.route")
 local ipairs = ipairs
 local type = type
 local error = error
 local loadstring = loadstring
-local user_routes
-local cached_version
 
 
-local _M = {version = 0.2}
+local _M = {}
 
 
-local uri_routes = {}
-local uri_router
-local function create_radixtree_router(routes)
+function _M.create_radixtree_uri_router(routes, uri_routes, with_parameter)
 routes = routes or {}
 
 core.table.clear(uri_routes)
@@ -81,22 +78,16 @@ local function create_radixtree_router(routes)
 end
 
 core.log.info("route items: ", core.json.delay_encode(uri_routes, true))
-uri_router = router.new(uri_routes)
-end
-
 
-local match_opts = {}
-function _M.match(api_ctx)
-if not cached_version or cached_version ~= user_routes.conf_version then
-create_radixtree_router(user_routes.values)
-cached_version = user_routes.conf_version
+if with_parameter then
+return radixtree.new(uri_routes)
+else
+return router.new(uri_routes)
 end
+end
 
-if not uri_router then
-   

[apisix] branch master updated (0597c57 -> b80020e)

2020-12-29 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 0597c57  chore: tweak the uri to view plug-in types (#3153)
 add b80020e  docs: added interface to get list part for Admin API (#3138)

No new revisions were added by this update.

Summary of changes:
 doc/admin-api.md   | 5 +
 doc/zh-cn/admin-api.md | 5 +
 2 files changed, 10 insertions(+)



[apisix] branch master updated (b1e5edd -> 078a062)

2020-12-28 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from b1e5edd  tests: fix unstable test in traffic-split.t (#3135)
 add 078a062  docs: mention iresty/test-nginx should be used (#3119)

No new revisions were added by this update.

Summary of changes:
 doc/how-to-build.md   | 4 ++--
 doc/zh-cn/how-to-build.md | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)



[apisix-dashboard] branch master updated: test: add frontend e2e test (smoke test for settings page) (#1105)

2020-12-27 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
 new c341e2e  test: add frontend e2e test (smoke test for settings page) 
(#1105)
c341e2e is described below

commit c341e2e1ae0bf4a5d5479703365c12774b99eb75
Author: idbeta 
AuthorDate: Sun Dec 27 22:01:16 2020 +0800

test: add frontend e2e test (smoke test for settings page) (#1105)
---
 .../settings/settings-smoketest.spec.js| 65 ++
 1 file changed, 65 insertions(+)

diff --git a/web/cypress/integration/settings/settings-smoketest.spec.js 
b/web/cypress/integration/settings/settings-smoketest.spec.js
new file mode 100644
index 000..77b3676
--- /dev/null
+++ b/web/cypress/integration/settings/settings-smoketest.spec.js
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+/* eslint-disable no-undef */
+
+context('settings page smoke test', () => {
+  const domSelectors = {
+pageContent: '.ant-pro-page-container',
+notificationMsg: '.ant-notification-notice-message'
+  };
+
+  beforeEach(() => {
+// init login 
+cy.login();
+  })
+
+  it('should visit settings page', () => {
+// go to settings page
+cy.visit('/');
+cy.contains('Settings').click();
+cy.wait(500);
+cy.url().should('contains', '/settings');
+cy.get(domSelectors.pageContent)
+  .children()
+  .should('contain', 'Setting')
+  .and('contain', 'Grafana Address')
+  .and('contain', 'Grafana address should begin with HTTP or HTTPS')
+  });
+
+  it('should set a invaild url', () => {
+cy.visit('/');
+cy.contains('Settings').click();
+cy.wait(500);
+cy.url().should('contains', '/settings');
+cy.get('#grafanaURL').clear().type('httx://www.test.com');
+cy.get('.ant-form-item-explain').should('contain', 'Address is 
illegality');
+  });
+
+  it('should set a accessible url', () => {
+cy.visit('/');
+cy.contains('Settings').click();
+cy.wait(500);
+cy.url().should('contains', '/settings');
+cy.get('#grafanaURL').clear().type('https://apisix.apache.org/');
+cy.contains('Submit').click();
+cy.get(domSelectors.notificationMsg).should('contain', 'Update 
Configuration Successfully');
+cy.wait(1000);
+cy.get(domSelectors.pageContent)
+  .children()
+  .should('contain', 'Metrics')
+  });
+})



[apisix-ingress-controller] branch master updated: chore: prometheus metrics handler (#127)

2020-12-23 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis 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 38d98a7  chore: prometheus metrics handler (#127)
38d98a7 is described below

commit 38d98a735970b854f4dfccc4c43e826a0197c39f
Author: Alex Zhang 
AuthorDate: Wed Dec 23 23:19:11 2020 +0800

chore: prometheus metrics handler (#127)
---
 go.mod|  1 +
 go.sum|  6 ++
 pkg/api/router/router.go  | 10 ++
 pkg/api/router/router_test.go | 12 
 4 files changed, 29 insertions(+)

diff --git a/go.mod b/go.mod
index 74c670e..261896d 100644
--- a/go.mod
+++ b/go.mod
@@ -9,6 +9,7 @@ require (
github.com/gxthrj/apisix-ingress-types v0.1.3
github.com/gxthrj/apisix-types v0.1.3
github.com/gxthrj/seven v0.2.7
+   github.com/prometheus/client_golang v0.9.3
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.4.0
go.uber.org/zap v1.13.0
diff --git a/go.sum b/go.sum
index 318b236..32e6a93 100644
--- a/go.sum
+++ b/go.sum
@@ -26,6 +26,7 @@ github.com/armon/circbuf 
v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hC
 github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod 
h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
 github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod 
h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
 github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod 
h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
+github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
 github.com/beorn7/perks v1.0.0/go.mod 
h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
 github.com/bgentry/speakeasy v0.1.0/go.mod 
h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
 github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod 
h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
@@ -175,6 +176,7 @@ github.com/mattn/go-isatty v0.0.3/go.mod 
h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx
 github.com/mattn/go-isatty v0.0.8/go.mod 
h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
 github.com/mattn/go-isatty v0.0.12 
h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
 github.com/mattn/go-isatty v0.0.12/go.mod 
h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
+github.com/matttproud/golang_protobuf_extensions v1.0.1 
h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
 github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod 
h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
 github.com/miekg/dns v1.0.14/go.mod 
h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
 github.com/mitchellh/cli v1.0.0/go.mod 
h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
@@ -210,12 +212,16 @@ github.com/pmezard/go-difflib v1.0.0 
h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
 github.com/pmezard/go-difflib v1.0.0/go.mod 
h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/posener/complete v1.1.1/go.mod 
h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
 github.com/prometheus/client_golang v0.9.1/go.mod 
h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_golang v0.9.3 
h1:9iH4JKXLzFbOAdtqv/a+j8aewx2Y8lAjAydhbaScPF8=
 github.com/prometheus/client_golang v0.9.3/go.mod 
h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
 github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod 
h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 
h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE=
 github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod 
h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
 github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod 
h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
+github.com/prometheus/common v0.4.0 
h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM=
 github.com/prometheus/common v0.4.0/go.mod 
h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
 github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod 
h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084 
h1:sofwID9zm4tzrgykg80hfFph1mryUeLRsUfoocVVmRY=
 github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod 
h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
 github.com/prometheus/tsdb v0.7.1/go.mod 
h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
 github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod 
h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
diff --git a/pkg/api/router/router.go b/pkg/api/router/router.go
index 6f695a0..4a5b892 100644
--- a/pkg/api/router/router.go
+++ b/pkg/api/router/router.go
@@ -18,6 +18,7 @@ import (
"net/http"
 
"github.com/gin-gonic/gin"
+   "github.com/prometheus/client_golang/prometheus/promhttp"
 )
 
 type hea

[apisix] branch master updated: feat: add script_id field used by dashboard (#3096)

2020-12-23 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new a661b94  feat: add script_id field used by dashboard (#3096)
a661b94 is described below

commit a661b940b0ae2fe45a8a8612e41d7bcda136a0c4
Author: 罗泽轩 
AuthorDate: Wed Dec 23 19:17:26 2020 +0800

feat: add script_id field used by dashboard (#3096)

Used as a reference to script metadata.
---
 apisix/schema_def.lua|  2 ++
 t/config-center-yaml/route.t | 24 
 2 files changed, 26 insertions(+)

diff --git a/apisix/schema_def.lua b/apisix/schema_def.lua
index bc07765..f4af8d0 100644
--- a/apisix/schema_def.lua
+++ b/apisix/schema_def.lua
@@ -459,7 +459,9 @@ _M.route = {
 pattern = [[^function]],
 },
 
+-- The 'script' fields below are used by dashboard for plugin 
orchestration
 script = {type = "string", minLength = 10, maxLength = 102400},
+script_id = id_schema,
 
 plugins = plugins_schema,
 upstream = upstream_schema,
diff --git a/t/config-center-yaml/route.t b/t/config-center-yaml/route.t
index 791defb..9c5e30c 100644
--- a/t/config-center-yaml/route.t
+++ b/t/config-center-yaml/route.t
@@ -231,3 +231,27 @@ routes:
 --- request
 GET /hello
 --- error_code: 404
+
+
+
+=== TEST 9: script with id
+--- yaml_config
+apisix:
+node_listen: 1984
+config_center: yaml
+enable_admin: false
+--- apisix_yaml
+routes:
+  -
+id: 1
+uri: /hello
+script: "local ngx = ngx"
+script_id: "1"
+upstream:
+nodes:
+"127.0.0.1:1980": 1
+type: roundrobin
+#END
+--- request
+GET /hello
+--- error_code: 200



[apisix] branch master updated (8eaa187 -> 357a2ef)

2020-12-23 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 8eaa187  docs: when opening issue, also mention the Nginx version 
(#3101)
 add 357a2ef  feat: expose schema via control API (#3092)

No new revisions were added by this update.

Summary of changes:
 apisix/control/v1.lua | 27 +++-
 apisix/core/table.lua | 13 
 apisix/plugin.lua | 19 
 doc/control-api.md| 30 +-
 t/control/schema.t| 85 +++
 t/core/table.t| 33 
 t/lib/test_admin.lua  |  2 +-
 7 files changed, 206 insertions(+), 3 deletions(-)
 create mode 100644 t/control/schema.t



[apisix] branch master updated (c3d61fc -> 560a2fe)

2020-12-22 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from c3d61fc  feat: add control api for plugin server-info (#3088)
 add 560a2fe  change: remove k8s_deployment_info (#3098)

No new revisions were added by this update.

Summary of changes:
 apisix/schema_def.lua| 20 
 doc/admin-api.md | 18 +--
 doc/architecture-design.md   | 34 +++-
 doc/zh-cn/admin-api.md   | 20 ++--
 doc/zh-cn/architecture-design.md | 38 ++
 t/node/upstream.t| 69 ++--
 6 files changed, 43 insertions(+), 156 deletions(-)



[apisix-website] branch master updated: feat: Added issue and pr templates :tada: (#116)

2020-12-21 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
 new 956f452  feat: Added issue and pr templates :tada: (#116)
956f452 is described below

commit 956f452eec942427be46d7b9ad0d6d7658c0fd9d
Author: Arijit Kundu <53327173+covalentb...@users.noreply.github.com>
AuthorDate: Tue Dec 22 09:07:59 2020 +0530

feat: Added issue and pr templates :tada: (#116)

fix #115
---
 .github/issue_template.md| 19 +++
 .github/pull_request_template.md |  7 +++
 2 files changed, 26 insertions(+)

diff --git a/.github/issue_template.md b/.github/issue_template.md
new file mode 100644
index 000..d623cb4
--- /dev/null
+++ b/.github/issue_template.md
@@ -0,0 +1,19 @@
+**Actual Behaviour**
+
+ 
+
+ **Expected Behaviour**
+
+ 
+
+ **Steps to reproduce it**
+
+ 
+
+ **Screenshots of the issue**
+
+ 
+
+ **Would you like to work on the issue?**
+
+ 
\ No newline at end of file
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
new file mode 100644
index 000..3fd6141
--- /dev/null
+++ b/.github/pull_request_template.md
@@ -0,0 +1,7 @@
+Fixes: #[Add issue number here]
+
+Changes:
+
+
+Screenshots of the change:
+
\ No newline at end of file



[apisix-website] branch master updated: docs: Updated contributor's guide :zap: (#117)

2020-12-21 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
 new c2eba11  docs: Updated contributor's guide :zap: (#117)
c2eba11 is described below

commit c2eba11c6353495425fb036e707386db3b3215fe
Author: Arijit Kundu <53327173+covalentb...@users.noreply.github.com>
AuthorDate: Tue Dec 22 09:06:24 2020 +0530

docs: Updated contributor's guide :zap: (#117)
---
 docs/contributor-guide.md | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/docs/contributor-guide.md b/docs/contributor-guide.md
index ae1f813..6b30911 100644
--- a/docs/contributor-guide.md
+++ b/docs/contributor-guide.md
@@ -69,7 +69,9 @@ $ git push origin issueNo
 
 2. The mentor will do codes review before discussing some details (including 
the design, the implementation and the performance) with you.
 
-3. Then congratulate to you to be an official contributor of Apache APISIX.
+3. Also make sure that the pull request title has a semantic prefix like 
`fix:` or `feat:` or any other [conventional commit 
types](https://github.com/commitizen/conventional-commit-types/blob/master/index.json).
+
+4. Then congratulate to you to be an official contributor of Apache APISIX.
 
 ### Delete branch
 



[apisix] branch master updated: feat: add control api for plugin server-info (#3088)

2020-12-21 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new c3d61fc  feat: add control api for plugin server-info (#3088)
c3d61fc is described below

commit c3d61fcfa371e4ca23e73af832141f84e53d6435
Author: Alex Zhang 
AuthorDate: Tue Dec 22 11:04:56 2020 +0800

feat: add control api for plugin server-info (#3088)

* feat: add control api for plugin server-info

Previously we added plugin server-info without exposing API since the same 
port problem of admin api and proxy. Now we have Control API support so we 
expose server-info API through Control API. People now can insight the server 
info about APISIX instance easily.
---
 apisix/plugins/server-info.lua   | 45 -
 doc/plugins/server-info.md   | 19 ++--
 doc/zh-cn/plugins/server-info.md | 19 ++--
 t/plugin/server-info.t   | 48 
 4 files changed, 126 insertions(+), 5 deletions(-)

diff --git a/apisix/plugins/server-info.lua b/apisix/plugins/server-info.lua
index 4c90682..5038eae 100644
--- a/apisix/plugins/server-info.lua
+++ b/apisix/plugins/server-info.lua
@@ -23,7 +23,7 @@ local ngx_timer_at = ngx.timer.at
 local ngx_worker_id = ngx.worker.id
 local type = type
 
-local boot_time = os.time()
+local load_time = os.time()
 local plugin_name = "server-info"
 local default_report_interval = 60
 local default_report_ttl = 7200
@@ -66,7 +66,28 @@ local _M = {
 }
 
 
+local function get_boot_time()
+local time, err = internal_status:get("server_info:boot_time")
+if err ~= nil then
+core.log.error("failed to get boot_time from shdict: ", err)
+return load_time
+end
+
+if time ~= nil then
+return time
+end
+
+local _, err = internal_status:set("server_info:boot_time", load_time)
+if err ~= nil then
+core.log.error("failed to save boot_time to shdict: ", err)
+end
+
+return load_time
+end
+
+
 local function uninitialized_server_info()
+local boot_time = get_boot_time()
 return {
 etcd_version = "unknown",
 hostname = core.utils.gethostname(),
@@ -99,6 +120,17 @@ local function get()
 end
 
 
+local function get_server_info()
+local info, err = get()
+if not info then
+core.log.error("failed to get server_info: ", err)
+return 500
+end
+
+return 200, info
+end
+
+
 local function report(premature, report_ttl)
 if premature then
 return
@@ -158,6 +190,17 @@ function _M.check_schema(conf)
 end
 
 
+function _M.control_api()
+return {
+{
+methods = {"GET"},
+uris ={"/v1/server_info"},
+handler = get_server_info,
+}
+}
+end
+
+
 function _M.init()
 core.log.info("server info: ", core.json.delay_encode(get()))
 
diff --git a/doc/plugins/server-info.md b/doc/plugins/server-info.md
index bcd2a09..cee2cae 100644
--- a/doc/plugins/server-info.md
+++ b/doc/plugins/server-info.md
@@ -50,7 +50,7 @@ None
 
 ## API
 
-None
+This plugin exposes one API `/v1/server_info` to [Control 
API](../control-api.md).
 
 ## How to Enable
 
@@ -87,7 +87,22 @@ plugin_attr:
 
 ## Test Plugin
 
-The APISIX Dashboard will collects server info in etcd, after enabling this 
plugin, you may try to check them through Dashboard.
+After enabling this plugin, you can access these data through the plugin 
Control API:
+
+```shell
+$ curl http://127.0.0.1:9090/v1/server_info -s | jq .
+{
+  "etcd_version": "3.5.0",
+  "up_time": 9460,
+  "last_report_time": 1608531519,
+  "id": "b7ce1c5c-b1aa-4df7-888a-cbe403f3e948",
+  "hostname": "fedora32",
+  "version": "2.1",
+  "boot_time": 1608522102
+}
+```
+
+The APISIX Dashboard will collects server info in etcd, so you may also try to 
check them through Dashboard.
 
 ## Disable Plugin
 
diff --git a/doc/zh-cn/plugins/server-info.md b/doc/zh-cn/plugins/server-info.md
index 375ac77..59bede4 100644
--- a/doc/zh-cn/plugins/server-info.md
+++ b/doc/zh-cn/plugins/server-info.md
@@ -51,7 +51,7 @@
 
 ## 插件接口
 
-无
+该插件在 [Control API](../../control-api.md) 下暴露了一个 API 接口 `/v1/server_info`。
 
 ## 启用插件
 
@@ -89,7 +89,22 @@ plugin_attr:
 
 ## 测试插件
 
-Apache APISIX Dashboard 会收集上报到 etcd 中的服务信息,在启用这个插件后,你可以通过 APISIX Dashboard 
来查看这些数据。
+在启用该插件后,你可以通过插件的 Control API 来访问到这些数据:
+
+```shell
+$ curl http://127.0.0.1:9090/v1/server_info -s | jq .
+{
+  "etcd_version": "3.5.0",
+  "up_time": 9460,
+  "last_report_time": 1608531519,
+  "id": "b7ce1c5c-b1aa-4df7-888a-cbe403f3e948",
+  &q

[apisix] branch master updated (31b49ad -> 7c158b7)

2020-12-20 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 31b49ad  fix: upgrade lua-resty-ngxvar to solve the upstream_xxx_time 
problem (#3065)
 add 7c158b7  refactor: don't force plugin to use /vn prefix (#3081)

No new revisions were added by this update.

Summary of changes:
 apisix/control/router.lua | 13 ++---
 apisix/control/v1.lua |  1 -
 apisix/plugins/example-plugin.lua | 17 +++--
 t/control/{v1.t => plugin-api.t}  |  0
 4 files changed, 13 insertions(+), 18 deletions(-)
 rename t/control/{v1.t => plugin-api.t} (100%)



[apisix] branch master updated (924a30d -> 310c951)

2020-12-18 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 924a30d  feat: add control API (#3048)
 add 310c951  feat: allow upstream without nodes (#3076)

No new revisions were added by this update.

Summary of changes:
 apisix/schema_def.lua  |   1 -
 doc/admin-api.md   |   2 +-
 doc/zh-cn/admin-api.md |   2 +-
 t/admin/upstream-array-nodes.t |  61 ---
 t/admin/upstream.t | 133 -
 t/admin/upstream2.t|  67 -
 6 files changed, 171 insertions(+), 95 deletions(-)



[apisix] branch master updated: feat: support ctx.var to get service_name and route_name (#3036)

2020-12-17 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new bdd00e1  feat: support ctx.var to get service_name and route_name 
(#3036)
bdd00e1 is described below

commit bdd00e1f55fd13cd3d2b12656ec1dc2d4e3f6e0b
Author: Yuelin Zheng <52862365+firstsaw...@users.noreply.github.com>
AuthorDate: Thu Dec 17 22:26:25 2020 +0800

feat: support ctx.var to get service_name and route_name (#3036)

close #2982
---
 apisix/core/ctx.lua  |   6 +
 apisix/init.lua  |   2 +
 doc/plugins/http-logger.md   |  12 +-
 doc/zh-cn/plugins/http-logger.md |  12 +-
 t/core/ctx.t | 321 +++
 5 files changed, 351 insertions(+), 2 deletions(-)

diff --git a/apisix/core/ctx.lua b/apisix/core/ctx.lua
index 4451c4b..962a270 100644
--- a/apisix/core/ctx.lua
+++ b/apisix/core/ctx.lua
@@ -174,6 +174,12 @@ do
 elseif key == "consumer_name" then
 val = ngx.ctx.api_ctx and ngx.ctx.api_ctx.consumer_name
 
+elseif key == "route_name" then
+val = ngx.ctx.api_ctx and ngx.ctx.api_ctx.route_name
+
+elseif key == "service_name" then
+val = ngx.ctx.api_ctx and ngx.ctx.api_ctx.service_name
+
 else
 val = get_var(key, t._request)
 end
diff --git a/apisix/init.lua b/apisix/init.lua
index 5a4b075..1b9c62c 100644
--- a/apisix/init.lua
+++ b/apisix/init.lua
@@ -413,6 +413,7 @@ function _M.http_access_phase()
 api_ctx.conf_version = route.modifiedIndex .. "&" .. 
service.modifiedIndex
 api_ctx.conf_id = route.value.id .. "&" .. service.value.id
 api_ctx.service_id = service.value.id
+api_ctx.service_name = service.value.name
 
 if enable_websocket == nil then
 enable_websocket = service.value.enable_websocket
@@ -424,6 +425,7 @@ function _M.http_access_phase()
 api_ctx.conf_id = route.value.id
 end
 api_ctx.route_id = route.value.id
+api_ctx.route_name = route.value.name
 
 local up_id = route.value.upstream_id
 if up_id then
diff --git a/doc/plugins/http-logger.md b/doc/plugins/http-logger.md
index 3129c79..01e3888 100644
--- a/doc/plugins/http-logger.md
+++ b/doc/plugins/http-logger.md
@@ -87,10 +87,20 @@ hello, world
 
 | Name | Type| Requirement | Default   | Valid   | 
Description 
 |
 |  | --- | --- | - | --- | 

 |
-| log_format   | object  | optional| {"host": "$host", "@timestamp": 
"$time_iso8601", "client_ip": "$remote_addr"} | | Log format declared 
as JSON object. Only string is supported in the `value` part. If the value 
starts with `$`, the value is [Nginx 
variable](http://nginx.org/en/docs/varindex.html). |
+| log_format   | object  | optional| {"host": "$host", "@timestamp": 
"$time_iso8601", "client_ip": "$remote_addr"} | | Log format declared 
as JSON object. Only string is supported in the `value` part. If the value 
starts with `$`, it means to get `APISIX` variables or [Nginx 
variable](http://nginx.org/en/docs/varindex.html). |
 
  Note that the metadata configuration is applied in global scope, which means 
it will take effect on all Route or Service which use http-logger plugin.
 
+**APISIX Variables**
+
+|   Variable Name  |  Description| Usage Example  |
+|--|-||
+| route_id | id of `route`  | $route_id  |
+| route_name   | name of `route`| $route_name|
+| service_id   | id of `service`| $service_id|
+| service_name | name of `service`  | $service_name  |
+| consumer_name| username of `consumer` | $consumer_name |
+
 ### Example
 
 ```shell
diff --git a/doc/zh-cn/plugins/http-logger.md b/doc/zh-cn/plugins/http-logger.md
index 832465f..b25545f 100644
--- a/doc/zh-cn/plugins/http-logger.md
+++ b/doc/zh-cn/plugins/http-logger.md
@@ -87,7 +87,17 @@ hello, world
 
 | 名称 | 类型| 必选项 | 默认值| 有效值  | 描述
 |
 |  | --- | -- | - | --- | 
 |
-| log_format   | object  | 可选   | {"host": "$host", "@timestamp": 
"$time_iso8601", "client_ip": "$remote_addr"} | | 以 Hash 对象方

[apisix] branch master updated: docs: lint Markdown for multiple consecutive blank lines (#3047)

2020-12-17 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 1f52c70  docs: lint Markdown for multiple consecutive blank lines 
(#3047)
1f52c70 is described below

commit 1f52c70d841b790a0e4617a3daf53ea3f5b7cdd0
Author: John Bampton 
AuthorDate: Fri Dec 18 00:25:30 2020 +1000

docs: lint Markdown for multiple consecutive blank lines (#3047)

- remove unneeded MD009 - Trailing spaces config entry
- MD012 - Multiple consecutive blank lines


https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md#md012---multiple-consecutive-blank-lines
---
 .markdownlint.yml   |  2 --
 CHANGELOG.md|  5 -
 CHANGELOG_CN.md | 11 ---
 CODE_OF_CONDUCT.md  |  5 -
 CONTRIBUTING.md |  1 -
 FAQ.md  |  2 --
 FAQ_CN.md   |  2 --
 README.md   |  1 -
 README_CN.md|  1 -
 doc/admin-api.md|  1 -
 doc/aws.md  |  9 -
 doc/discovery.md|  4 
 doc/install-dependencies.md |  1 -
 doc/plugin-develop.md   |  1 -
 doc/plugins/authz-keycloak.md   |  6 --
 doc/plugins/batch-requests.md   |  1 -
 doc/plugins/consumer-restriction.md |  1 -
 doc/plugins/echo.md |  1 -
 doc/plugins/http-logger.md  |  1 -
 doc/plugins/ip-restriction.md   |  2 --
 doc/plugins/jwt-auth.md |  2 --
 doc/plugins/key-auth.md |  3 ---
 doc/plugins/limit-count.md  |  1 -
 doc/plugins/mqtt-proxy.md   |  2 --
 doc/plugins/node-status.md  |  6 --
 doc/plugins/proxy-mirror.md |  3 ---
 doc/plugins/referer-restriction.md  |  2 --
 doc/plugins/request-id.md   |  1 -
 doc/plugins/request-validation.md   |  4 
 doc/plugins/sls-logger.md   |  1 -
 doc/plugins/syslog.md   |  1 -
 doc/plugins/wolf-rbac.md|  5 -
 doc/plugins/zipkin.md   |  2 --
 doc/powered-by.md   |  1 -
 doc/stand-alone.md  |  1 -
 doc/zh-cn/admin-api.md  |  3 ---
 doc/zh-cn/batch-processor.md|  1 -
 doc/zh-cn/discovery.md  |  4 
 doc/zh-cn/install-dependencies.md   |  1 -
 doc/zh-cn/plugins/echo.md   |  1 -
 doc/zh-cn/plugins/hmac-auth.md  |  2 --
 doc/zh-cn/plugins/ip-restriction.md |  1 -
 doc/zh-cn/plugins/jwt-auth.md   |  3 ---
 doc/zh-cn/plugins/key-auth.md   |  1 -
 doc/zh-cn/plugins/limit-conn.md |  1 -
 doc/zh-cn/plugins/node-status.md|  6 --
 doc/zh-cn/plugins/request-id.md |  1 -
 doc/zh-cn/plugins/request-validation.md |  5 -
 doc/zh-cn/plugins/server-info.md|  2 --
 doc/zh-cn/plugins/sls-logger.md |  1 -
 doc/zh-cn/plugins/syslog.md |  2 --
 doc/zh-cn/plugins/tcp-logger.md |  1 -
 doc/zh-cn/plugins/wolf-rbac.md  |  5 -
 doc/zh-cn/plugins/zipkin.md |  2 --
 54 files changed, 136 deletions(-)

diff --git a/.markdownlint.yml b/.markdownlint.yml
index 5f1b4dc..028b846 100644
--- a/.markdownlint.yml
+++ b/.markdownlint.yml
@@ -22,10 +22,8 @@ MD004: false
 MD005: false
 MD006: false
 MD007: false
-MD009: false
 MD010: false
 MD011: false
-MD012: false
 MD013: false
 MD014: false
 MD018: false
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f80a2ee..da9fe49 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -139,13 +139,11 @@ For more changes, please refer to 
[Milestone](https://github.com/apache/apisix/m
 - doc: fixed `grpc-transcode` plugin path error in `README`. 
[1946](https://github.com/apache/apisix/pull/1946)
 - doc: removed unnecessary configurations for `k8s` document. 
[1891](https://github.com/apache/apisix/pull/1891)
 
-
 ## 1.4.1
 
 ### Bugfix
 - Fix: multiple SSL certificates are configured, but only one certificate 
working fine. [1818](https://github.com/apache/incubator-apisix/pull/1818)
 
-
 ## 1.4.0
 
 ### Core
@@ -163,7 +161,6 @@ For more changes, please refer to 
[Milestone](https://github.com/apache/apisix/m
 - SSL private key encryption 
[1678](https://github.com/apache/incubator-apisix/pull/1678)
 - Improvement of docs for multiple plugins
 
-
 ## 1.3.0
 
 The 1.3 version is mainly for security update.
@@ -176,7 +173,6 @@ The 1.3 version is mainly for security update.
 - :sunrise: **add batch request plugin**. 
[#1388](https://github.com/apache/incubator-apisix/pull/1388)
 - implemented plugin `sys logger`. 
[#1414](https://github.com/apache/incubator-apisix

[apisix-website] branch master updated: feat(CI): add a GitHub Action to lint the YAML (#111)

2020-12-17 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
 new c80b6bc  feat(CI): add a GitHub Action to lint the YAML (#111)
c80b6bc is described below

commit c80b6bcb652c5c71660f77dbc3a2f32a15c2299f
Author: John Bampton 
AuthorDate: Thu Dec 17 23:57:25 2020 +1000

feat(CI): add a GitHub Action to lint the YAML (#111)

- add a `.yamllint` config file
- lint some YAML
---
 .asf.yaml|  2 +-
 .github/workflows/deploy.yml | 68 ++--
 .github/workflows/lint.yml   |  7 +
 .yamllint|  8 ++
 4 files changed, 50 insertions(+), 35 deletions(-)

diff --git a/.asf.yaml b/.asf.yaml
index 0ba12c6..0735550 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -1,2 +1,2 @@
 publish:
-  whoami:  asf-site
\ No newline at end of file
+  whoami: asf-site
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index cac155a..b87951e 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -6,10 +6,10 @@ name: CI
 # events but only for the master branch
 on:
   push:
-branches: [ master ]
+branches: [master]
   schedule:
-  # Run everyday at 9:00 AM (See 
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
-  - cron: "0 9 * * *"
+# Run everyday at 9:00 AM (See 
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
+- cron: "0 9 * * *"
 
 # A workflow run is made up of one or more jobs that can run sequentially or 
in parallel
 jobs:
@@ -20,34 +20,34 @@ jobs:
 
 # Steps represent a sequence of tasks that will be executed as part of the 
job
 steps:
-# Checks-out your repository under $GITHUB_WORKSPACE, so your job can 
access it
-- uses: actions/checkout@v2
-
-- name: Clone apisix's docs from repo & update image's link
-  run: |
-git clone https://github.com/apache/apisix.git
-cp -r apisix/doc/images ./website/static && rm -rf apisix/doc/images
-cp -r apisix/doc ./docs/apisix
-
-- name: Build
-  run: cd website && yarn && yarn build
-
-- name: Copy files
-  run: |
-cd website/build/apisix-website
-cp ../../../README.md ./ && cp ../../../.asf.yaml ./
-cd apisix
-find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="\.\.\/\.\.\/doc\/images/src="https:\/\/apisix\.apache\.org\/images/g'
-find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="\.\.\/\.\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
-find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="\.\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
-find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
-find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="images/src="https:\/\/apisix\.apache\.org\/images/g'
-
-- name: GitHub Pages
-  uses: crazy-max/ghaction-github-pages@v2.0.1
-  with:
-build_dir: website/build/apisix-website
-target_branch: asf-site
-keep_history: true
-  env:
-GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+  # Checks-out your repository under $GITHUB_WORKSPACE, so your job can 
access it
+  - uses: actions/checkout@v2
+
+  - name: Clone apisix's docs from repo & update image's link
+run: |
+  git clone https://github.com/apache/apisix.git
+  cp -r apisix/doc/images ./website/static && rm -rf apisix/doc/images
+  cp -r apisix/doc ./docs/apisix
+
+  - name: Build
+run: cd website && yarn && yarn build
+
+  - name: Copy files
+run: |
+  cd website/build/apisix-website
+  cp ../../../README.md ./ && cp ../../../.asf.yaml ./
+  cd apisix
+  find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="\.\.\/\.\.\/doc\/images/src="https:\/\/apisix\.apache\.org\/images/g'
+  find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="\.\.\/\.\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
+  find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="\.\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
+  find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="\.\/images/src="https:\/\/apisix\.apach

[apisix-website] branch master updated: feat(CI): add a GitHub Action to lint the Markdown (#107)

2020-12-16 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
 new 6548a1d  feat(CI): add a GitHub Action to lint the Markdown (#107)
6548a1d is described below

commit 6548a1d67b513c6681507fb1f576d42f54a9aa6d
Author: John Bampton 
AuthorDate: Wed Dec 16 20:22:51 2020 +1000

feat(CI): add a GitHub Action to lint the Markdown (#107)

- remove trailing spaces from YAML files
- add a `.markdownlint.yml` config file
- lint Markdown for rule MD047/single-trailing-newline. Files should end 
with a single newline character


https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md047---files-should-end-with-a-single-newline-character
---
 .github/workflows/deploy.yml   |  4 ++--
 .github/workflows/lint.yml | 16 
 .markdownlint.yml  | 20 
 docs/subscribe-guide.md|  2 +-
 website/blog/2020-08-22-new-website.md |  2 +-
 5 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 3eaff34..cac155a 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -31,7 +31,7 @@ jobs:
 
 - name: Build
   run: cd website && yarn && yarn build
-  
+
 - name: Copy files
   run: |
 cd website/build/apisix-website
@@ -42,7 +42,7 @@ jobs:
 find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="\.\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
 find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
 find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 
's/src="images/src="https:\/\/apisix\.apache\.org\/images/g'
-  
+
 - name: GitHub Pages
   uses: crazy-max/ghaction-github-pages@v2.0.1
   with:
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644
index 000..3a283bb
--- /dev/null
+++ b/.github/workflows/lint.yml
@@ -0,0 +1,16 @@
+name: ❄️ Lint
+
+on: [pull_request]
+
+jobs:
+  markdownlint:
+name: 🍇 Markdown
+runs-on: ubuntu-latest
+steps:
+  - uses: actions/checkout@v2
+  - name: 🚀 Use Node.js
+uses: actions/setup-node@v1
+with:
+  node-version: '12.x'
+  - run: npm install -g markdownlint-cli@0.25.0
+  - run: markdownlint '**/*.md' --ignore node_modules
diff --git a/.markdownlint.yml b/.markdownlint.yml
new file mode 100644
index 000..64ebbc0
--- /dev/null
+++ b/.markdownlint.yml
@@ -0,0 +1,20 @@
+# MD013 Line length
+MD013: false
+
+# MD014 Dollar signs used before commands without showing output
+MD014: false
+
+# MD026/no-trailing-punctuation Trailing punctuation in heading
+MD026: false
+
+# MD029/ol-prefix Ordered list item prefix
+MD029: false
+
+# MD034/no-bare-urls
+MD034: false
+
+# MD040/fenced-code-language
+MD040: false
+
+# MD041/first-line-heading/first-line-h1 First line in file should be a top 
level heading
+MD041: false
diff --git a/docs/subscribe-guide.md b/docs/subscribe-guide.md
index d1df9d6..9b9ad5a 100644
--- a/docs/subscribe-guide.md
+++ b/docs/subscribe-guide.md
@@ -11,4 +11,4 @@ During the process of using Apache APISIX, if there has any 
problems, suggestion
 
 3. Receive the Welcome e-mail. After finishing the two steps above, an e-mail 
with the subject of WELCOME to d...@apisix.apache.org will be sent to your 
e-mail address. Until now, you have succeeded in subscribing Apache APISIX 
mailing-list.
 
-4. Until now, you can interact with community by your subscribed email or 
track email conversations by Archived email list.
\ No newline at end of file
+4. Until now, you can interact with community by your subscribed email or 
track email conversations by Archived email list.
diff --git a/website/blog/2020-08-22-new-website.md 
b/website/blog/2020-08-22-new-website.md
index d915f5d..0d69854 100644
--- a/website/blog/2020-08-22-new-website.md
+++ b/website/blog/2020-08-22-new-website.md
@@ -9,4 +9,4 @@ We are just refactored out website for Apache APISIX by using 
[docusaurus](https
 
 
 
-Tip: all contents will be hidden after the `` tag in blog list.
\ No newline at end of file
+Tip: all contents will be hidden after the `` tag in blog list.



[apisix-website] branch master updated: refactor: fix links and spellling (#108)

2020-12-16 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
 new 264a814  refactor: fix links and spellling (#108)
264a814 is described below

commit 264a814326e02b5df003d86c67f6490dad261d29
Author: John Bampton 
AuthorDate: Wed Dec 16 20:22:12 2020 +1000

refactor: fix links and spellling (#108)
---
 docs/subscribe-guide.md | 2 +-
 docs/team.md| 2 +-
 website/sidebars.json   | 2 +-
 website/siteConfig.js   | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/subscribe-guide.md b/docs/subscribe-guide.md
index 1951753..d1df9d6 100644
--- a/docs/subscribe-guide.md
+++ b/docs/subscribe-guide.md
@@ -1,5 +1,5 @@
 ---
-id: subscrbe-guide
+id: subscribe-guide
 title: Subscribe Guide
 ---
 
diff --git a/docs/team.md b/docs/team.md
index d840a51..4217b4e 100644
--- a/docs/team.md
+++ b/docs/team.md
@@ -63,4 +63,4 @@ title: Team
 
 The Apache APISIX community follows the Apache Community’s process on 
accepting a new committer. After a contributor participates APISIX's community 
actively, PMC and Committers will make decisions to invite the contributor join 
Committers and PMC.
 
-You can read [Contributor Guide](../docs/contributor-guide) to participate the 
community, and can get more information on [Committer 
Guide](../docs/committer-guide).
+You can read [Contributor Guide](../docs/contributor-guide.md) to participate 
the community, and can get more information on [Committer 
Guide](../docs/committer-guide.md).
diff --git a/website/sidebars.json b/website/sidebars.json
index 24fe4e3..6d260bf 100644
--- a/website/sidebars.json
+++ b/website/sidebars.json
@@ -2,7 +2,7 @@
   "docs": {
 "Get Involved": [
   "security",
-  "subscrbe-guide",
+  "subscribe-guide",
   "contributor-guide",
   "committer-guide",
   "2fa",
diff --git a/website/siteConfig.js b/website/siteConfig.js
index dc6784d..5c54f80 100644
--- a/website/siteConfig.js
+++ b/website/siteConfig.js
@@ -36,7 +36,7 @@ const siteConfig = {
   projectName: "apisix-website",
   organizationName: "Apache",
   headerLinks: [
-{ doc: "subscrbe-guide", label: "Docs" },
+{ doc: "subscribe-guide", label: "Docs" },
 { blog: true, label: "Blog" },
 { doc: "downloads", label: "Downloads" },
 { doc: "team", label: "Team" },



[apisix] branch master updated: fix: copy the files in conf/cert when installing (#3059)

2020-12-16 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new f476d2c  fix: copy the files in conf/cert when installing (#3059)
f476d2c is described below

commit f476d2c3dc68439406a9531fc8b4a2a2d50c1333
Author: Shuyang Wu 
AuthorDate: Wed Dec 16 18:09:52 2020 +0800

fix: copy the files in conf/cert when installing (#3059)

fix #3057
---
 Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index c821a25..a9a5912 100644
--- a/Makefile
+++ b/Makefile
@@ -124,6 +124,7 @@ install: default
$(INSTALL) conf/mime.types /usr/local/apisix/conf/mime.types
$(INSTALL) conf/config.yaml /usr/local/apisix/conf/config.yaml
$(INSTALL) conf/config-default.yaml 
/usr/local/apisix/conf/config-default.yaml
+   $(INSTALL) conf/cert/* /usr/local/apisix/conf/cert/
 
$(INSTALL) -d $(INST_LUADIR)/apisix
$(INSTALL) apisix/*.lua $(INST_LUADIR)/apisix/



[apisix] branch master updated: fix: remove hardcoded TZ env (#3049)

2020-12-15 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 1ece1e1  fix: remove hardcoded TZ env (#3049)
1ece1e1 is described below

commit 1ece1e12ee3c15f119144d31c6b2a03ceb8be763
Author: 罗泽轩 
AuthorDate: Tue Dec 15 21:11:06 2020 +0800

fix: remove hardcoded TZ env (#3049)

fix #3039
---
 kubernetes/deployment.yaml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kubernetes/deployment.yaml b/kubernetes/deployment.yaml
index 4b03cb7..52a192c 100644
--- a/kubernetes/deployment.yaml
+++ b/kubernetes/deployment.yaml
@@ -66,8 +66,6 @@ spec:
 
   containers:
 - env:
-- name: TZ
-  value: "Asia/Shanghai"
 - name: POD_NAME
   valueFrom:
 fieldRef:



[apisix-dashboard] branch master updated (93b9c68 -> 7c5fe95)

2020-12-14 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git.


from 93b9c68  fix(plugin): Inject the disable property into every plugin's 
jsonschema, the same as manager-api. (#1031)
 add 7c5fe95  chore(deps): bump wei/wget from v1 to v1.1.1 (#1046)

No new revisions were added by this update.

Summary of changes:
 .github/workflows/gitleaks.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



[apisix-ingress-controller] branch master updated: ci: add semantic.yml (#87)

2020-12-14 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis 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 94469b5  ci: add semantic.yml (#87)
94469b5 is described below

commit 94469b569cf72414d4a8ddda4973649b90687f42
Author: Alex Zhang 
AuthorDate: Mon Dec 14 17:46:37 2020 +0800

ci: add semantic.yml (#87)
---
 .github/semantic.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/semantic.yml b/.github/semantic.yml
new file mode 100644
index 000..14940a2
--- /dev/null
+++ b/.github/semantic.yml
@@ -0,0 +1,2 @@
+titleOnly: true
+allowRevertCommits: true



[apisix-ingress-controller] branch master updated: ci: add lint-checker-ci, `gofmt` (#93)

2020-12-14 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis 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 d43c510  ci: add lint-checker-ci, `gofmt` (#93)
d43c510 is described below

commit d43c510357c804b93cc057cd13114dcfb595c245
Author: Alex Zhang 
AuthorDate: Mon Dec 14 17:42:33 2020 +0800

ci: add lint-checker-ci, `gofmt` (#93)
---
 .github/workflows/lint-checker.yml| 28 
 Makefile  |  4 ++
 conf/errno.go | 36 
 conf/init.go  | 81 +--
 log/log.go|  4 +-
 main.go   |  6 +--
 pkg/ingress/apisix/annotation.go  |  4 +-
 pkg/ingress/apisix/plugin.go  | 12 +++---
 pkg/ingress/apisix/route.go   |  2 +-
 pkg/ingress/apisix/service.go |  2 +-
 pkg/ingress/apisix/upstream.go|  6 +--
 pkg/ingress/controller/controller.go  | 12 +++---
 pkg/ingress/controller/endpoint.go|  2 +-
 pkg/ingress/controller/store/store.go |  1 -
 pkg/ingress/controller/watch.go   | 42 +-
 pkg/route.go  | 18 
 16 files changed, 145 insertions(+), 115 deletions(-)

diff --git a/.github/workflows/lint-checker.yml 
b/.github/workflows/lint-checker.yml
new file mode 100644
index 000..c03cc19
--- /dev/null
+++ b/.github/workflows/lint-checker.yml
@@ -0,0 +1,28 @@
+name: lint-checker-ci
+
+on:
+  push:
+branches:
+  - master
+  - chore/gofmt
+  pull_request:
+branches:
+  - master
+jobs:
+  run-test:
+runs-on: ubuntu-latest
+steps:
+  - uses: actions/checkout@v2
+  - name: setup go
+uses: actions/setup-go@v1
+with:
+  go-version: '1.13'
+  - name: run gofmt
+working-directory: ./
+run: |
+  diffs=`gofmt -l .`
+  if [[ -n $diffs ]]; then
+  echo "Files are not formatted by gofmt:"
+  echo $diffs
+  exit 1
+  fi
diff --git a/Makefile b/Makefile
index 8df39d0..b1d54e1 100644
--- a/Makefile
+++ b/Makefile
@@ -40,6 +40,10 @@ build:
 lint:
golangci-lint run
 
+### gofmt:Format all go codes
+gofmt:
+   find . -type f -name "*.go" | xargs gofmt -w -s
+
 ### unit-test:Run unit test cases
 unit-test:
go test -cover -coverprofile=coverage.txt ./...
diff --git a/conf/errno.go b/conf/errno.go
index 2a01cef..92f2bdb 100644
--- a/conf/errno.go
+++ b/conf/errno.go
@@ -1,17 +1,17 @@
- // 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.
+// 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.
 package conf
 
 import "fmt"
@@ -29,10 +29,10 @@ var (
//BB 01表示更新失败
UpdateUpstreamNodesError = Message{"010101", "服务%s节点更新失败"}
AddUpstreamError = Message{"010102", "增加upstream %s失败"}
-   AddUpstreamJsonError = Message{"010103", "upstream %s json 
trans error"}
+   AddUpstreamJsonError = Message{"010103", "upstream %s json trans 
error"}
 )
 
-func (m Message) ToString(params ...interface{}) string{
+func (m Message) ToString(params

[apisix] branch master updated: feat: check if Admin API is used with etcd config_center (#3018)

2020-12-13 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new 2457aa1  feat: check if Admin API is used with etcd config_center 
(#3018)
2457aa1 is described below

commit 2457aa1e4da89982f86c84224392e1350f8a1337
Author: 罗泽轩 
AuthorDate: Sun Dec 13 23:08:15 2020 +0800

feat: check if Admin API is used with etcd config_center (#3018)
---
 .travis/apisix_cli_test.sh | 15 +++
 apisix/cli/ops.lua |  6 ++
 doc/stand-alone.md |  2 +-
 doc/zh-cn/stand-alone.md   |  2 +-
 4 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/.travis/apisix_cli_test.sh b/.travis/apisix_cli_test.sh
index de1ad58..5b43330 100755
--- a/.travis/apisix_cli_test.sh
+++ b/.travis/apisix_cli_test.sh
@@ -918,3 +918,18 @@ if ! echo "$out" | grep 'authentication is not enabled'; 
then
 fi
 
 echo "passed: properly handle the error when connecting to etcd without auth"
+
+# Admin API can only be used with etcd config_center
+echo '
+apisix:
+enable_admin: true
+config_center: yaml
+' > conf/config.yaml
+
+out=$(make init 2>&1 || true)
+if ! echo "$out" | grep "Admin API can only be used with etcd config_center"; 
then
+echo "failed: Admin API can only be used with etcd config_center"
+exit 1
+fi
+
+echo "passed: Admin API can only be used with etcd config_center"
diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index c3e72cb..fe663b5 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -176,6 +176,12 @@ Please modify "admin_key" in conf/config.yaml .
 end
 end
 
+if yaml_conf.apisix.enable_admin and
+yaml_conf.apisix.config_center == "yaml"
+then
+util.die("ERROR: Admin API can only be used with etcd 
config_center.\n")
+end
+
 local or_ver = util.execute_cmd("openresty -V 2>&1")
 local with_module_status = true
 if or_ver and not or_ver:find("http_stub_status_module", 1, true) then
diff --git a/doc/stand-alone.md b/doc/stand-alone.md
index 9d0a13b..44c5428 100644
--- a/doc/stand-alone.md
+++ b/doc/stand-alone.md
@@ -43,7 +43,7 @@ apisix:
 # `/your_path/conf/apisix.yaml`
 ```
 
-In addition, since the current Admin API is based on the etcd configuration 
center solution, the Admin API will not actually work when the Stand-alone mode 
is enabled.
+In addition, since the current Admin API is based on the etcd configuration 
center solution, enable Admin API is not allowed when the Stand-alone mode is 
enabled.
 
 ## How to config rules
 
diff --git a/doc/zh-cn/stand-alone.md b/doc/zh-cn/stand-alone.md
index fd08c23..03ce3e1 100644
--- a/doc/zh-cn/stand-alone.md
+++ b/doc/zh-cn/stand-alone.md
@@ -47,7 +47,7 @@ apisix:
 ```
 
 此外由于目前 Admin API 都是基于 etcd 配置中心解决方案,当开启 Stand-alone 模式后,
-Admin API 实际将不起作用。
+Admin API 将不再被允许使用。
 
 ## 如何配置规则
 



[apisix-dashboard] branch master updated: fix(plugin): Inject the disable property into every plugin's jsonschema, the same as manager-api. (#1031)

2020-12-11 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git


The following commit(s) were added to refs/heads/master by this push:
 new 93b9c68  fix(plugin): Inject the disable property into every plugin's 
jsonschema, the same as manager-api. (#1031)
93b9c68 is described below

commit 93b9c6820d361380b0c370a3946a350dbac10f2f
Author: 琚致远 
AuthorDate: Sat Dec 12 13:01:36 2020 +0800

fix(plugin): Inject the disable property into every plugin's jsonschema, 
the same as manager-api. (#1031)

uses the correct Proxy host

fix #1027
fix #1028
---
 web/config/proxy.ts  |  2 +-
 web/src/components/Plugin/PluginPage.tsx | 17 +++--
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/web/config/proxy.ts b/web/config/proxy.ts
index 6f2e82f..fda3747 100644
--- a/web/config/proxy.ts
+++ b/web/config/proxy.ts
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 const serveUrlMap = {
-  dev: 'http://40.73.92.163:8080',
+  dev: 'http://139.217.190.60',
   test: 'http://localhost:9000',
 };
 
diff --git a/web/src/components/Plugin/PluginPage.tsx 
b/web/src/components/Plugin/PluginPage.tsx
index 6296e74..4224af2 100644
--- a/web/src/components/Plugin/PluginPage.tsx
+++ b/web/src/components/Plugin/PluginPage.tsx
@@ -58,10 +58,20 @@ const PluginPage: React.FC = ({
 
   const validateData = (pluginName: string, value: PluginComponent.Data) => {
 fetchSchema(pluginName, schemaType).then((schema) => {
+  // NOTE: The frontend will inject the disable property into schema just 
like the manager-api does
+  if (!schema.properties) {
+// eslint-disable-next-line
+schema.properties = {}
+  }
+  // eslint-disable-next-line
+  ;(schema.properties as any).disable = {
+type: "boolean"
+  }
+
   const { valid, errors } = validate(value, schema);
   if (valid) {
 setName(NEVER_EXIST_PLUGIN_FLAG);
-onChange({ ...initialData, [pluginName]: { ...value, disable: false } 
});
+onChange({ ...initialData, [pluginName]: value });
 return;
   }
   errors?.forEach((item) => {
@@ -146,7 +156,10 @@ const PluginPage: React.FC = ({
 disabled={readonly}
 onChange={(isChecked) => {
   if (isChecked) {
-validateData(item.name, initialData[item.name]);
+validateData(item.name, {
+  ...initialData[item.name],
+  disable: false
+});
   } else {
 onChange({
   ...initialData,



[apisix] branch master updated: fix: enable ssl as default, using placeholder certificate (#3013)

2020-12-11 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
 new b7325f0  fix: enable ssl as default, using placeholder certificate 
(#3013)
b7325f0 is described below

commit b7325f033ea721307c6b52beb52c85beaf710f28
Author: Shuyang Wu 
AuthorDate: Fri Dec 11 17:44:41 2020 +0800

fix: enable ssl as default, using placeholder certificate (#3013)
---
 .travis/apisix_cli_test.sh  | 21 -
 .travis/common.sh   | 13 -
 .travis/linux_apisix_current_luarocks_runner.sh |  1 -
 .travis/linux_openresty_runner.sh   |  2 --
 apisix/cli/ops.lua  | 10 ++-
 conf/cert/ssl_PLACE_HOLDER.crt  | 27 +
 conf/cert/ssl_PLACE_HOLDER.key  | 39 +
 conf/config-default.yaml|  5 +---
 8 files changed, 70 insertions(+), 48 deletions(-)

diff --git a/.travis/apisix_cli_test.sh b/.travis/apisix_cli_test.sh
index b793284..de1ad58 100755
--- a/.travis/apisix_cli_test.sh
+++ b/.travis/apisix_cli_test.sh
@@ -67,9 +67,6 @@ echo "passed: nginx.conf file contains reuseport 
configuration"
 echo "
 apisix:
 ssl:
-enable: true
-ssl_cert: '../t/certs/apisix.crt'
-ssl_cert_key: '../t/certs/apisix.key'
 listen_port: 8443
 " > conf/config.yaml
 
@@ -98,9 +95,6 @@ apisix:
 - 9081
 - 9082
   ssl:
-enable: true
-ssl_cert: '../t/certs/apisix.crt'
-ssl_cert_key: '../t/certs/apisix.key'
 listen_port:
   - 9443
   - 9444
@@ -387,10 +381,6 @@ git checkout conf/config.yaml
 
 echo "
 apisix:
-ssl:
-enable: true
-ssl_cert: '../t/certs/apisix.crt'
-ssl_cert_key: '../t/certs/apisix.key'
 admin_api_mtls:
 admin_ssl_cert: '../t/certs/apisix_admin_ssl.crt'
 admin_ssl_cert_key: '../t/certs/apisix_admin_ssl.key'
@@ -765,14 +755,6 @@ echo "passed: using env to set worker processes"
 # set worker processes with env
 git checkout conf/config.yaml
 
-echo '
-apisix:
-ssl:
-enable: true
-ssl_cert: "../t/certs/apisix.crt"
-ssl_cert_key: "../t/certs/apisix.key"
-' > conf/config.yaml
-
 make init
 
 count=`grep -c "ssl_session_tickets off;" conf/nginx.conf || true `
@@ -784,9 +766,6 @@ fi
 echo '
 apisix:
 ssl:
-enable: true
-ssl_cert: "../t/certs/apisix.crt"
-ssl_cert_key: "../t/certs/apisix.key"
 ssl_session_tickets: true
 ' > conf/config.yaml
 
diff --git a/.travis/common.sh b/.travis/common.sh
index 299b2bf..62760a6 100644
--- a/.travis/common.sh
+++ b/.travis/common.sh
@@ -34,16 +34,3 @@ create_lua_deps() {
 sudo cp -r deps build-cache/
 sudo cp rockspec/apisix-master-0.rockspec build-cache/
 }
-
-enable_ssl() {
-echo "
-apisix:
-ssl:
-enable: true
-ssl_cert: '../t/certs/apisix.crt'
-ssl_cert_key: '../t/certs/apisix.key'
-admin_api_mtls:
-admin_ssl_cert: '../t/certs/mtls_client.crt'
-admin_ssl_cert_key: '../t/certs/mtls_client.key'
-" > conf/config.yaml
-}
diff --git a/.travis/linux_apisix_current_luarocks_runner.sh 
b/.travis/linux_apisix_current_luarocks_runner.sh
index 1947246..c3c64fa 100755
--- a/.travis/linux_apisix_current_luarocks_runner.sh
+++ b/.travis/linux_apisix_current_luarocks_runner.sh
@@ -27,7 +27,6 @@ do_install() {
 script() {
 export_or_prefix
 openresty -V
-enable_ssl
 
 sudo rm -rf /usr/local/apisix
 
diff --git a/.travis/linux_openresty_runner.sh 
b/.travis/linux_openresty_runner.sh
index 1be27ee..f451bbe 100755
--- a/.travis/linux_openresty_runner.sh
+++ b/.travis/linux_openresty_runner.sh
@@ -101,8 +101,6 @@ script() {
 export_or_prefix
 openresty -V
 
-enable_ssl
-
 ./build-cache/grpc_server_example &
 
 ./bin/apisix help
diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index f2523a5..c3e72cb 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -223,13 +223,9 @@ Please modify "admin_key" in conf/config.yaml .
 util.die("missing ssl cert for https admin")
 end
 
-local ssl = yaml_conf.apisix.ssl
-if ssl and ssl.enable and not (
-ssl.ssl_cert and ssl.ssl_cert ~= "" and
-ssl.ssl_cert_key and ssl.ssl_cert_key ~= "")
-then
-util.die("missing ssl cert for ssl")
-end
+-- enable ssl with place holder crt&key
+yaml_conf.apisix.ssl.ssl_cert = "cert/ssl_PLACE_HOLDER.crt&q

[apisix-dashboard] branch master updated (d72c478 -> 78db532)

2020-12-10 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git.


from d72c478  feat:  support to show version info when manager-api starting 
 (#900)
 add 78db532  fix: delete POST method in /apisix/admin/consumer (#852) 
(#868)

No new revisions were added by this update.

Summary of changes:
 api/internal/handler/consumer/consumer.go  |  40 ++
 api/internal/handler/consumer/consumer_test.go |  22 +--
 api/test/e2e/consumer_test.go  | 179 +
 3 files changed, 198 insertions(+), 43 deletions(-)



[apisix-dashboard] branch master updated (4196844 -> d72c478)

2020-12-10 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-dashboard.git.


from 4196844  fix(husky): pass the web folder (#1008)
 add d72c478  feat:  support to show version info when manager-api starting 
 (#900)

No new revisions were added by this update.

Summary of changes:
 api/VERSION|  1 +
 api/build.sh   |  5 -
 api/main.go| 12 
 api/test/shell/cli_test.sh | 33 -
 4 files changed, 49 insertions(+), 2 deletions(-)
 create mode 100644 api/VERSION



[apisix] branch master updated (0eacf3a -> cc9c1bb)

2020-12-10 Thread membphis
This is an automated email from the ASF dual-hosted git repository.

membphis pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git.


from 0eacf3a  feat: improve jsonschema validation on route resource (#3008)
 add cc9c1bb  ci: check misspell (#3011)

No new revisions were added by this update.

Summary of changes:
 .github/workflows/spellchecker.yml  | 19 +++
 apisix/core/ctx.lua |  2 +-
 apisix/core/etcd.lua|  2 +-
 apisix/plugins/response-rewrite.lua |  8 
 doc/aws.md  |  2 +-
 doc/plugins/kafka-logger.md |  2 +-
 doc/plugins/response-rewrite.md |  2 +-
 doc/plugins/sls-logger.md   |  2 +-
 doc/plugins/tcp-logger.md   |  2 +-
 doc/plugins/udp-logger.md   |  2 +-
 t/core/response.t   |  8 
 t/node/upstream-node-dns.t  | 16 
 t/plugin/prometheus.t   |  2 +-
 t/router/graphql.t  |  2 +-
 14 files changed, 45 insertions(+), 26 deletions(-)
 create mode 100644 .github/workflows/spellchecker.yml



<    1   2   3   4   5   6   7   8   9   >