This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 381981e2f change: drop support of OpenResty 1.17 (#7625)
381981e2f is described below

commit 381981e2f1fb1f4e695e958724be61ef3f0fc95d
Author: 罗泽轩 <[email protected]>
AuthorDate: Mon Aug 8 19:31:57 2022 +0800

    change: drop support of OpenResty 1.17 (#7625)
    
    Discussed in 
https://lists.apache.org/thread/hvnop89clr0lx4v59gdvos41zcfnqpwq
    Signed-off-by: spacewander <[email protected]>
---
 .github/workflows/build.yml                        |  2 +-
 .github/workflows/kubernetes-ci.yml                |  2 +-
 .github/workflows/tars-ci.yml                      |  2 +-
 apisix/balancer.lua                                |  4 +-
 apisix/cli/ngx_tpl.lua                             |  2 -
 apisix/cli/ops.lua                                 |  8 +--
 apisix/conf_server.lua                             |  2 +-
 apisix/init.lua                                    |  6 +--
 apisix/upstream.lua                                |  7 ---
 bin/apisix                                         |  6 +--
 ...17_runner.sh => linux_openresty_1_19_runner.sh} |  2 +-
 t/APISIX.pm                                        |  6 ---
 t/admin/upstream4.t                                | 60 ++++++----------------
 t/deployment/conf_server.t                         | 11 +---
 t/deployment/conf_server2.t                        | 11 +---
 ...ls-openresty-1-19.t => client-mtls-openresty.t} |  6 +--
 t/node/upstream.t                                  |  6 ---
 .../{sanity-openresty-1-19.t => sanity2.t}         | 11 +---
 t/plugin/traffic-split2.t                          |  2 -
 t/stream-node/sanity.t                             |  2 -
 utils/linux-install-openresty.sh                   |  2 +-
 21 files changed, 32 insertions(+), 128 deletions(-)

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 21d185cbe..287067390 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -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
diff --git a/.github/workflows/kubernetes-ci.yml 
b/.github/workflows/kubernetes-ci.yml
index 66615cf80..41f3d46e4 100644
--- a/.github/workflows/kubernetes-ci.yml
+++ b/.github/workflows/kubernetes-ci.yml
@@ -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
diff --git a/.github/workflows/tars-ci.yml b/.github/workflows/tars-ci.yml
index e85044671..8a5f90f8b 100644
--- a/.github/workflows/tars-ci.yml
+++ b/.github/workflows/tars-ci.yml
@@ -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
diff --git a/apisix/balancer.lua b/apisix/balancer.lua
index d96b7a2a0..462d04f07 100644
--- a/apisix/balancer.lua
+++ b/apisix/balancer.lua
@@ -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
@@ -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
diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua
index 130033be7..b459cd027 100644
--- a/apisix/cli/ngx_tpl.lua
+++ b/apisix/cli/ngx_tpl.lua
@@ -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 {
diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index d2275bed5..ca091d9c6 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -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 ",
@@ -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")),
diff --git a/apisix/conf_server.lua b/apisix/conf_server.lua
index 2d6780bff..e0ea91e77 100644
--- a/apisix/conf_server.lua
+++ b/apisix/conf_server.lua
@@ -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
 
diff --git a/apisix/init.lua b/apisix/init.lua
index 25d9d5aa2..17f1740ef 100644
--- a/apisix/init.lua
+++ b/apisix/init.lua
@@ -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
@@ -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
 
 
diff --git a/apisix/upstream.lua b/apisix/upstream.lua
index 0162ad813..465098975 100644
--- a/apisix/upstream.lua
+++ b/apisix/upstream.lua
@@ -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
@@ -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
diff --git a/bin/apisix b/bin/apisix
index 4583fd1b5..780764ae9 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -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
diff --git a/ci/linux_openresty_1_17_runner.sh 
b/ci/linux_openresty_1_19_runner.sh
similarity index 96%
rename from ci/linux_openresty_1_17_runner.sh
rename to ci/linux_openresty_1_19_runner.sh
index b0cbde775..ed1751308 100755
--- a/ci/linux_openresty_1_17_runner.sh
+++ b/ci/linux_openresty_1_19_runner.sh
@@ -17,5 +17,5 @@
 #
 
 
-export OPENRESTY_VERSION=1.17.8.2
+export OPENRESTY_VERSION=1.19.3.2
 . ./ci/linux_openresty_common_runner.sh
diff --git a/t/APISIX.pm b/t/APISIX.pm
index 0143aa9d8..ce1bc4585 100644
--- a/t/APISIX.pm
+++ b/t/APISIX.pm
@@ -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
diff --git a/t/admin/upstream4.t b/t/admin/upstream4.t
index 1f55fc92e..7c909e26a 100644
--- a/t/admin/upstream4.t
+++ b/t/admin/upstream4.t
@@ -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 {
@@ -253,7 +227,7 @@ passed
 
 
 
-=== TEST 9: set upstream(with labels)
+=== TEST 8: set upstream(with labels)
 --- config
     location /t {
         content_by_lua_block {
@@ -299,7 +273,7 @@ passed
 
 
 
-=== TEST 10: get upstream(with labels)
+=== TEST 9: get upstream(with labels)
 --- config
     location /t {
         content_by_lua_block {
@@ -335,7 +309,7 @@ passed
 
 
 
-=== TEST 11: patch upstream(only labels)
+=== TEST 10: patch upstream(only labels)
 --- config
     location /t {
         content_by_lua_block {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -543,7 +517,7 @@ passed
 
 
 
-=== TEST 16: delete test upstream
+=== TEST 15: delete test upstream
 --- config
     location /t {
         content_by_lua_block {
@@ -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 {
@@ -606,7 +580,7 @@ passed
 
 
 
-=== TEST 18: set upstream(id: 1)
+=== TEST 17: set upstream(id: 1)
 --- config
     location /t {
         content_by_lua_block {
@@ -630,7 +604,7 @@ passed
 
 
 
-=== TEST 19: set service(id: 1)
+=== TEST 18: set service(id: 1)
 --- config
     location /t {
         content_by_lua_block {
@@ -653,7 +627,7 @@ passed
 
 
 
-=== TEST 20: set route(id: 1)
+=== TEST 19: set route(id: 1)
 --- config
     location /t {
         content_by_lua_block {
@@ -677,7 +651,7 @@ passed
 
 
 
-=== TEST 21: delete upstream(id: 1)
+=== TEST 20: delete upstream(id: 1)
 --- config
     location /t {
         content_by_lua_block {
@@ -696,7 +670,7 @@ passed
 
 
 
-=== TEST 22: delete route(id: 1)
+=== TEST 21: delete route(id: 1)
 --- config
     location /t {
         content_by_lua_block {
@@ -715,7 +689,7 @@ passed
 
 
 
-=== TEST 23: delete service(id: 1)
+=== TEST 22: delete service(id: 1)
 --- config
     location /t {
         content_by_lua_block {
@@ -734,7 +708,7 @@ passed
 
 
 
-=== TEST 24: delete upstream(id: 1)
+=== TEST 23: delete upstream(id: 1)
 --- config
     location /t {
         content_by_lua_block {
diff --git a/t/deployment/conf_server.t b/t/deployment/conf_server.t
index 4943c78e4..ee5234664 100644
--- a/t/deployment/conf_server.t
+++ b/t/deployment/conf_server.t
@@ -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) = @_;
diff --git a/t/deployment/conf_server2.t b/t/deployment/conf_server2.t
index d0dda360e..c9eb0ac9c 100644
--- a/t/deployment/conf_server2.t
+++ b/t/deployment/conf_server2.t
@@ -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) = @_;
diff --git a/t/node/client-mtls-openresty-1-19.t 
b/t/node/client-mtls-openresty.t
similarity index 96%
rename from t/node/client-mtls-openresty-1-19.t
rename to t/node/client-mtls-openresty.t
index a7bf517c1..7b388932d 100644
--- a/t/node/client-mtls-openresty-1-19.t
+++ b/t/node/client-mtls-openresty.t
@@ -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");
 }
diff --git a/t/node/upstream.t b/t/node/upstream.t
index 70da36145..f8623eb96 100644
--- a/t/node/upstream.t
+++ b/t/node/upstream.t
@@ -436,7 +436,6 @@ GET /t
     }
 --- request
 GET /t
---- skip_nginx: 5: < 1.19.0
 --- response_body
 passed
 --- no_error_log
@@ -447,7 +446,6 @@ passed
 === TEST 18: hit route
 --- request
 GET /uri
---- skip_nginx: 5: < 1.19.0
 --- response_body eval
 qr/host: 127.0.0.1/
 --- error_log
@@ -494,7 +492,6 @@ proxy request to 127.0.0.1:1980
     }
 --- request
 GET /t
---- skip_nginx: 5: < 1.19.0
 --- response_body
 passed
 --- no_error_log
@@ -505,7 +502,6 @@ passed
 === TEST 20: hit route
 --- request
 GET /uri
---- skip_nginx: 5: < 1.19.0
 --- response_body eval
 qr/host: localhost/
 --- error_log
@@ -607,7 +603,6 @@ qr/host: localhost:1980/
             ngx.say(body)
         }
     }
---- skip_nginx: 5: < 1.19.0
 --- request
 GET /t
 --- response_body
@@ -619,7 +614,6 @@ passed
 
 === TEST 24: hit route
 --- log_level: debug
---- skip_nginx: 5: < 1.19.0
 --- request
 GET /uri
 --- error_log
diff --git a/t/plugin/ext-plugin/sanity-openresty-1-19.t 
b/t/plugin/ext-plugin/sanity2.t
similarity index 86%
rename from t/plugin/ext-plugin/sanity-openresty-1-19.t
rename to t/plugin/ext-plugin/sanity2.t
index c33d86e00..206e7b090 100644
--- a/t/plugin/ext-plugin/sanity-openresty-1-19.t
+++ b/t/plugin/ext-plugin/sanity2.t
@@ -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';
 
 repeat_each(1);
 no_long_string();
diff --git a/t/plugin/traffic-split2.t b/t/plugin/traffic-split2.t
index 41bee399d..c41886283 100644
--- a/t/plugin/traffic-split2.t
+++ b/t/plugin/traffic-split2.t
@@ -744,7 +744,6 @@ qr/1980, 1981, 1982, 1980, 1981, 1982, 1980, 1981, 1982/
             ngx.say(body)
         }
     }
---- skip_nginx: 5: < 1.19.0
 --- response_body
 passed
 
@@ -753,7 +752,6 @@ passed
 === TEST 19: hit route
 --- request
 GET /uri?id=1
---- skip_nginx: 5: < 1.19.0
 --- response_body eval
 qr/host: 127.0.0.1/
 --- error_log
diff --git a/t/stream-node/sanity.t b/t/stream-node/sanity.t
index f42b89ca9..06e809dfd 100644
--- a/t/stream-node/sanity.t
+++ b/t/stream-node/sanity.t
@@ -373,7 +373,6 @@ GET /t
 passed
 --- no_error_log
 [error]
---- skip_nginx: 5: < 1.19.0
 
 
 
@@ -384,7 +383,6 @@ mmm
 hello world
 --- no_error_log
 [error]
---- skip_nginx: 5: < 1.19.0
 
 
 
diff --git a/utils/linux-install-openresty.sh b/utils/linux-install-openresty.sh
index 7498da3ab..c97454e3e 100755
--- a/utils/linux-install-openresty.sh
+++ b/utils/linux-install-openresty.sh
@@ -48,4 +48,4 @@ else
     openresty="openresty-debug=$OPENRESTY_VERSION*"
 fi
 
-sudo apt-get install "$openresty" lua5.1 liblua5.1-0-dev 
openresty-openssl111-debug-dev libldap2-dev
+sudo apt-get install "$openresty" openresty-openssl111-debug-dev libldap2-dev

Reply via email to