Skip to content

Commit 8b2cd1c

Browse files
committed
Merge branch 'apisix/master' into env
* apisix/master: change: limit the maximum length of Lua code to 100. (apache#1525) doc: fixed wrong configurations in the logger docs (apache#1530) feature: add batch request plugin. (apache#1388) plugin(kafka-logger): Updating kafka logger to use the batch processor util (apache#1358) test: reindex by tools `reindex`. (apache#1519) fix: skip tombstone mark when iterating the global values (apache#1517) bugfix: init `clean_handlers` when add new item from etcd. (apache#1412) doc: fix the doc style for serverless*.md (apache#1511) test: check lua code style in all Lua file under apisix/ (apache#1518) feat: support saving k8s deployment info to upstream (apache#1502) doc: update steps of build dashboard. (apache#1506) rocks: used tag instead of branch. (apache#1503) test: fix regex usage in some cases (apache#1504) doc: add short introduction about how to change log level (apache#1484) bugfix(lrucache): when creating cached objects, use resty-lock to avoid repeated creation. (apache#1486) bug: fixed wrong string join in limit-count plugin. (apache#1487) doc(readme.md): upload Node.js version for building dashboard. (apache#1485) release: released 1.2 version. (apache#1436) # Conflicts: # bin/apisix # t/node/upstream.t
2 parents b95d9ce + a446cd0 commit 8b2cd1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1938
-237
lines changed

.luacheckrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
std = "ngx_lua"
22
unused_args = false
33
redefined = false
4+
max_line_length = 100

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,54 @@
1919

2020
# Table of Contents
2121

22+
- [1.2.0](#120)
2223
- [1.1.0](#110)
2324
- [1.0.0](#100)
2425
- [0.9.0](#090)
2526
- [0.8.0](#080)
2627
- [0.7.0](#070)
2728
- [0.6.0](#060)
2829

30+
## 1.2.0
31+
32+
The 1.2 version brings many new features, including core and plugins.
33+
34+
### Core
35+
- :sunrise: **support etcd cluster**. [#1283](https://github.com/apache/incubator-apisix/pull/1283)
36+
- using the local DNS resolver by default, which is friendly for k8s. [#1387](https://github.com/apache/incubator-apisix/pull/1387)
37+
- support to run `header_filter`, `body_filter` and `log` phases for global rules. [#1364](https://github.com/apache/incubator-apisix/pull/1364)
38+
- changed the `lua/apisix` dir to `apisix`(**not backward compatible**). [#1351](https://github.com/apache/incubator-apisix/pull/1351)
39+
- add dashboard as submodule. [#1360](https://github.com/apache/incubator-apisix/pull/1360)
40+
- allow adding custom shared dict. [#1367](https://github.com/apache/incubator-apisix/pull/1367)
41+
42+
### Plugin
43+
- :sunrise: **add Apache Kafka plugin**. [#1312](https://github.com/apache/incubator-apisix/pull/1312)
44+
- :sunrise: **add CORS plugin**. [#1327](https://github.com/apache/incubator-apisix/pull/1327)
45+
- :sunrise: **add TCP logger plugin**. [#1221](https://github.com/apache/incubator-apisix/pull/1221)
46+
- :sunrise: **add UDP logger plugin**. [1070](https://github.com/apache/incubator-apisix/pull/1070)
47+
- :sunrise: **add proxy mirror plugin**. [#1288](https://github.com/apache/incubator-apisix/pull/1288)
48+
- :sunrise: **add proxy cache plugin**. [#1153](https://github.com/apache/incubator-apisix/pull/1153)
49+
- drop websocket enable control in proxy-rewrite plugin(**not backward compatible**). [1332](https://github.com/apache/incubator-apisix/pull/1332)
50+
- Adding support to public key based introspection for OAuth plugin. [#1266](https://github.com/apache/incubator-apisix/pull/1266)
51+
- response-rewrite plugin support binary data to client by base64. [#1381](https://github.com/apache/incubator-apisix/pull/1381)
52+
- plugin `grpc-transcode` supports grpc deadline. [#1149](https://github.com/apache/incubator-apisix/pull/1149)
53+
- support password auth for limit-count-redis. [#1150](https://github.com/apache/incubator-apisix/pull/1150)
54+
- Zipkin plugin add service name and report local server IP. [#1386](https://github.com/apache/incubator-apisix/pull/1386)
55+
- add `change_pwd` and `user_info` for Wolf-Rbac plugin. [#1204](https://github.com/apache/incubator-apisix/pull/1204)
56+
57+
### Admin API
58+
- :sunrise: support key-based authentication for Admin API(**not backward compatible**). [#1169](https://github.com/apache/incubator-apisix/pull/1169)
59+
- hide SSL private key in admin API. [#1240](https://github.com/apache/incubator-apisix/pull/1240)
60+
61+
### Bugfix
62+
- missing `clear` table before to reuse table (**will cause memory leak**). [#1134](https://github.com/apache/incubator-apisix/pull/1134)
63+
- print warning error message if the yaml route file is invalid. [#1141](https://github.com/apache/incubator-apisix/pull/1141)
64+
- the balancer IP may be nil, use an empty string instead. [#1166](https://github.com/apache/incubator-apisix/pull/1166)
65+
- plugin node-status and heartbeat don't have schema. [#1249](https://github.com/apache/incubator-apisix/pull/1249)
66+
- the plugin basic-auth needs required field. [#1251](https://github.com/apache/incubator-apisix/pull/1251)
67+
- check the count of upstream valid node. [#1292](https://github.com/apache/incubator-apisix/pull/1292)
68+
69+
2970
## 1.1.0
3071

3172
This release is mainly to strengthen the stability of the code and add more documentation.

CHANGELOG_CN.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,52 @@
1919

2020
# Table of Contents
2121

22+
- [1.2.0](#120)
2223
- [1.1.0](#110)
2324
- [1.0.0](#100)
2425
- [0.9.0](#090)
2526
- [0.8.0](#080)
2627
- [0.7.0](#070)
2728
- [0.6.0](#060)
2829

30+
## 1.2.0
31+
1.2 版本在内核以及插件上带来了非常多的更新。
32+
33+
### Core
34+
- :sunrise: **支持 etcd 集群**. [#1283](https://github.com/apache/incubator-apisix/pull/1283)
35+
- 默认使用本地 DNS resolver, 这对于 k8s 环境更加友好. [#1387](https://github.com/apache/incubator-apisix/pull/1387)
36+
- 支持在 `header_filter``body_filter``log` 阶段运行全局插件. [#1364](https://github.com/apache/incubator-apisix/pull/1364)
37+
- 将目录 `lua/apisix` 修改为 `apisix`(**不向下兼容**). [#1351](https://github.com/apache/incubator-apisix/pull/1351)
38+
- 增加 dashboard 子模块. [#1360](https://github.com/apache/incubator-apisix/pull/1360)
39+
- 允许自定义共享字典. [#1367](https://github.com/apache/incubator-apisix/pull/1367)
40+
41+
### Plugin
42+
- :sunrise: **新增 Apache Kafka 插件**. [#1312](https://github.com/apache/incubator-apisix/pull/1312)
43+
- :sunrise: **新增 CORS 插件**. [#1327](https://github.com/apache/incubator-apisix/pull/1327)
44+
- :sunrise: **新增 TCP logger 插件**. [#1221](https://github.com/apache/incubator-apisix/pull/1221)
45+
- :sunrise: **新增 UDP logger 插件**. [1070](https://github.com/apache/incubator-apisix/pull/1070)
46+
- :sunrise: **新增 proxy mirror 插件**. [#1288](https://github.com/apache/incubator-apisix/pull/1288)
47+
- :sunrise: **新增 proxy cache 插件**. [#1153](https://github.com/apache/incubator-apisix/pull/1153)
48+
- 在 proxy-rewrite 插件中废弃 websocket 开关(**不向下兼容**). [1332](https://github.com/apache/incubator-apisix/pull/1332)
49+
- OAuth 插件中增加基于公钥的自省支持. [#1266](https://github.com/apache/incubator-apisix/pull/1266)
50+
- response-rewrite 插件通过 base64 来支持传输二进制数据. [#1381](https://github.com/apache/incubator-apisix/pull/1381)
51+
- gRPC 转码插件支持 `deadline`. [#1149](https://github.com/apache/incubator-apisix/pull/1149)
52+
- limit count 插件支持 redis 权限认证. [#1150](https://github.com/apache/incubator-apisix/pull/1150)
53+
- Zipkin 插件支持名字和本地服务器 ip 的记录. [#1386](https://github.com/apache/incubator-apisix/pull/1386)
54+
- Wolf-Rbac 插件增加 `change_pwd``user_info` 参数. [#1204](https://github.com/apache/incubator-apisix/pull/1204)
55+
56+
### Admin API
57+
- :sunrise: 对调用 Admin API 增加 key-auth 权限认证(**not backward compatible**). [#1169](https://github.com/apache/incubator-apisix/pull/1169)
58+
- 隐藏 SSL 私钥的返回值. [#1240](https://github.com/apache/incubator-apisix/pull/1240)
59+
60+
### Bugfix
61+
- 在复用 table 之前遗漏了对数据的清理 (**会引发内存泄漏**). [#1134](https://github.com/apache/incubator-apisix/pull/1134)
62+
- 如果 yaml 中路由非法就打印警告信息. [#1141](https://github.com/apache/incubator-apisix/pull/1141)
63+
- 使用空字符串替代空的 balancer IP. [#1166](https://github.com/apache/incubator-apisix/pull/1166)
64+
- 修改 node-status 和 heartbeat 插件没有 schema 的问题. [#1249](https://github.com/apache/incubator-apisix/pull/1249)
65+
- basic-auth 增加 required 字段. [#1251](https://github.com/apache/incubator-apisix/pull/1251)
66+
- 检查上游合法节点的个数. [#1292](https://github.com/apache/incubator-apisix/pull/1292)
67+
2968

3069
## 1.1.0
3170

FAQ.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,15 @@ https://developer.apple.com/download/more/.
160160
This is an OS incompatible issue, you could fix by these two steps
161161
1. `brew edit openresty/brew/openresty`
162162
1. add `\ -fno-stack-check` in with-luajit-xcflags line.
163+
164+
## How to change the log level?
165+
166+
The default log level for APISIX is `warn`. However You can change the log level to `info` if you want to trace the messages print by `core.log.info`.
167+
168+
Steps:
169+
170+
1. Modify the parameter `error_log_level: "warn"` to `error_log_level: "info"` in conf/config.yaml
171+
172+
2. Restart APISIX
173+
174+
Now you can trace the info level log in logs/error.log.

FAQ_CN.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,15 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335
111111

112112
更多的 lua-resty-radixtree 匹配操作,可查看操作列表:
113113
https://github.com/iresty/lua-resty-radixtree#operator-list
114+
115+
## 如何修改日志等级
116+
117+
默认的APISIX日志等级为`warn`,如果需要查看`core.log.info`的打印结果需要将日志等级调整为`info`
118+
119+
具体步骤:
120+
121+
1、修改conf/config.yaml中的nginx log配置参数`error_log_level: "warn"``error_log_level: "info"`
122+
123+
2、重启APISIX
124+
125+
之后便可以在logs/error.log中查看到info的日志了。

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ A/B testing, canary release, blue-green deployment, limit rate, defense against
8181
- IPv6: Use IPv6 to match route.
8282
- Support [TTL](doc/admin-api-cn.md#route)
8383
- [Support priority](doc/router-radixtree.md#3-match-priority)
84+
- [Support Batch Http Requests](doc/plugins/batch-requests.md)
8485

8586
- **Security**
8687
- Authentications: [key-auth](doc/plugins/key-auth.md), [JWT](doc/plugins/jwt-auth.md), [basic-auth](doc/plugins/basic-auth.md), [wolf-rbac](doc/plugins/wolf-rbac.md)
@@ -144,23 +145,27 @@ Then you can try more [plugins](doc/README.md#plugins).
144145
## Dashboard
145146
APISIX has built-in support for Dashboard, as follows:
146147

147-
1. Please make sure your machine has Node 8.12.0 or higher, or there will occur build issues.
148+
1. Please make sure your machine has the latest Node.js(10 or higher), or there will occur build issues.
148149

149-
2. Download the source codes of [Dashboard](https://github.com/apache/incubator-apisix-dashboard):
150+
2. Download the source codes of dashboard submodule:
150151
```
151-
git clone https://github.com/apache/incubator-apisix-dashboard.git
152+
git submodule update --init --recursive
152153
```
153154

154155
3. Install [yarn](https://yarnpkg.com/en/docs/install)
155156

156157
4. Install dependencies then run build command:
157158
```
158-
git checkout <v1.0> #The tag version same to apisix.
159+
cd dashboard
159160
yarn && yarn build:prod
160161
```
161162

162163
5. Integration with APISIX
163164
Copy the compiled files under `/dist` directory to the `apisix/dashboard` directory,
165+
```
166+
cp -r dist/* .
167+
```
168+
164169
open `http://127.0.0.1:9080/apisix/dashboard/` in the browser.
165170
Do not need to fill the user name and password, log in directly.
166171

README_CN.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ A/B 测试、金丝雀发布(灰度发布)、蓝绿部署、限流限速、抵
8181
- IPv6:支持使用 IPv6 格式匹配路由
8282
- 支持路由的[自动过期(TTL)](doc/admin-api-cn.md#route)
8383
- [支持路由的优先级](doc/router-radixtree.md#3-match-priority)
84+
- [支持批量 Http 请求](doc/plugins/batch-requests-cn.md)
8485

8586
- **安全防护**
8687
- 多种身份认证方式: [key-auth](doc/plugins/key-auth-cn.md), [JWT](doc/plugins/jwt-auth-cn.md), [basic-auth](doc/plugins/basic-auth-cn.md), [wolf-rbac](doc/plugins/wolf-rbac-cn.md)
@@ -145,23 +146,27 @@ sudo apisix start
145146

146147
APISIX 内置了对 Dashboard 的支持,使用步骤如下:
147148

148-
1. 确保你的运行环境中的 Node 版本 >= 8.12.0
149+
1. 确保你的运行环境中使用了最新的 Node.js 版本>= 10)
149150

150-
2. 下载 [Dashboard](https://github.com/apache/incubator-apisix-dashboard) 的源码
151+
2. 下载 dashboard 子模块的源码
151152
```
152-
git clone https://github.com/apache/incubator-apisix-dashboard.git
153+
git submodule update --init --recursive
153154
```
154155

155156
3. 安装 [yarn](https://yarnpkg.com/zh-Hans/docs/install)
156157

157158
4. 安装依赖并构建
158159
```
159-
git checkout <v1.0> #这里的tag版本和你使用的apisix版本一致
160+
cd dashboard
160161
yarn && yarn build:prod
161162
```
162163

163164
5. 与 APISIX 集成
164165
把编译后的在 `/dist` 目录下的所有文件,拷贝到 `apisix/dashboard` 目录下。
166+
```
167+
cp -r dist/* .
168+
```
169+
165170
使用浏览器打开 `http://127.0.0.1:9080/apisix/dashboard/` 即可使用,
166171
不用填写用户名和密码,直接登录。
167172

apisix/core/config_etcd.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ local function sync_data(self)
285285
end
286286

287287
elseif res.value then
288+
res.clean_handlers = {}
288289
insert_tab(self.values, res)
289290
self.values_hash[key] = #self.values
290291
res.value.id = key

apisix/core/config_util.lua

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
--
2+
-- Licensed to the Apache Software Foundation (ASF) under one or more
3+
-- contributor license agreements. See the NOTICE file distributed with
4+
-- this work for additional information regarding copyright ownership.
5+
-- The ASF licenses this file to You under the Apache License, Version 2.0
6+
-- (the "License"); you may not use this file except in compliance with
7+
-- the License. You may obtain a copy of the License at
8+
--
9+
-- http://www.apache.org/licenses/LICENSE-2.0
10+
--
11+
-- Unless required by applicable law or agreed to in writing, software
12+
-- distributed under the License is distributed on an "AS IS" BASIS,
13+
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
-- See the License for the specific language governing permissions and
15+
-- limitations under the License.
16+
--
17+
local setmetatable = setmetatable
18+
local type = type
19+
20+
21+
local _M = {}
22+
23+
24+
local function _iterate_values(self, tab)
25+
while true do
26+
self.idx = self.idx + 1
27+
local v = tab[self.idx]
28+
if type(v) == "table" then
29+
return self.idx, v
30+
end
31+
if v == nil then
32+
return nil, nil
33+
end
34+
-- skip the tombstone
35+
end
36+
end
37+
38+
39+
function _M.iterate_values(tab)
40+
local iter = setmetatable({idx = 0}, {__call = _iterate_values})
41+
return iter, tab, 0
42+
end
43+
44+
45+
return _M

0 commit comments

Comments
 (0)