Skip to content

Commit

Permalink
feat: release 2.10.1 (#5310)
Browse files Browse the repository at this point in the history
Co-authored-by: 罗泽轩 <[email protected]>
Co-authored-by: zdzh <[email protected]>
Co-authored-by: jack.fu <[email protected]>
Co-authored-by: leslie <[email protected]>
Co-authored-by: tzssangglass <[email protected]>
Co-authored-by: oliver <[email protected]>
Co-authored-by: zdzh <[email protected]>
Co-authored-by: jackfu <[email protected]>
  • Loading branch information
8 people authored Oct 25, 2021
1 parent 6cab3b6 commit ea6db48
Show file tree
Hide file tree
Showing 20 changed files with 416 additions and 32 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ title: Changelog

## Table of Contents

- [2.10.1](#2101)
- [2.10.0](#2100)
- [2.9.0](#290)
- [2.8.0](#280)
Expand All @@ -46,6 +47,18 @@ title: Changelog
- [0.7.0](#070)
- [0.6.0](#060)

## 2.10.1

### Bugfix

- fix(zipkin): response_span doesn't have correct start time [#5295](https://github.com/apache/apisix/pull/5295)
- fix(ext-plugin): don't use stale key [#5309](https://github.com/apache/apisix/pull/5309)
- fix: route's timeout should not be overwrittern by service [#5219](https://github.com/apache/apisix/pull/5219)
- fix: filter nil plugin conf triggered by etcd dir init [#5204](https://github.com/apache/apisix/pull/5204)
- fix: pass correct host header to health checker target nodes [#5175](https://github.com/apache/apisix/pull/5175)
- fix: upgrade lua-resty-balancer to 0.04 [#5144](https://github.com/apache/apisix/pull/5144)
- fix(prometheus): avoid negative latency caused by inconsistent Nginx metrics [#5150](https://github.com/apache/apisix/pull/5150)

## 2.10.0

### Change
Expand Down
2 changes: 1 addition & 1 deletion apisix/core/version.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
-- limitations under the License.
--
return {
VERSION = "2.10.0"
VERSION = "2.10.1"
}
17 changes: 12 additions & 5 deletions apisix/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,14 @@ function _M.load(config)
http_plugin_names = {}
stream_plugin_names = {}
local plugins_conf = config.value
for _, conf in ipairs(plugins_conf) do
if conf.stream then
core.table.insert(stream_plugin_names, conf.name)
else
core.table.insert(http_plugin_names, conf.name)
-- plugins_conf can be nil when another instance writes into etcd key "/apisix/plugins/"
if plugins_conf then
for _, conf in ipairs(plugins_conf) do
if conf.stream then
core.table.insert(stream_plugin_names, conf.name)
else
core.table.insert(http_plugin_names, conf.name)
end
end
end
end
Expand Down Expand Up @@ -409,6 +412,10 @@ local function merge_service_route(service_conf, route_conf)
new_conf.value.script = route_conf.value.script
end

if route_conf.value.timeout then
new_conf.value.timeout = route_conf.value.timeout
end

if route_conf.value.name then
new_conf.value.name = route_conf.value.name
else
Expand Down
1 change: 1 addition & 0 deletions apisix/plugins/ext-plugin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ local type = type
local events_list
local lrucache = core.lrucache.new({
type = "plugin",
invalid_stale = true,
ttl = helper.get_conf_token_cache_time(),
})

Expand Down
15 changes: 12 additions & 3 deletions apisix/plugins/prometheus/exporter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ function _M.log(conf, ctx)
metrics.latency:observe(upstream_latency,
gen_arr("upstream", route_id, service_id, consumer_name, balancer_ip))
apisix_latency = apisix_latency - upstream_latency

-- The latency might be negative, as Nginx uses different time measurements in
-- different metrics.
-- See https://github.com/apache/apisix/issues/5146#issuecomment-928919399
if apisix_latency < 0 then
apisix_latency = 0
end

end
metrics.latency:observe(apisix_latency,
gen_arr("apisix", route_id, service_id, consumer_name, balancer_ip))
Expand All @@ -165,9 +173,10 @@ function _M.log(conf, ctx)
end


local ngx_status_items = {"active", "accepted", "handled", "total",
"reading", "writing", "waiting"}
local label_values = {}
local ngx_status_items = {"active", "accepted", "handled", "total",
"reading", "writing", "waiting"}
local label_values = {}

local function nginx_status()
local res = ngx_capture("/apisix/nginx_status")
if not res or res.status ~= 200 then
Expand Down
5 changes: 2 additions & 3 deletions apisix/plugins/zipkin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,14 @@ function _M.header_filter(conf, ctx)
local end_time = opentracing.tracer:time()

if conf.span_version == ZIPKIN_SPAN_VER_1 then
ctx.HEADER_FILTER_END_TIME = end_time
if opentracing.proxy_span then
opentracing.body_filter_span = opentracing.proxy_span:start_child_span(
"apisix.body_filter", ctx.HEADER_FILTER_END_TIME)
"apisix.body_filter", end_time)
end
else
opentracing.proxy_span:finish(end_time)
opentracing.response_span = opentracing.request_span:start_child_span(
"apisix.response_span", ctx.HEADER_FILTER_END_TIME)
"apisix.response_span", end_time)
end
end

Expand Down
6 changes: 5 additions & 1 deletion apisix/upstream.lua
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ local function create_checker(upstream)

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
local up_hdr = upstream.pass_host == "rewrite" and upstream.upstream_host
local use_node_hdr = upstream.pass_host == "node"
for _, node in ipairs(upstream.nodes) do
local ok, err = checker:add_target(node.host, port or node.port, host)
local host_hdr = up_hdr or (use_node_hdr and node.domain)
local ok, err = checker:add_target(node.host, port or node.port, host,
true, host_hdr)
if not ok then
core.log.error("failed to add new health check target: ", node.host, ":",
port or node.port, " err: ", err)
Expand Down
2 changes: 1 addition & 1 deletion docs/en/latest/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.10.0",
"version": "2.10.1",
"sidebar": [
{
"type": "category",
Expand Down
14 changes: 7 additions & 7 deletions docs/en/latest/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ You can install Apache APISIX via RPM package, Docker, Helm Chart, and source re
This installation method is suitable for CentOS 7, please run the following command to install Apache APISIX.

```shell
sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.0/apisix-2.10.0-0.el7.x86_64.rpm
sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.1/apisix-2.10.1-0.el7.x86_64.rpm
```

### Installation via Docker
Expand All @@ -49,31 +49,31 @@ Please refer to: [Installing Apache APISIX with Helm Chart](https://github.com/a

### Installation via Source Release Package

1. Create a directory named `apisix-2.10.0`.
1. Create a directory named `apisix-2.10.1`.

```shell
mkdir apisix-2.10.0
mkdir apisix-2.10.1
```

2. Download Apache APISIX Release source package.

```shell
wget https://downloads.apache.org/apisix/2.10.0/apache-apisix-2.10.0-src.tgz
wget https://downloads.apache.org/apisix/2.10.1/apache-apisix-2.10.1-src.tgz
```

You can also download the Apache APISIX Release source package from the Apache APISIX website. The [Apache APISIX Official Website - Download Page](https://apisix.apache.org/downloads/) also provides source packages for Apache APISIX, APISIX Dashboard and APISIX Ingress Controller.

3. Unzip the Apache APISIX Release source package.

```shell
tar zxvf apache-apisix-2.10.0-src.tgz -C apisix-2.10.0
tar zxvf apache-apisix-2.10.1-src.tgz -C apisix-2.10.1
```

4. Install the runtime dependent Lua libraries.

```shell
# Switch to the apisix-2.10.0 directory
cd apisix-2.10.0
# Switch to the apisix-2.10.1 directory
cd apisix-2.10.1
# Create dependencies
make deps
```
Expand Down
13 changes: 13 additions & 0 deletions docs/zh/latest/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ title: CHANGELOG

## Table of Contents

- [2.10.1](#2101)
- [2.10.0](#2100)
- [2.9.0](#290)
- [2.8.0](#280)
Expand All @@ -46,6 +47,18 @@ title: CHANGELOG
- [0.7.0](#070)
- [0.6.0](#060)

## 2.10.1

### Bugfix

- 更正 zipkin 插件 response_span 的开始时间 [#5295](https://github.com/apache/apisix/pull/5295)
- 避免发送过期 key 给 plugin runner [#5309](https://github.com/apache/apisix/pull/5309)
- 更正 route 的 timeout 被 service 覆盖的问题 [#5219](https://github.com/apache/apisix/pull/5219)
- 过滤掉初始化 etcd 数据时产生的空 plugin conf [#5204](https://github.com/apache/apisix/pull/5204)
- 健康检查特定情况下会发送错误的 Host header [#5175](https://github.com/apache/apisix/pull/5175)
- 升级 lua-resty-balancer 到 0.04 [#5144](https://github.com/apache/apisix/pull/5144)
- prometheus 插件修复偶发的 latency 为负数的问题 [#5150](https://github.com/apache/apisix/pull/5150)

## 2.10.0

### Change
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/latest/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.10.0",
"version": "2.10.1",
"sidebar": [
{
"type": "category",
Expand Down
14 changes: 7 additions & 7 deletions docs/zh/latest/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Apache APISIX 的运行环境需要依赖 NGINX 和 etcd,所以在安装 Apach
这种安装方式适用于 CentOS 7 操作系统,请运行以下命令安装 Apache APISIX。

```shell
sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.0/apisix-2.10.0-0.el7.x86_64.rpm
sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.1/apisix-2.10.1-0.el7.x86_64.rpm
```

### 通过 Docker 安装
Expand All @@ -49,31 +49,31 @@ sudo yum install -y https://github.com/apache/apisix/releases/download/2.10.0/ap

### 通过源码包安装

1. 创建一个名为 `apisix-2.10.0` 的目录。
1. 创建一个名为 `apisix-2.10.1` 的目录。

```shell
mkdir apisix-2.10.0
mkdir apisix-2.10.1
```

2. 下载 Apache APISIX Release 源码包:

```shell
wget https://downloads.apache.org/apisix/2.10.0/apache-apisix-2.10.0-src.tgz
wget https://downloads.apache.org/apisix/2.10.1/apache-apisix-2.10.1-src.tgz
```

您也可以通过 Apache APISIX 官网下载 Apache APISIX Release 源码包。 Apache APISIX 官网也提供了 Apache APISIX、APISIX Dashboard 和 APISIX Ingress Controller 的源码包,详情请参考[Apache APISIX 官网-下载页](https://apisix.apache.org/zh/downloads)

3. 解压 Apache APISIX Release 源码包:

```shell
tar zxvf apache-apisix-2.10.0-src.tgz -C apisix-2.10.0
tar zxvf apache-apisix-2.10.1-src.tgz -C apisix-2.10.1
```

4. 安装运行时依赖的 Lua 库:

```shell
# 切换到 apisix-2.10.0 目录
cd apisix-2.10.0
# 切换到 apisix-2.10.1 目录
cd apisix-2.10.1
# 创建依赖
make deps
```
Expand Down
95 changes: 95 additions & 0 deletions rockspec/apisix-2.10.1-0.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
--
-- 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 = "apisix"
version = "2.10.1-0"
supported_platforms = {"linux", "macosx"}

source = {
url = "git://github.com/apache/apisix",
branch = "2.10.1",
}

description = {
summary = "Apache APISIX is a cloud-native microservices API gateway, delivering the ultimate performance, security, open source and scalable platform for all your APIs and microservices.",
homepage = "https://github.com/apache/apisix",
license = "Apache License 2.0",
}

dependencies = {
"lua-resty-ctxdump = 0.1-0",
"lua-resty-dns-client = 5.2.0",
"lua-resty-template = 2.0",
"lua-resty-etcd = 1.5.4",
"api7-lua-resty-http = 0.2.0",
"lua-resty-balancer = 0.04",
"lua-resty-ngxvar = 0.5.2",
"lua-resty-jit-uuid = 0.0.7",
"lua-resty-healthcheck-api7 = 2.2.0",
"lua-resty-jwt = 0.2.0",
"lua-resty-hmac-ffi = 0.05",
"lua-resty-cookie = 0.1.0",
"lua-resty-session = 2.24",
"opentracing-openresty = 0.1",
"lua-resty-radixtree = 2.8.1",
"lua-protobuf = 0.3.3",
"lua-resty-openidc = 1.7.2-1",
"luafilesystem = 1.7.0-2",
"api7-lua-tinyyaml = 0.3.0",
"nginx-lua-prometheus = 0.20210206",
"jsonschema = 0.9.5",
"lua-resty-ipmatcher = 0.6.1",
"lua-resty-kafka = 0.07",
"lua-resty-logger-socket = 2.0-0",
"skywalking-nginx-lua = 0.4-1",
"base64 = 1.5-2",
"binaryheap = 0.4",
"dkjson = 2.5-2",
"resty-redis-cluster = 1.02-4",
"lua-resty-expr = 1.3.1",
"graphql = 0.0.2",
"argparse = 0.7.1-1",
"luasocket = 3.0rc1-2",
"luasec = 0.9-1",
"lua-resty-consul = 0.3-2",
"penlight = 1.9.2-1",
"ext-plugin-proto = 0.3.0",
"casbin = 1.26.0",
"api7-snowflake = 2.0-1",
"inspect == 3.1.1",
}

build = {
type = "make",
build_variables = {
CFLAGS="$(CFLAGS)",
LIBFLAG="$(LIBFLAG)",
LUA_LIBDIR="$(LUA_LIBDIR)",
LUA_BINDIR="$(LUA_BINDIR)",
LUA_INCDIR="$(LUA_INCDIR)",
LUA="$(LUA)",
OPENSSL_INCDIR="$(OPENSSL_INCDIR)",
OPENSSL_LIBDIR="$(OPENSSL_LIBDIR)",
},
install_variables = {
INST_PREFIX="$(PREFIX)",
INST_BINDIR="$(BINDIR)",
INST_LIBDIR="$(LIBDIR)",
INST_LUADIR="$(LUADIR)",
INST_CONFDIR="$(CONFDIR)",
},
}
2 changes: 1 addition & 1 deletion rockspec/apisix-master-0.rockspec
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies = {
"lua-resty-template = 2.0",
"lua-resty-etcd = 1.5.4",
"api7-lua-resty-http = 0.2.0",
"lua-resty-balancer = 0.02rc5",
"lua-resty-balancer = 0.04",
"lua-resty-ngxvar = 0.5.2",
"lua-resty-jit-uuid = 0.0.7",
"lua-resty-healthcheck-api7 = 2.2.0",
Expand Down
21 changes: 21 additions & 0 deletions t/cli/test_admin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,24 @@ if ! echo "$out" | grep "Admin API can only be used with etcd config_center"; th
fi

echo "passed: Admin API can only be used with etcd config_center"

# disable Admin API and init plugins syncer
echo '
apisix:
enable_admin: false
' > conf/config.yaml

rm logs/error.log
make init
make run

make init

if grep -E "failed to fetch data from etcd" logs/error.log; then
echo "failed: should sync /apisix/plugins from etcd when disabling admin normal"
exit 1
fi

make stop

echo "pass: sync /apisix/plugins from etcd when disabling admin successfully"
Loading

0 comments on commit ea6db48

Please sign in to comment.