Skip to content

Commit

Permalink
Merge branch 'apisix/master' into env
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
johzchen committed Apr 30, 2020
2 parents b95d9ce + a446cd0 commit 8b2cd1c
Show file tree
Hide file tree
Showing 53 changed files with 1,938 additions and 237 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
std = "ngx_lua"
unused_args = false
redefined = false
max_line_length = 100
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,54 @@

# Table of Contents

- [1.2.0](#120)
- [1.1.0](#110)
- [1.0.0](#100)
- [0.9.0](#090)
- [0.8.0](#080)
- [0.7.0](#070)
- [0.6.0](#060)

## 1.2.0

The 1.2 version brings many new features, including core and plugins.

### Core
- :sunrise: **support etcd cluster**. [#1283](https://github.com/apache/incubator-apisix/pull/1283)
- using the local DNS resolver by default, which is friendly for k8s. [#1387](https://github.com/apache/incubator-apisix/pull/1387)
- support to run `header_filter`, `body_filter` and `log` phases for global rules. [#1364](https://github.com/apache/incubator-apisix/pull/1364)
- changed the `lua/apisix` dir to `apisix`(**not backward compatible**). [#1351](https://github.com/apache/incubator-apisix/pull/1351)
- add dashboard as submodule. [#1360](https://github.com/apache/incubator-apisix/pull/1360)
- allow adding custom shared dict. [#1367](https://github.com/apache/incubator-apisix/pull/1367)

### Plugin
- :sunrise: **add Apache Kafka plugin**. [#1312](https://github.com/apache/incubator-apisix/pull/1312)
- :sunrise: **add CORS plugin**. [#1327](https://github.com/apache/incubator-apisix/pull/1327)
- :sunrise: **add TCP logger plugin**. [#1221](https://github.com/apache/incubator-apisix/pull/1221)
- :sunrise: **add UDP logger plugin**. [1070](https://github.com/apache/incubator-apisix/pull/1070)
- :sunrise: **add proxy mirror plugin**. [#1288](https://github.com/apache/incubator-apisix/pull/1288)
- :sunrise: **add proxy cache plugin**. [#1153](https://github.com/apache/incubator-apisix/pull/1153)
- drop websocket enable control in proxy-rewrite plugin(**not backward compatible**). [1332](https://github.com/apache/incubator-apisix/pull/1332)
- Adding support to public key based introspection for OAuth plugin. [#1266](https://github.com/apache/incubator-apisix/pull/1266)
- response-rewrite plugin support binary data to client by base64. [#1381](https://github.com/apache/incubator-apisix/pull/1381)
- plugin `grpc-transcode` supports grpc deadline. [#1149](https://github.com/apache/incubator-apisix/pull/1149)
- support password auth for limit-count-redis. [#1150](https://github.com/apache/incubator-apisix/pull/1150)
- Zipkin plugin add service name and report local server IP. [#1386](https://github.com/apache/incubator-apisix/pull/1386)
- add `change_pwd` and `user_info` for Wolf-Rbac plugin. [#1204](https://github.com/apache/incubator-apisix/pull/1204)

### Admin API
- :sunrise: support key-based authentication for Admin API(**not backward compatible**). [#1169](https://github.com/apache/incubator-apisix/pull/1169)
- hide SSL private key in admin API. [#1240](https://github.com/apache/incubator-apisix/pull/1240)

### Bugfix
- missing `clear` table before to reuse table (**will cause memory leak**). [#1134](https://github.com/apache/incubator-apisix/pull/1134)
- print warning error message if the yaml route file is invalid. [#1141](https://github.com/apache/incubator-apisix/pull/1141)
- the balancer IP may be nil, use an empty string instead. [#1166](https://github.com/apache/incubator-apisix/pull/1166)
- plugin node-status and heartbeat don't have schema. [#1249](https://github.com/apache/incubator-apisix/pull/1249)
- the plugin basic-auth needs required field. [#1251](https://github.com/apache/incubator-apisix/pull/1251)
- check the count of upstream valid node. [#1292](https://github.com/apache/incubator-apisix/pull/1292)


## 1.1.0

This release is mainly to strengthen the stability of the code and add more documentation.
Expand Down
39 changes: 39 additions & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,52 @@

# Table of Contents

- [1.2.0](#120)
- [1.1.0](#110)
- [1.0.0](#100)
- [0.9.0](#090)
- [0.8.0](#080)
- [0.7.0](#070)
- [0.6.0](#060)

## 1.2.0
1.2 版本在内核以及插件上带来了非常多的更新。

### Core
- :sunrise: **支持 etcd 集群**. [#1283](https://github.com/apache/incubator-apisix/pull/1283)
- 默认使用本地 DNS resolver, 这对于 k8s 环境更加友好. [#1387](https://github.com/apache/incubator-apisix/pull/1387)
- 支持在 `header_filter``body_filter``log` 阶段运行全局插件. [#1364](https://github.com/apache/incubator-apisix/pull/1364)
- 将目录 `lua/apisix` 修改为 `apisix`(**不向下兼容**). [#1351](https://github.com/apache/incubator-apisix/pull/1351)
- 增加 dashboard 子模块. [#1360](https://github.com/apache/incubator-apisix/pull/1360)
- 允许自定义共享字典. [#1367](https://github.com/apache/incubator-apisix/pull/1367)

### Plugin
- :sunrise: **新增 Apache Kafka 插件**. [#1312](https://github.com/apache/incubator-apisix/pull/1312)
- :sunrise: **新增 CORS 插件**. [#1327](https://github.com/apache/incubator-apisix/pull/1327)
- :sunrise: **新增 TCP logger 插件**. [#1221](https://github.com/apache/incubator-apisix/pull/1221)
- :sunrise: **新增 UDP logger 插件**. [1070](https://github.com/apache/incubator-apisix/pull/1070)
- :sunrise: **新增 proxy mirror 插件**. [#1288](https://github.com/apache/incubator-apisix/pull/1288)
- :sunrise: **新增 proxy cache 插件**. [#1153](https://github.com/apache/incubator-apisix/pull/1153)
- 在 proxy-rewrite 插件中废弃 websocket 开关(**不向下兼容**). [1332](https://github.com/apache/incubator-apisix/pull/1332)
- OAuth 插件中增加基于公钥的自省支持. [#1266](https://github.com/apache/incubator-apisix/pull/1266)
- response-rewrite 插件通过 base64 来支持传输二进制数据. [#1381](https://github.com/apache/incubator-apisix/pull/1381)
- gRPC 转码插件支持 `deadline`. [#1149](https://github.com/apache/incubator-apisix/pull/1149)
- limit count 插件支持 redis 权限认证. [#1150](https://github.com/apache/incubator-apisix/pull/1150)
- Zipkin 插件支持名字和本地服务器 ip 的记录. [#1386](https://github.com/apache/incubator-apisix/pull/1386)
- Wolf-Rbac 插件增加 `change_pwd``user_info` 参数. [#1204](https://github.com/apache/incubator-apisix/pull/1204)

### Admin API
- :sunrise: 对调用 Admin API 增加 key-auth 权限认证(**not backward compatible**). [#1169](https://github.com/apache/incubator-apisix/pull/1169)
- 隐藏 SSL 私钥的返回值. [#1240](https://github.com/apache/incubator-apisix/pull/1240)

### Bugfix
- 在复用 table 之前遗漏了对数据的清理 (**会引发内存泄漏**). [#1134](https://github.com/apache/incubator-apisix/pull/1134)
- 如果 yaml 中路由非法就打印警告信息. [#1141](https://github.com/apache/incubator-apisix/pull/1141)
- 使用空字符串替代空的 balancer IP. [#1166](https://github.com/apache/incubator-apisix/pull/1166)
- 修改 node-status 和 heartbeat 插件没有 schema 的问题. [#1249](https://github.com/apache/incubator-apisix/pull/1249)
- basic-auth 增加 required 字段. [#1251](https://github.com/apache/incubator-apisix/pull/1251)
- 检查上游合法节点的个数. [#1292](https://github.com/apache/incubator-apisix/pull/1292)


## 1.1.0

Expand Down
12 changes: 12 additions & 0 deletions FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,15 @@ https://developer.apple.com/download/more/.
This is an OS incompatible issue, you could fix by these two steps
1. `brew edit openresty/brew/openresty`
1. add `\ -fno-stack-check` in with-luajit-xcflags line.

## How to change the log level?

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

Steps:

1. Modify the parameter `error_log_level: "warn"` to `error_log_level: "info"` in conf/config.yaml

2. Restart APISIX

Now you can trace the info level log in logs/error.log.
12 changes: 12 additions & 0 deletions FAQ_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,15 @@ curl -i http://127.0.0.1:9080/apisix/admin/routes/2 -H 'X-API-KEY: edd1c9f034335

更多的 lua-resty-radixtree 匹配操作,可查看操作列表:
https://github.com/iresty/lua-resty-radixtree#operator-list

## 如何修改日志等级

默认的APISIX日志等级为`warn`,如果需要查看`core.log.info`的打印结果需要将日志等级调整为`info`

具体步骤:

1、修改conf/config.yaml中的nginx log配置参数`error_log_level: "warn"``error_log_level: "info"`

2、重启APISIX

之后便可以在logs/error.log中查看到info的日志了。
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ A/B testing, canary release, blue-green deployment, limit rate, defense against
- IPv6: Use IPv6 to match route.
- Support [TTL](doc/admin-api-cn.md#route)
- [Support priority](doc/router-radixtree.md#3-match-priority)
- [Support Batch Http Requests](doc/plugins/batch-requests.md)

- **Security**
- 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)
Expand Down Expand Up @@ -144,23 +145,27 @@ Then you can try more [plugins](doc/README.md#plugins).
## Dashboard
APISIX has built-in support for Dashboard, as follows:

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

2. Download the source codes of [Dashboard](https://github.com/apache/incubator-apisix-dashboard):
2. Download the source codes of dashboard submodule:
```
git clone https://github.com/apache/incubator-apisix-dashboard.git
git submodule update --init --recursive
```

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

4. Install dependencies then run build command:
```
git checkout <v1.0> #The tag version same to apisix.
cd dashboard
yarn && yarn build:prod
```

5. Integration with APISIX
Copy the compiled files under `/dist` directory to the `apisix/dashboard` directory,
```
cp -r dist/* .
```

open `http://127.0.0.1:9080/apisix/dashboard/` in the browser.
Do not need to fill the user name and password, log in directly.

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

- **安全防护**
- 多种身份认证方式: [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)
Expand Down Expand Up @@ -145,23 +146,27 @@ sudo apisix start

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

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

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

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

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

5. 与 APISIX 集成
把编译后的在 `/dist` 目录下的所有文件,拷贝到 `apisix/dashboard` 目录下。
```
cp -r dist/* .
```

使用浏览器打开 `http://127.0.0.1:9080/apisix/dashboard/` 即可使用,
不用填写用户名和密码,直接登录。

Expand Down
1 change: 1 addition & 0 deletions apisix/core/config_etcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ local function sync_data(self)
end

elseif res.value then
res.clean_handlers = {}
insert_tab(self.values, res)
self.values_hash[key] = #self.values
res.value.id = key
Expand Down
45 changes: 45 additions & 0 deletions apisix/core/config_util.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--
-- 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.
--
local setmetatable = setmetatable
local type = type


local _M = {}


local function _iterate_values(self, tab)
while true do
self.idx = self.idx + 1
local v = tab[self.idx]
if type(v) == "table" then
return self.idx, v
end
if v == nil then
return nil, nil
end
-- skip the tombstone
end
end


function _M.iterate_values(tab)
local iter = setmetatable({idx = 0}, {__call = _iterate_values})
return iter, tab, 0
end


return _M
Loading

0 comments on commit 8b2cd1c

Please sign in to comment.