Browse Source

Merge pull request #9904 from vrutkovs/fix-etcdctl-static-pods

Fix etcdctl aliases on etcd hosts
OpenShift Merge Robot 6 years ago
parent
commit
b6930622ea
1 changed files with 7 additions and 6 deletions
  1. 7 6
      roles/etcd/templates/etcdctl.sh.j2

+ 7 - 6
roles/etcd/templates/etcdctl.sh.j2

@@ -3,19 +3,20 @@
 # 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() {
- cmd="/usr/bin/etcdctl --cert-file {{ etcd_peer_cert_file }} --key-file {{ etcd_peer_key_file }} --ca-file {{ etcd_peer_ca_file }} -C https://`hostname`:2379 ${@}"
+
+ cmd="ETCDCTL_API=2 etcdctl --cert-file {{ etcd_peer_cert_file }} --key-file {{ etcd_peer_key_file }} --ca-file {{ etcd_peer_ca_file }} -C https://`hostname`:2379 ${@}"
  if [[ -f /usr/local/bin/master-exec ]]; then
-   /usr/local/bin/master-exec etcd etcd /bin/bash -c "$cmd"
+   /usr/local/bin/master-exec etcd etcd /bin/sh -c "$cmd"
  else
-   /bin/bash -c "$cmd"
+   /bin/sh -c "$cmd"
  fi
 }
 
 etcdctl3() {
- cmd="ETCDCTL_API=3 /usr/bin/etcdctl --cert {{ etcd_peer_cert_file }} --key {{ etcd_peer_key_file }} --cacert {{ etcd_peer_ca_file }} --endpoints https://`hostname`:2379 ${@}"
+ cmd="ETCDCTL_API=3 etcdctl --cert {{ etcd_peer_cert_file }} --key {{ etcd_peer_key_file }} --cacert {{ etcd_peer_ca_file }} --endpoints https://`hostname`:2379 ${@}"
  if [[ -f /usr/local/bin/master-exec ]]; then
-   /usr/local/bin/master-exec etcd etcd /bin/bash -c "$cmd"
+   /usr/local/bin/master-exec etcd etcd /bin/sh -c "$cmd"
  else
-   /bin/bash -c "$cmd"
+   /bin/sh -c "$cmd"
  fi
 }