Bug 1397756

Summary: [etcd3]Run etcdctl3 command failed due to etcd_hostname is different from hostname
Product: OpenShift Container Platform Reporter: Gaoyun Pei <gpei>
Component: InstallerAssignee: Scott Dodson <sdodson>
Status: CLOSED WONTFIX QA Contact: Johnny Liu <jialiu>
Severity: low Docs Contact:
Priority: medium    
Version: 3.4.0CC: anli, aos-bugs, jokerman, mmccomas, xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-24 20:48:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Gaoyun Pei 2016-11-23 10:14:52 UTC
Description of problem:
When etcd_hostname used in etcd configuration is not the same as the hostname of etcd host, etcdctl3 command will fail for x509 cert error.

Version-Release number of selected component (if applicable):
openshift-ansible-3.4.26-1.git.0.882474b.el7.noarch.rpm

How reproducible:
Always

Steps to Reproduce:
1.The hostname of etcd host:
[root@jialiu1-share-master-etcd-zone2-1 ~]# hostname
jialiu1-share-master-etcd-zone2-1.c.openshift-gce-devel.internal

The ETCD_NAME used in etcd.conf
[root@jialiu1-share-master-etcd-zone2-1 ~]# grep ETCD_NAME /etc/etcd/etcd.conf
ETCD_NAME=jialiu1-share-master-etcd-zone2-1

The Subject CN in /etc/etcd/peer.crt
[root@jialiu1-share-master-etcd-zone2-1 ~]# openssl x509 -in /etc/etcd/peer.crt -text |grep Subject:
        Subject: CN=jialiu1-share-master-etcd-zone2-1


2.Run etcdctl3 command
[root@jialiu1-share-master-etcd-zone2-1 ~]# etcdctl3 member list
2016/11/23 04:51:15 Failed to dial jialiu1-share-master-etcd-zone2-1.c.openshift-gce-devel.internal:2379: connection error: desc = "transport: x509: certificate is valid for jialiu1-share-master-etcd-zone2-1, not jialiu1-share-master-etcd-zone2-1.c.openshift-gce-devel.internal"; please retry.
Error:  grpc: timed out when dialing


Actual results:


Expected results:
etcdctl3 command should work well.
Maybe we could consider using a more reliable way to detect the etcd_hostname, such as getting it from etcd.conf, instead of just using `hostname`

Additional info: