Bug 1918413 - move-leader command does not work as expected from etcdctl container [NEEDINFO]
Summary: move-leader command does not work as expected from etcdctl container
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Etcd
Version: 4.10
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: ---
Assignee: Thomas Jungblut
QA Contact: ge liu
URL:
Whiteboard: LifecycleReset
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-20 16:36 UTC by Sam Batschelet
Modified: 2022-09-08 13:26 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-09-08 13:25:16 UTC
Target Upstream Version:
Embargoed:
mfojtik: needinfo?


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github etcd-io etcd pull 11775 0 None closed etcdctl: allow move-leader to connect to multiple endpoints with TLS 2022-05-07 12:07:34 UTC
Github etcd-io etcd pull 12757 0 None closed etcdctl: allow move-leader to connect to multiple endpoints with TLS 2022-05-07 12:07:36 UTC
Red Hat Knowledge Base (Solution) 6769681 0 None None None 2022-05-07 12:12:10 UTC

Description Sam Batschelet 2021-01-20 16:36:41 UTC
Description of problem: While we could argue that the command should not be run on its own but it does point out an issue with the container that we should consider.
 
sh-4.4# etcdctl move-leader 8e9e05c52164694d
2021-01-20 16:30:51.176860 C | pkg/flags: conflicting environment variable "ETCDCTL_CERT" is shadowed by corresponding command-line flag (either unset environment variable or disable flag)

this is an upstream bug that we should address something is wrong with cobra.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. run etcdctl member remove $id inside etcdctl container
2.
3.

Actual results: command fails as it believes it is consuming ETCDCTL_CERT while passing flag --cert flag which it is clearly not. 


Expected results: command works


Additional info:

Comment 2 Michal Fojtik 2021-03-07 20:26:58 UTC
This bug hasn't had any activity in the last 30 days. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're marking this bug as "LifecycleStale" and decreasing the severity/priority. If you have further information on the current state of the bug, please update it, otherwise this bug can be closed in about 7 days. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. Additionally, you can add LifecycleFrozen into Keywords if you think this bug should never be marked as stale. Please consult with bug assignee before you do that.

Comment 3 Robin Cernin 2021-03-08 02:56:47 UTC
Hi Sam,

With https://github.com/etcd-io/etcd/pull/11775:

➜  ~ oc rsh -n openshift-etcd etcd-master-0.example.com
Defaulting container name to etcdctl.
Use 'oc describe pod/etcd-master-0.example.com -n openshift-etcd' to see all of the containers in this pod.
sh-4.4#  /tmp/etcdctl move-leader aea116dbb5d40084
Leadership transferred from d6da693211cb40a to aea116dbb5d40084
sh-4.4#

It's because mustClientFromCmd calls clientConfigFromCmd in https://github.com/zerodayz/etcd/blob/34bd797e6754911ee540e8c87f708f88ffe89f37/etcdctl/ctlv3/command/move_leader_command.go#L45

func mustClientFromCmd(cmd *cobra.Command) *clientv3.Client {
	cfg := clientConfigFromCmd(cmd)
	return cfg.mustClient()
}

And then again in https://github.com/zerodayz/etcd/blob/34bd797e6754911ee540e8c87f708f88ffe89f37/etcdctl/ctlv3/command/move_leader_command.go#L55

for _, ep := range eps {
	cfg := clientConfigFromCmd(cmd)
	cfg.endpoints = []string{ep}
	cli := cfg.mustClient()

clientConfigFromCmd initiates twice the variables, the second time they are already configured and flags complains it's already set.

Seems like the PR was never merged and closed.

Comment 5 Michal Fojtik 2021-03-08 03:26:58 UTC
The LifecycleStale keyword was removed because the bug got commented on recently.
The bug assignee was notified.

Comment 18 Thomas Jungblut 2022-08-03 16:29:29 UTC
updated the upstream PR: https://github.com/etcd-io/etcd/pull/14307


Note You need to log in before you can comment on or make changes to this bug.