16
16
17
17
# A set of helpers for starting/running etcd for tests
18
18
19
+ set -o errexit
20
+ set -o nounset
21
+ set -o pipefail
22
+
19
23
ETCD_VERSION=${ETCD_VERSION:- 3.3.10}
20
24
ETCD_HOST=${ETCD_HOST:- 127.0.0.1}
21
25
ETCD_PORT=${ETCD_PORT:- 2379}
@@ -41,18 +45,18 @@ kube::etcd::validate() {
41
45
fi
42
46
if ${port_check_command} -nat | grep " LISTEN" | grep " [\.:]${ETCD_PORT:? } " > /dev/null 2>&1 ; then
43
47
kube::log::usage " unable to start etcd as port ${ETCD_PORT} is in use. please stop the process listening on this port and retry."
44
- kube::log::usage " ` netstat -nat | grep " [\.:]${ETCD_PORT:? } .*LISTEN" ` "
48
+ kube::log::usage " $( netstat -nat | grep " [\.:]${ETCD_PORT:? } .*LISTEN" ) "
45
49
exit 1
46
50
fi
47
51
48
52
# validate installed version is at least equal to minimum
49
53
version=$( etcd --version | tail -n +1 | head -n 1 | cut -d " " -f 3)
50
- if [[ $( kube::etcd::version ${ETCD_VERSION} ) -gt $( kube::etcd::version ${version} ) ]]; then
54
+ if [[ $( kube::etcd::version " ${ETCD_VERSION} " ) -gt $( kube::etcd::version " ${version} " ) ]]; then
51
55
export PATH=${KUBE_ROOT} /third_party/etcd:${PATH}
52
56
hash etcd
53
57
echo " ${PATH} "
54
58
version=$( etcd --version | head -n 1 | cut -d " " -f 3)
55
- if [[ $( kube::etcd::version ${ETCD_VERSION} ) -gt $( kube::etcd::version ${version} ) ]]; then
59
+ if [[ $( kube::etcd::version " ${ETCD_VERSION} " ) -gt $( kube::etcd::version " ${version} " ) ]]; then
56
60
kube::log::usage " etcd version ${ETCD_VERSION} or greater required."
57
61
kube::log::info " You can use 'hack/install-etcd.sh' to install a copy in third_party/."
58
62
exit 1
@@ -76,7 +80,7 @@ kube::etcd::start() {
76
80
ETCD_LOGFILE=${ETCD_LOGFILE:- " /dev/null" }
77
81
fi
78
82
kube::log::info " etcd --advertise-client-urls ${KUBE_INTEGRATION_ETCD_URL} --data-dir ${ETCD_DIR} --listen-client-urls http://${ETCD_HOST} :${ETCD_PORT} --debug > \" ${ETCD_LOGFILE} \" 2>/dev/null"
79
- etcd --advertise-client-urls ${KUBE_INTEGRATION_ETCD_URL} --data-dir ${ETCD_DIR} --listen-client-urls ${KUBE_INTEGRATION_ETCD_URL} --debug 2> " ${ETCD_LOGFILE} " > /dev/null &
83
+ etcd --advertise-client-urls " ${KUBE_INTEGRATION_ETCD_URL} " --data-dir " ${ETCD_DIR} " --listen-client-urls " ${KUBE_INTEGRATION_ETCD_URL} " --debug 2> " ${ETCD_LOGFILE} " > /dev/null &
80
84
ETCD_PID=$!
81
85
82
86
echo " Waiting for etcd to come up."
0 commit comments