-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feature: support etcd v3 #1943
feature: support etcd v3 #1943
Conversation
@Yiyiyimu love you, nice PR |
conf/config.yaml
Outdated
@@ -122,6 +122,7 @@ etcd: | |||
- "http://127.0.0.1:2379" # multiple etcd address | |||
prefix: "/apisix" # apisix configurations prefix | |||
timeout: 30 # 3 seconds | |||
version: "v3" # etcd version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can only support etcd v3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my plan, I'll implement for etcd v3 only at first, and then go to multi-version etcd, if necessary. And of course I'll be glad if we support v3 only.
@Yiyiyimu do we need to update lua-resty-etcd first? |
Hi @moonming I think v1.0 would be enough for now. I'm trying to make all the changes on the APISIX side but there might be some modifications on lua-resty-etcd later, for example, compact(to avoid revision accumulation) has not been fully implemented yet. So I think it would be better to release newer version of lua-resty-etcd sometime later when everything on this side is settled down. |
the same feature as #1941? |
yes |
Hi @chelintsien @moonming supporting etcd v3 is a task of ISCAS summer plan (#1542) |
Hi, @chelintsien, Thank you for your contribution! @Yiyiyimu etcd v3 support is an urgent need, we should hurry up and complete it as soon as possible. |
ok!
nic-chen <[email protected]>于2020年8月1日 周六上午12:27写道:
Hi, @chelintsien <https://github.com/ChelinTsien>, Thank you for your
contribution!
As @Yiyiyimu <https://github.com/Yiyiyimu> said, etcd v3 support is a
task of summer 2020. He spent a lot of time studying and researching and
working with APISIX and lua-resty-etcd. And judging from the code
submitted by this pr, I think he can do this job well. We should give him
the opportunity to complete this task. You can help review the code, which
is also a great contribution. What do you think?
@Yiyiyimu <https://github.com/Yiyiyimu> etcd v3 support is an urgent
need, we should hurry up and complete it as soon as possible.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1943 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMYPQ25LGZR5MPVO2PAE73R6LWGBANCNFSM4PNJOLEA>
.
--
Best regards
|
Since the production environment uses apisix and apisix doesn't support etcd v3 at the moment so it took almost a day to deal with this issue, sorry for not seeing this assignment, agree with you! @nic-chen |
@chelintsien Thank you for your hard work and the understanding. :) |
Sure I'll try to provide the minimum working PR ASAP |
Feature implemented in this commit:
And another question hasn't been solved here is do we need multi-version of etcd? @moonming |
end | ||
res_data = res_data.node and res_data.node or res_data | ||
res_data = res_data.nodes and res_data.nodes or res_data | ||
res_data = #res_data == 1 and res_data[1] or res_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main modification to make the output of v2&v3 stay the same
Some difference of v2/v3 being solved:
|
@@ -19,6 +19,8 @@ local local_conf = require("apisix.core.config_local").local_conf() | |||
|
|||
local config_center = local_conf.apisix and local_conf.apisix.config_center | |||
or "etcd" | |||
local etcd_version = local_conf.etcd.version == "v3" and "_v3" or "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all code in one line is not easy to read.
split it into multiple lines is better for this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, just which one would be better, if-else, or like config_center
to split or case into next line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to support etcd v3 in file : bin/apisix (init_etcd function)
Thank you and your work! I've overlooked this part before |
@@ -705,20 +705,17 @@ GET /t | |||
"uri": "/index.html" | |||
}]], | |||
[[{ | |||
"node": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'd better keep the old response structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @membphis! Response of etcd v3 is quite different from v2. For example like this, v3 would not return action
, and flatten "node-nodes" structure into one layer "kvs". Thus I try to only return content inside node/nodes and kvs, to develop compatibility of different etcd version,
But modifying all test files is quite a big work. So I just submit a PR to mock etcd v2 response in #2036, keeping the old structure if we need.
But I still believe it could be better to get closer to v3 structure, since v2 could be deprecated one day, and there are some new functions of v3 that could not been mocked into v2.
Close since #2036 is merged |
What this PR does / why we need it:
fix #1767
Pre-submission checklist: