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 2759e5bb8 chore(deployment): disable former health check to avoid
flaky test (#7344)
2759e5bb8 is described below
commit 2759e5bb81f3d2b3ef5abe7e50755028e81548c1
Author: 罗泽轩 <[email protected]>
AuthorDate: Wed Jun 29 09:16:12 2022 +0800
chore(deployment): disable former health check to avoid flaky test (#7344)
Signed-off-by: spacewander <[email protected]>
---
apisix/core/etcd.lua | 37 ++++++++++++++++++++++++-------------
rockspec/apisix-master-0.rockspec | 2 +-
2 files changed, 25 insertions(+), 14 deletions(-)
diff --git a/apisix/core/etcd.lua b/apisix/core/etcd.lua
index df26e04dc..a57a5d0c8 100644
--- a/apisix/core/etcd.lua
+++ b/apisix/core/etcd.lua
@@ -43,20 +43,28 @@ local function new()
end
local etcd_conf
+ local proxy_by_conf_server = false
- if local_conf.deployment
- and local_conf.deployment.role == "traditional"
- -- we proxy the etcd requests in traditional mode so we can test the
CP's behavior in
- -- daily development. However, a stream proxy can't be the CP.
- -- Hence, generate a HTTP conf server to proxy etcd requests in stream
proxy is
- -- unnecessary and inefficient.
- and is_http
- then
- local sock_prefix = ngx_config_prefix
+ if local_conf.deployment then
etcd_conf = clone_tab(local_conf.deployment.etcd)
- etcd_conf.unix_socket_proxy =
- "unix:" .. sock_prefix .. "/conf/config_listen.sock"
- etcd_conf.host = {"http://127.0.0.1:2379"}
+
+ if local_conf.deployment.role == "traditional"
+ -- we proxy the etcd requests in traditional mode so we can test
the CP's behavior in
+ -- daily development. However, a stream proxy can't be the CP.
+ -- Hence, generate a HTTP conf server to proxy etcd requests in
stream proxy is
+ -- unnecessary and inefficient.
+ and is_http
+ then
+ local sock_prefix = ngx_config_prefix
+ etcd_conf.unix_socket_proxy =
+ "unix:" .. sock_prefix .. "/conf/config_listen.sock"
+ etcd_conf.host = {"http://127.0.0.1:2379"}
+ proxy_by_conf_server = true
+
+ elseif local_conf.deployment.role == "control_plane" then
+ -- TODO: add the proxy conf in control_plane
+ proxy_by_conf_server = true
+ end
else
etcd_conf = clone_tab(local_conf.etcd)
end
@@ -88,7 +96,10 @@ local function new()
-- if an unhealthy etcd node is selected in a single admin read/write etcd
operation,
-- the retry mechanism for health check can select another healthy etcd
node
-- to complete the read/write etcd operation.
- if not health_check.conf then
+ if proxy_by_conf_server then
+ -- health check is done in conf server
+ health_check.disable()
+ elseif not health_check.conf then
health_check.init({
max_fails = 1,
retry = true,
diff --git a/rockspec/apisix-master-0.rockspec
b/rockspec/apisix-master-0.rockspec
index f5bfdae20..88b4886a6 100644
--- a/rockspec/apisix-master-0.rockspec
+++ b/rockspec/apisix-master-0.rockspec
@@ -34,7 +34,7 @@ dependencies = {
"lua-resty-ctxdump = 0.1-0",
"lua-resty-dns-client = 6.0.2",
"lua-resty-template = 2.0",
- "lua-resty-etcd = 1.7.0",
+ "lua-resty-etcd = 1.8.0",
"api7-lua-resty-http = 0.2.0",
"lua-resty-balancer = 0.04",
"lua-resty-ngxvar = 0.5.2",