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

[release-3.5]etcdctl: allow move-leader to connect to multiple endpoints #14434

Merged
merged 1 commit into from
Sep 8, 2022

Conversation

tjungblu
Copy link
Contributor

@tjungblu tjungblu commented Sep 7, 2022

Re-opening closed PR #11775 which was originaly authored by benmoss. Then again opened PR #12757 which was authored by zerodayz. And then a continuation of #14307.

The mustClientForCmd function is responsible for parsing environment variables and flags into configuration data. A change was made in #9382 to call Fatal if a flag is provided multiple times. This means that we cannot call the mustClientForCmd function more than once, since it will think that flags parsed the first time are now being redefined and error out.

Some people have commented about this in #8380 but I don't think there's an open issue for it.

Signed-off-by: Thomas Jungblut [email protected]

@@ -19,6 +19,7 @@ import (
"strconv"

"github.com/spf13/cobra"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor comment: Did you intentionally add this blank line or it's added by IDE automatically? I would suggest to keep it as it's. Of course, it isn't a big deal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep IDE, let me remove it again

Copy link
Member

@ahrtr ahrtr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a minor comment.

Thank you @tjungblu

cc @spzala @serathius @ptabor

Copy link
Member

@spzala spzala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tjungblu thanks! lgtm but I think the PR/commit description is not correct, so I would suggest to at least edit PR description for future reference if someone look at it. First, there is a typo in mustClientForCmd, it's mustClientCfgFromCmd. Secondly, it's not the mustClientCfgFromCmd getting called multiple times resulting into flag related error as the description says. It's the clientConfigFromCmd that's getting called twice (directly and through mustClientCfgFromCmd) which the PR provides fix for.

@@ -19,6 +19,7 @@ import (
"strconv"

"github.com/spf13/cobra"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Due to a duplicate call of clientConfigFromCmd, the move-leader command
would fail with "conflicting environment variable is shadowed by corresponding command-line flag".
Also in scenarios where no command-line flag was supplied.

Signed-off-by: Thomas Jungblut <[email protected]>
@tjungblu
Copy link
Contributor Author

tjungblu commented Sep 8, 2022

Thanks for the reviews, fixed the commit message and description and removed that newline.

@ahrtr
Copy link
Member

ahrtr commented Sep 8, 2022

@tjungblu Could you please backport this PR to 3.4 as well?

@tjungblu
Copy link
Contributor Author

tjungblu commented Sep 8, 2022

sure, can do.

@ahrtr ahrtr merged commit 646ba66 into etcd-io:release-3.5 Sep 8, 2022
@tjungblu tjungblu deleted the bz_1918413_3.5 branch September 8, 2022 10:08
@serathius serathius mentioned this pull request Sep 8, 2022
16 tasks
@ahrtr ahrtr changed the title etcdctl: allow move-leader to connect to multiple endpoints [release-3.5]etcdctl: allow move-leader to connect to multiple endpoints Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants