Bug 1610166 - etcdctl2&etcdctl3 is deprecated commands
Summary: etcdctl2&etcdctl3 is deprecated commands
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Installer
Version: 3.11.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 3.10.z
Assignee: Scott Dodson
QA Contact: Gaoyun Pei
Vikram Goyal
URL:
Whiteboard:
Depends On:
Blocks: 1640014
TreeView+ depends on / blocked
 
Reported: 2018-07-31 05:48 UTC by ge liu
Modified: 2018-10-17 07:09 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
The etcd helper functions `etcdctl2` and `etcdctl3` were broken during the upgrade to 3.10. These scripts have been updated to work properly when etcd is running inside a static pod restoring normal function.
Clone Of:
: 1640014 (view as bug list)
Environment:
Last Closed: 2018-09-04 07:10:49 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:2578 0 None None None 2018-09-04 07:11:05 UTC

Description ge liu 2018-07-31 05:48:52 UTC
Describe the issue: 

This issue is come from the PR discussion: https://github.com/openshift/openshift-docs/pull/11121#discussion_r206233884 

 as we know, in current ocp env, we run command 'etcdctl' is etcdctl2, and 'ETCDCTL_API=3 etcdctl' is etcdctl3, so why the doc still using: etcdctl2 & etcdctl3? actually, ectdctl2 & etcdctl3 is invalid command in ocp env just like this:

sh-4.2# etcdctl2
sh: etcdctl2: command not found
sh-4.2#
sh-4.2# etcdctl3
sh: etcdctl3: command not found
sh-4.2#
sh-4.2#
sh-4.2#
sh-4.2# etcdctl --cert-file=/etc/etcd/peer.crt --key-file=/etc/etcd/peer.key --ca-file=/etc/etcd/ca.crt --peers=https://qe-geliu3xxx-etcd-1:2379 member list
72faa1d29ffc61d4: name=qe-geliu3master-etcd-1 peerURLs=https://10.xxx.0.xx:2380 clientURLs=https://10.xxx.0.xx:2379 isLeader=true
sh-4.2#
sh-4.2#
sh-4.2# ETCDCTL_API=3 etcdctl --cert=/etc/etcd/peer.crt --key=/etc/etcd/peer.key --cacert=/etc/etcd/ca.crt --endpoints=https://qe-geliu3xxx-etcd-1:2379 endpoint health
https://qe-geliu3xxx-etcd-1:2379 is healthy: successfully committed proposal: took = 1.153385ms



Suggestions for improvement: 

etcdctl2&etcdctl3 is deprecated commands, it will result error execution in ocp env, so could it possible replace it with right way: 

etcdctl2 : etcdctl
etcdctl3 : ETCDCTL_API=3 etcdctl

Additional information: 

I still could find these commands in current doc also, such as:

# etcdctl2 member list
.......
# etcdctl3 member list               
....
in:
https://docs.openshift.org/latest/day_two_guide/environment_backup.html#backing-up-etcd_environment-backup

Comment 1 Kathryn Alexander 2018-07-31 14:33:16 UTC
Scott says that "etcdctl2 and etcdctl3 are bash functions that should be deployed to /etc/profile.d/etcdctl.sh" (https://github.com/openshift/openshift-docs/pull/11121#discussion_r206508513)

@Ge Liu, are 'etcdctl' for etcdctl2 and 'ETCDCTL_API=3 etcdctl' for etcdctl3 standard, or do we need to add a note saying something like:

"In the following etcdctl commands, `etcdctl2` is the alias for the v2 API and `etcdctl3` is the alias for the v2 API. Your alias might be different, such as `etcdctl` for the v2 API and 'ETCDCTL_API=3 etcdctl' for the v2 API."

@Scott, do you have an opinion?

Comment 2 Scott Dodson 2018-07-31 17:51:18 UTC
Here's the functions we define, these should be present on any master and etcd host.

# cat /etc/profile.d/etcdctl.sh 

#!/bin/bash
# Sets up handy aliases for etcd, need etcdctl2 and etcdctl3 because
# command flags are different between the two. Should work on stand
# alone etcd hosts and master + etcd hosts too because we use the peer keys.
etcdctl2() {
 /usr/bin/etcdctl --cert-file /etc/etcd/peer.crt --key-file /etc/etcd/peer.key --ca-file /etc/etcd/ca.crt -C https://`hostname`:2379 ${@}

}

etcdctl3() {
 ETCDCTL_API=3 /usr/bin/etcdctl --cert /etc/etcd/peer.crt --key /etc/etcd/peer.key --cacert /etc/etcd/ca.crt --endpoints https://`hostname`:2379 ${@}
}

Comment 3 Kathryn Alexander 2018-07-31 20:25:55 UTC
Interesting. When are those functions applied to the host?

Comment 8 ge liu 2018-08-03 01:51:10 UTC
@kalexand, the clarification is necessary without scott's PR merged, if etcdctl2 & etcdctl3 are works well after the PR merged, I think the clarification is not necessary, thanks.

Comment 11 Kathryn Alexander 2018-08-16 20:04:16 UTC
There's an engineering PR to fix the root cause of this issue: https://github.com/openshift/openshift-ansible/pull/9385

I'm closing this issue as NOTABUG per Ge Liu's comment.

Comment 12 ge liu 2018-08-24 04:47:54 UTC
@kalexand, sorry for this bug could not be closed currently, because it should be used to trace this PR: https://github.com/openshift/openshift-ansible/pull/9385 
and the PR also reference to this bug, I changed the owner to @sdodson, pls help to change it to exact component but not current 'Documentation', thanks in advance.

Comment 13 Scott Dodson 2018-08-28 17:47:19 UTC
https://github.com/openshift/openshift-ansible/pull/9757 3.10 backport

Comment 15 Gaoyun Pei 2018-08-30 06:50:15 UTC
Verify this bug with openshift-ansible-3.10.41-1.git.0.fd15dd7.el7.noarch.rpm.

1. etcd running as static pod co-located with masters, etcdctl2 & etcdctl3 alias configured on etcd hosts

[root@qe-jialiu310z-master-etcd-3 ~]# etcdctl2 cluster-health
member 1c648b504ba4936 is healthy: got healthy result from https://10.240.0.69:2379
member 855c261e91cd1b0b is healthy: got healthy result from https://10.240.0.70:2379
member 8fa4e5f628ec1629 is healthy: got healthy result from https://10.240.0.68:2379
cluster is healthy
[root@qe-jialiu310z-master-etcd-3 ~]# etcdctl3 member list
1c648b504ba4936, started, qe-jialiu310z-master-etcd-2, https://10.240.0.69:2380, https://10.240.0.69:2379
855c261e91cd1b0b, started, qe-jialiu310z-master-etcd-3, https://10.240.0.70:2380, https://10.240.0.70:2379
8fa4e5f628ec1629, started, qe-jialiu310z-master-etcd-1, https://10.240.0.68:2380, https://10.240.0.68:2379


2. rpm etcd service running on standalone host, etcdctl2 & etcdctl3 alias configured on etcd host
[root@ip-172-18-5-224 ~]# etcdctl2 cluster-health
member 357f1b12fd37f32c is healthy: got healthy result from https://172.18.5.224:2379
cluster is healthy
[root@ip-172-18-5-224 ~]# etcdctl3 member list
357f1b12fd37f32c, started, ip-172-18-5-224.ec2.internal, https://172.18.5.224:2380, https://172.18.5.224:2379

Comment 17 errata-xmlrpc 2018-09-04 07:10:49 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:2578


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