Skip to content

Commit

Permalink
:Merge branch 'master' of https://github.com/apache/apisix into brotli
Browse files Browse the repository at this point in the history
  • Loading branch information
yuweizzz committed Dec 5, 2023
2 parents fa6aaf1 + a440912 commit cd8f323
Show file tree
Hide file tree
Showing 134 changed files with 3,705 additions and 4,990 deletions.
4 changes: 4 additions & 0 deletions .asf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ github:
dismiss_stale_reviews: true
require_code_owner_reviews: true
required_approving_review_count: 2
release/3.7:
required_pull_request_reviews:
require_code_owner_reviews: true
required_approving_review_count: 2
release/3.6:
required_pull_request_reviews:
require_code_owner_reviews: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('apisix-master-0.rockspec') }}

- name: Extract branch name
if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/centos7-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-centos7-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
key: ${{ runner.os }}-${{ env.cache-name }}-centos7-${{ hashFiles('apisix-master-0.rockspec') }}

- name: Extract branch name
if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
cd apisix-build-tools
make package type=rpm app=apisix version=${VERSION} checkout=release/${VERSION} image_base=centos image_tag=7 local_code_path=./apisix
cd ..
rm -rf $(ls -1 --ignore=apisix-build-tools --ignore=t --ignore=utils --ignore=ci --ignore=Makefile --ignore=rockspec)
rm -rf $(ls -1 -I apisix-build-tools -I t -I utils -I ci --ignore=Makefile -I "*.rockspec")
- name: Start Dubbo Backend
run: |
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/cli-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.job_name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.job_name }}-${{ hashFiles('apisix-master-0.rockspec') }}

- name: Linux launch common services
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.job_name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.job_name }}-${{ hashFiles('apisix-master-0.rockspec') }}

- name: Linux launch common services
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fips.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('apisix-master-0.rockspec') }}

- name: Cache openssl-3.0 compilation
id: cache-openssl
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fuzzing-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ hashFiles('apisix-master-0.rockspec') }}

- name: Linux launch common services
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gm-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('apisix-master-0.rockspec') }}

- name: Cache Tongsuo compilation
id: cache-tongsuo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('apisix-master-0.rockspec') }}

- name: Cache Tongsuo compilation
id: cache-tongsuo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.os_name }}-${{ hashFiles('apisix-master-0.rockspec') }}

- name: Install Dependencies
run: sudo ./ci/performance_test.sh install_dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/redhat-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
cache-name: cache-deps
with:
path: deps
key: ${{ runner.os }}-${{ env.cache-name }}-ubi8.6-${{ hashFiles('rockspec/apisix-master-0.rockspec') }}
key: ${{ runner.os }}-${{ env.cache-name }}-ubi8.6-${{ hashFiles('apisix-master-0.rockspec') }}

- name: Extract branch name
if: ${{ startsWith(github.ref, 'refs/heads/release/') }}
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
cd apisix-build-tools
make package type=rpm app=apisix version=${VERSION} checkout=release/${VERSION} image_base=ubi image_tag=8.6 local_code_path=./apisix
cd ..
rm -rf $(ls -1 --ignore=apisix-build-tools --ignore=t --ignore=utils --ignore=ci --ignore=Makefile --ignore=rockspec)
rm -rf $(ls -1 -I apisix-build-tools -I t -I utils -I ci --ignore=Makefile -I "*.rockspec")
- name: Start Dubbo Backend
run: |
Expand Down
39 changes: 39 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

- [3.7.0](#370)
- [3.6.0](#360)
- [3.5.0](#350)
- [3.4.0](#340)
Expand Down Expand Up @@ -73,6 +74,44 @@ title: Changelog
- [0.7.0](#070)
- [0.6.0](#060)

## 3.7.0

### Change

- :warning: Creating core resources does not allow passing in `create_time` and `update_time`: [#10232](https://github.com/apache/apisix/pull/10232)
- :warning: Remove self-contained info fields `exptime` and `validity_start` and `validity_end` from ssl schema: [10323](https://github.com/apache/apisix/pull/10323)
- :warning: Replace `route` with `apisix.route_name`, `service` with `apisix.service_name` in the attributes of opentelemetry plugin to follow the standards for span name and attributes: [#10393](https://github.com/apache/apisix/pull/10393)

### Core

- :sunrise: Added token to support access control for consul discovery: [#10278](https://github.com/apache/apisix/pull/10278)
- :sunrise: Support configuring `service_id` in stream_route to reference service resources: [#10298](https://github.com/apache/apisix/pull/10298)
- :sunrise: Using `apisix-runtime` as the apisix runtime:
- [#10415](https://github.com/apache/apisix/pull/10415)
- [#10427](https://github.com/apache/apisix/pull/10427)

### Plugins

- :sunrise: Add tests for authz-keycloak with apisix secrets: [#10353](https://github.com/apache/apisix/pull/10353)
- :sunrise: Add authorization params to openid-connect plugin: [#10058](https://github.com/apache/apisix/pull/10058)
- :sunrise: Support set variable in zipkin plugin: [#10361](https://github.com/apache/apisix/pull/10361)
- :sunrise: Support Nacos ak/sk authentication: [#10445](https://github.com/apache/apisix/pull/10445)

### Bugfixes

- Fix: Use warn log for get healthcheck target status failure:
- [#10156](https://github.com/apache/apisix/pull/10156)
- Fix: Keep healthcheck target state when upstream changes:
- [#10312](https://github.com/apache/apisix/pull/10312)
- [#10307](https://github.com/apache/apisix/pull/10307)
- Fix: Add name field in plugin_config schema for consistency: [#10315](https://github.com/apache/apisix/pull/10315)
- Fix: Optimize tls in upstream_schema and wrong variable: [#10269](https://github.com/apache/apisix/pull/10269)
- Fix(consul): Failed to exit normally: [#10342](https://github.com/apache/apisix/pull/10342)
- Fix: The request header with `Content-Type: application/x-www-form-urlencoded;charset=utf-8` will cause vars condition `post_arg_xxx` matching to failed: [#10372](https://github.com/apache/apisix/pull/10372)
- Fix: Make install failed on mac: [#10403](https://github.com/apache/apisix/pull/10403)
- Fix(log-rotate): Log compression timeout caused data loss: [#8620](https://github.com/apache/apisix/pull/8620)
- Fix(kafka-logger): Remove 0 from enum of required_acks: [#10469](https://github.com/apache/apisix/pull/10469)

## 3.6.0

### Change
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ deps: runtime
$(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.OPENSSL_LIBDIR $(addprefix $(ENV_OPENSSL_PREFIX), /lib); \
$(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.OPENSSL_INCDIR $(addprefix $(ENV_OPENSSL_PREFIX), /include); \
[ '$(ENV_OS_NAME)' == 'darwin' ] && $(ENV_LUAROCKS) config $(ENV_LUAROCKS_FLAG_LOCAL) variables.PCRE_INCDIR $(addprefix $(ENV_PCRE_PREFIX), /include); \
$(ENV_LUAROCKS) install rockspec/apisix-master-0.rockspec --tree deps --only-deps $(ENV_LUAROCKS_SERVER_OPT); \
$(ENV_LUAROCKS) install apisix-master-0.rockspec --tree deps --only-deps $(ENV_LUAROCKS_SERVER_OPT); \
else \
$(call func_echo_warn_status, "WARNING: You're not using LuaRocks 3.x; please remove the luarocks and reinstall it via https://raw.githubusercontent.com/apache/apisix/master/utils/linux-install-luarocks.sh"); \
exit 1; \
Expand Down Expand Up @@ -435,8 +435,8 @@ compress-tar:
./apisix \
./bin \
./conf \
./rockspec/apisix-$(VERSION)*.rockspec \
./rockspec/apisix-master-0.rockspec \
./apisix-$(VERSION)*.rockspec \
./apisix-master-0.rockspec \
LICENSE \
Makefile \
NOTICE \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ A/B testing, canary release, blue-green deployment, limit rate, defense against

- Zipkin tracing: [Zipkin](docs/en/latest/plugins/zipkin.md)
- Open source APM: support [Apache SkyWalking](docs/en/latest/plugins/skywalking.md)
- Works with external service discovery: In addition to the built-in etcd, it also supports [Consul](docs/en/latest/discovery/consul_kv.md), [Nacos](docs/en/latest/discovery/nacos.md), [Eureka](docs/en/latest/discovery/eureka.md) and [Zookeeper (CP)](https://github.com/api7/apisix-seed/blob/main/docs/en/latest/zookeeper.md).
- Works with external service discovery: In addition to the built-in etcd, it also supports [Consul](docs/en/latest/discovery/consul.md), [Consul_kv](docs/en/latest/discovery/consul_kv.md), [Nacos](docs/en/latest/discovery/nacos.md), [Eureka](docs/en/latest/discovery/eureka.md) and [Zookeeper (CP)](https://github.com/api7/apisix-seed/blob/main/docs/en/latest/zookeeper.md).
- Monitoring And Metrics: [Prometheus](docs/en/latest/plugins/prometheus.md)
- Clustering: APISIX nodes are stateless, creates clustering of the configuration center, please refer to [etcd Clustering Guide](https://etcd.io/docs/v3.5/op-guide/clustering/).
- High availability: Support to configure multiple etcd addresses in the same cluster.
Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions apisix/admin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ end
local function post_reload_plugins()
set_ctx_and_check_token()

local success, err = events.post(reload_event, get_method(), ngx_time())
local success, err = events:post(reload_event, get_method(), ngx_time())
if not success then
core.response.exit(503, err)
end
Expand Down Expand Up @@ -453,9 +453,10 @@ function _M.init_worker()
end

router = route.new(uri_route)
events = require("resty.worker.events")

events.register(reload_plugins, reload_event, "PUT")
-- register reload plugin handler
events = require("apisix.events")
events:register(reload_plugins, reload_event, "PUT")

if ngx_worker_id() == 0 then
-- check if admin_key is required
Expand Down
1 change: 1 addition & 0 deletions apisix/core/config_yaml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ local function read_apisix_yaml(premature, pre_mtime)

apisix_yaml = apisix_yaml_new
apisix_yaml_ctime = last_change_time
log.warn("config file ", apisix_yaml_path, " reloaded.")
end


Expand Down
32 changes: 15 additions & 17 deletions apisix/core/etcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,6 @@ local function kvs_to_node(kvs)
end
_M.kvs_to_node = kvs_to_node

local function kvs_to_nodes(res)
res.body.node.dir = true
res.body.node.nodes = setmetatable({}, array_mt)
for i=2, #res.body.kvs do
res.body.node.nodes[i-1] = kvs_to_node(res.body.kvs[i])
end
return res
end


local function not_found(res)
res.body.message = "Key not found"
res.reason = "Not found"
Expand Down Expand Up @@ -211,13 +201,22 @@ function _M.get_format(res, real_key, is_dir, formatter)
else
-- In etcd v2, the direct key asked for is `node`, others which under this dir are `nodes`
-- While in v3, this structure is flatten and all keys related the key asked for are `kvs`
res.body.node = kvs_to_node(res.body.kvs[1])
if not res.body.kvs[1].value then
-- remove last "/" when necessary
if string.byte(res.body.node.key, -1) == 47 then
res.body.node.key = string.sub(res.body.node.key, 1, #res.body.node.key-1)
res.body.node = {
key = real_key,
dir = true,
nodes = setmetatable({}, array_mt)
}
local kvs = res.body.kvs
if #kvs >= 1 and not kvs[1].value then
res.body.node.createdIndex = tonumber(kvs[1].create_revision)
res.body.node.modifiedIndex = tonumber(kvs[1].mod_revision)
for i=2, #kvs do
res.body.node.nodes[i-1] = kvs_to_node(kvs[i])
end
else
for i=1, #kvs do
res.body.node.nodes[i] = kvs_to_node(kvs[i])
end
res = kvs_to_nodes(res)
end
end

Expand Down Expand Up @@ -316,7 +315,6 @@ function _M.get(key, is_dir)
if not res then
return nil, err
end

return _M.get_format(res, key, is_dir)
end

Expand Down
6 changes: 4 additions & 2 deletions apisix/core/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,13 @@ local resolve_var
do
local _ctx
local n_resolved
local pat = [[(?<!\\)\$\{?(\w+)\}?]]
local pat = [[(?<!\\)\$(\{(\w+)\}|(\w+))]]
local _escaper

local function resolve(m)
local v = _ctx[m[1]]
local variable = m[2] or m[3]
local v = _ctx[variable]

if v == nil then
return ""
end
Expand Down
2 changes: 1 addition & 1 deletion apisix/core/version.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
-- @module core.version

return {
VERSION = "3.6.0"
VERSION = "3.7.0"
}
8 changes: 4 additions & 4 deletions apisix/discovery/consul/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ function _M.connect(premature, consul_server, retry_delay)
update_all_services(consul_server.consul_server_url, up_services)

--update events
local post_ok, post_err = events.post(events_list._source,
local post_ok, post_err = events:post(events_list._source,
events_list.updating, all_services)
if not post_ok then
log.error("post_event failure with ", events_list._source,
Expand Down Expand Up @@ -579,14 +579,14 @@ function _M.init_worker()
end
end

events = require("resty.worker.events")
events_list = events.event_list(
events = require("apisix.events")
events_list = events:event_list(
"discovery_consul_update_all_services",
"updating"
)

if 0 ~= ngx_worker_id() then
events.register(discovery_consul_callback, events_list._source, events_list.updating)
events:register(discovery_consul_callback, events_list._source, events_list.updating)
return
end

Expand Down
8 changes: 4 additions & 4 deletions apisix/discovery/consul_kv/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function _M.connect(premature, consul_server, retry_delay)

update_application(consul_server.server_name_key, result.body)
--update events
local ok, err = events.post(events_list._source, events_list.updating, applications)
local ok, err = events:post(events_list._source, events_list.updating, applications)
if not ok then
log.error("post_event failure with ", events_list._source,
", update application error: ", err)
Expand Down Expand Up @@ -369,14 +369,14 @@ function _M.init_worker()
end
end

events = require("resty.worker.events")
events_list = events.event_list(
events = require("apisix.events")
events_list = events:event_list(
"discovery_consul_update_application",
"updating"
)

if 0 ~= ngx.worker.id() then
events.register(discovery_consul_callback, events_list._source, events_list.updating)
events:register(discovery_consul_callback, events_list._source, events_list.updating)
return
end

Expand Down
8 changes: 4 additions & 4 deletions apisix/discovery/nacos/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ local function fetch_full_registry(premature)
return
end
applications = up_apps
local ok, err = events.post(events_list._source, events_list.updating,
local ok, err = events:post(events_list._source, events_list.updating,
applications)
if not ok then
log.error("post_event failure with ", events_list._source,
Expand Down Expand Up @@ -395,12 +395,12 @@ end


function _M.init_worker()
events = require("resty.worker.events")
events_list = events.event_list("discovery_nacos_update_application",
events = require("apisix.events")
events_list = events:event_list("discovery_nacos_update_application",
"updating")

if 0 ~= ngx.worker.id() then
events.register(discovery_nacos_callback, events_list._source,
events:register(discovery_nacos_callback, events_list._source,
events_list.updating)
return
end
Expand Down
Loading

0 comments on commit cd8f323

Please sign in to comment.