Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change: drop support of OpenResty 1.17 #7625

Merged
merged 1 commit into from
Aug 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- ubuntu-18.04
os_name:
- linux_openresty
- linux_openresty_1_17
- linux_openresty_1_19
test_dir:
- t/plugin
- t/admin t/cli t/config-center-yaml t/control t/core t/debug t/deployment t/discovery t/error_page t/misc
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/kubernetes-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- ubuntu-18.04
os_name:
- linux_openresty
- linux_openresty_1_17
- linux_openresty_1_19

runs-on: ${{ matrix.platform }}
timeout-minutes: 15
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tars-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- ubuntu-18.04
os_name:
- linux_openresty
- linux_openresty_1_17
- linux_openresty_1_19

runs-on: ${{ matrix.platform }}
timeout-minutes: 15
Expand Down
4 changes: 2 additions & 2 deletions apisix/balancer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ function _M.run(route, ctx, plugin_funcs)

local header_changed
local pass_host = ctx.pass_host
if pass_host == "node" and balancer.recreate_request then
if pass_host == "node" then
local host = server.upstream_host
if host ~= ctx.var.upstream_host then
-- retried node has a different host
Expand All @@ -377,7 +377,7 @@ function _M.run(route, ctx, plugin_funcs)

local _, run = plugin_funcs("before_proxy")
-- always recreate request as the request may be changed by plugins
if (run or header_changed) and balancer.recreate_request then
if run or header_changed then
balancer.recreate_request()
end
end
Expand Down
2 changes: 0 additions & 2 deletions apisix/cli/ngx_tpl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -473,11 +473,9 @@ http {
apisix.http_init_worker()
}

{% if not use_openresty_1_17 then %}
exit_worker_by_lua_block {
apisix.http_exit_worker()
}
{% end %}

{% if enable_control then %}
server {
Expand Down
8 changes: 1 addition & 7 deletions apisix/cli/ops.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,11 @@ Please modify "admin_key" in conf/config.yaml .
util.die("can not find openresty\n")
end

local need_ver = "1.17.8"
local need_ver = "1.19.3"
if not version_greater_equal(or_ver, need_ver) then
util.die("openresty version must >=", need_ver, " current ", or_ver, "\n")
end

local use_openresty_1_17 = false
if not version_greater_equal(or_ver, "1.19.3") then
use_openresty_1_17 = true
end

local or_info = util.execute_cmd("openresty -V 2>&1")
if or_info and not or_info:find("http_stub_status_module", 1, true) then
util.die("'http_stub_status_module' module is missing in ",
Expand Down Expand Up @@ -551,7 +546,6 @@ Please modify "admin_key" in conf/config.yaml .

-- Using template.render
local sys_conf = {
use_openresty_1_17 = use_openresty_1_17,
lua_path = env.pkg_path_org,
lua_cpath = env.pkg_cpath_org,
os_name = util.trim(util.execute_cmd("uname")),
Expand Down
2 changes: 1 addition & 1 deletion apisix/conf_server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ local function pick_node(ctx)
ctx.balancer_port = res.port

ngx_var.upstream_host = res.domain or res.host
if balancer.recreate_request and ngx.get_phase() == "balancer" then
if ngx.get_phase() == "balancer" then
balancer.recreate_request()
end

Expand Down
6 changes: 1 addition & 5 deletions apisix/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ local apisix_ssl = require("apisix.ssl")
local upstream_util = require("apisix.utils.upstream")
local xrpc = require("apisix.stream.xrpc")
local ctxdump = require("resty.ctxdump")
local ngx_balancer = require("ngx.balancer")
local debug = require("apisix.debug")
local pubsub_kafka = require("apisix.pubsub.kafka")
local ngx = ngx
Expand Down Expand Up @@ -219,10 +218,7 @@ local function set_upstream_host(api_ctx, picked_server)
return
end

local nodes_count = up_conf.nodes and #up_conf.nodes or 0
if nodes_count == 1 or ngx_balancer.recreate_request then
api_ctx.var.upstream_host = picked_server.upstream_host
end
api_ctx.var.upstream_host = picked_server.upstream_host
end


Expand Down
7 changes: 0 additions & 7 deletions apisix/upstream.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ local core = require("apisix.core")
local discovery = require("apisix.discovery.init").discovery
local upstream_util = require("apisix.utils.upstream")
local apisix_ssl = require("apisix.ssl")
local balancer = require("ngx.balancer")
local error = error
local tostring = tostring
local ipairs = ipairs
Expand Down Expand Up @@ -458,12 +457,6 @@ local function check_upstream_conf(in_dp, conf)
end

if is_http then
if conf.pass_host == "node" and conf.nodes and
not balancer.recreate_request and core.table.nkeys(conf.nodes) ~= 1
then
return false, "only support single node for `node` mode currently"
end

if conf.pass_host == "rewrite" and
(conf.upstream_host == nil or conf.upstream_host == "")
then
Expand Down
6 changes: 1 addition & 5 deletions bin/apisix
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ if [[ -e $OR_EXEC && "$OR_VER" -ge 119 ]]; then
# use the luajit of openresty
echo "$LUAJIT_BIN $APISIX_LUA $*"
exec $LUAJIT_BIN $APISIX_LUA $*
elif [[ "$LUA_VERSION" =~ "Lua 5.1" ]]; then
# OpenResty version is < 1.19, use Lua 5.1 by default
echo "lua $APISIX_LUA $*"
exec lua $APISIX_LUA $*
else
echo "ERROR: Please check the version of OpenResty and Lua, OpenResty 1.19+ + LuaJIT or OpenResty before 1.19 + Lua 5.1 is required for Apache APISIX."
echo "ERROR: Please check the version of OpenResty and Lua, OpenResty 1.19+ + LuaJIT is required for Apache APISIX."
fi
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
#


export OPENRESTY_VERSION=1.17.8.2
export OPENRESTY_VERSION=1.19.3.2
. ./ci/linux_openresty_common_runner.sh
6 changes: 0 additions & 6 deletions t/APISIX.pm
Original file line number Diff line number Diff line change
Expand Up @@ -561,17 +561,11 @@ _EOC_
require("apisix").http_init_worker()
$extra_init_worker_by_lua
}
_EOC_

if ($version !~ m/\/1.17.8/) {
$http_config .= <<_EOC_;
exit_worker_by_lua_block {
require("apisix").http_exit_worker()
}
_EOC_
}

$http_config .= <<_EOC_;
log_format main escape=default '\$remote_addr - \$remote_user [\$time_local] \$http_host "\$request" \$status \$body_bytes_sent \$request_time "\$http_referer" "\$http_user_agent" \$upstream_addr \$upstream_status \$upstream_response_time "\$upstream_scheme://\$upstream_host\$upstream_uri"';

# fake server, only for test
Expand Down
60 changes: 17 additions & 43 deletions t/admin/upstream4.t
Original file line number Diff line number Diff line change
Expand Up @@ -201,33 +201,7 @@ passed



=== TEST 7: invalid route: multi nodes with `node` mode to pass host
--- config
location /t {
content_by_lua_block {
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/upstreams/1',
ngx.HTTP_PUT,
[[{
"nodes": {
"httpbin.org:8080": 1,
"test.com:8080": 1
},
"type": "roundrobin",
"pass_host": "node"
}]]
)

ngx.status = code
ngx.print(body)
}
}
--- skip_nginx: 5: > 1.19.0
--- error_code: 400



=== TEST 8: invalid route: empty `upstream_host` when `pass_host` is `rewrite`
=== TEST 7: invalid route: empty `upstream_host` when `pass_host` is `rewrite`
--- config
location /t {
content_by_lua_block {
Expand All @@ -253,7 +227,7 @@ passed



=== TEST 9: set upstream(with labels)
=== TEST 8: set upstream(with labels)
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -299,7 +273,7 @@ passed



=== TEST 10: get upstream(with labels)
=== TEST 9: get upstream(with labels)
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -335,7 +309,7 @@ passed



=== TEST 11: patch upstream(only labels)
=== TEST 10: patch upstream(only labels)
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -375,7 +349,7 @@ passed



=== TEST 12: invalid format of label value: set upstream
=== TEST 11: invalid format of label value: set upstream
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -403,7 +377,7 @@ passed



=== TEST 13: patch upstream(whole, create_time)
=== TEST 12: patch upstream(whole, create_time)
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -453,7 +427,7 @@ passed



=== TEST 14: patch upstream(whole, update_time)
=== TEST 13: patch upstream(whole, update_time)
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -503,7 +477,7 @@ passed



=== TEST 15: create upstream with create_time and update_time
=== TEST 14: create upstream with create_time and update_time
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -543,7 +517,7 @@ passed



=== TEST 16: delete test upstream
=== TEST 15: delete test upstream
--- config
location /t {
content_by_lua_block {
Expand All @@ -563,7 +537,7 @@ passed



=== TEST 17: patch upstream with sub_path, the data is number
=== TEST 16: patch upstream with sub_path, the data is number
--- config
location /t {
content_by_lua_block {
Expand Down Expand Up @@ -606,7 +580,7 @@ passed



=== TEST 18: set upstream(id: 1)
=== TEST 17: set upstream(id: 1)
--- config
location /t {
content_by_lua_block {
Expand All @@ -630,7 +604,7 @@ passed



=== TEST 19: set service(id: 1)
=== TEST 18: set service(id: 1)
--- config
location /t {
content_by_lua_block {
Expand All @@ -653,7 +627,7 @@ passed



=== TEST 20: set route(id: 1)
=== TEST 19: set route(id: 1)
--- config
location /t {
content_by_lua_block {
Expand All @@ -677,7 +651,7 @@ passed



=== TEST 21: delete upstream(id: 1)
=== TEST 20: delete upstream(id: 1)
--- config
location /t {
content_by_lua_block {
Expand All @@ -696,7 +670,7 @@ passed



=== TEST 22: delete route(id: 1)
=== TEST 21: delete route(id: 1)
--- config
location /t {
content_by_lua_block {
Expand All @@ -715,7 +689,7 @@ passed



=== TEST 23: delete service(id: 1)
=== TEST 22: delete service(id: 1)
--- config
location /t {
content_by_lua_block {
Expand All @@ -734,7 +708,7 @@ passed



=== TEST 24: delete upstream(id: 1)
=== TEST 23: delete upstream(id: 1)
--- config
location /t {
content_by_lua_block {
Expand Down
11 changes: 1 addition & 10 deletions t/deployment/conf_server.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
use t::APISIX;

my $nginx_binary = $ENV{'TEST_NGINX_BINARY'} || 'nginx';
my $version = eval { `$nginx_binary -V 2>&1` };

if ($version =~ m/\/1.17.8/) {
plan(skip_all => "require OpenResty 1.19+");
} else {
plan('no_plan');
}
use t::APISIX 'no_plan';

add_block_preprocessor(sub {
my ($block) = @_;
Expand Down
11 changes: 1 addition & 10 deletions t/deployment/conf_server2.t
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
use t::APISIX;

my $nginx_binary = $ENV{'TEST_NGINX_BINARY'} || 'nginx';
my $version = eval { `$nginx_binary -V 2>&1` };

if ($version =~ m/\/1.17.8/) {
plan(skip_all => "require OpenResty 1.19+");
} else {
plan('no_plan');
}
use t::APISIX 'no_plan';

add_block_preprocessor(sub {
my ($block) = @_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ my $nginx_binary = $ENV{'TEST_NGINX_BINARY'} || 'nginx';
my $version = eval { `$nginx_binary -V 2>&1` };

if ($version !~ m/\/apisix-nginx-module/) {
if ($version =~ m/\/1.17.8/) {
plan(skip_all => "require OpenResty 1.19+");
} else {
plan('no_plan');
}
plan('no_plan');
} else {
plan(skip_all => "for vanilla OpenResty only");
}
Expand Down
Loading