local-up-cluster changes: added help option, added error message for why docker ps fails and how to recover, added test to check if etcd is in your path to fail fast when not found.

from etcd.sh split the start process into validate fucntion + start function so that the validate piece can be reused elsewhere. the up-cluster script has been changed to remove duplicate docker logic to the one used in buid-tools/common.sh and the validate etcd function is now used here.

moved docker daemon check function to util.sh and made function name changes and upstream changes.
This commit is contained in:
Alejandro Escobar
2016-12-13 12:29:47 -05:00
parent 08342c1f3e
commit 7d9c06f82d
5 changed files with 48 additions and 36 deletions

View File

@@ -20,18 +20,21 @@ ETCD_VERSION=${ETCD_VERSION:-3.0.14}
ETCD_HOST=${ETCD_HOST:-127.0.0.1}
ETCD_PORT=${ETCD_PORT:-2379}
kube::etcd::start() {
kube::etcd::validate() {
# validate if in path
which etcd >/dev/null || {
kube::log::usage "etcd must be in your PATH"
exit 1
}
# validate it is not running
if pgrep etcd >/dev/null 2>&1; then
kube::log::usage "etcd appears to already be running on this machine (`pgrep -l etcd`) (or its a zombie and you need to kill its parent)."
kube::log::usage "retry after you resolve this etcd error."
exit 1
fi
# validate installed version is at least equal to minimum
version=$(etcd --version | tail -n +1 | head -n 1 | cut -d " " -f 3)
if [[ "${version}" < "${ETCD_VERSION}" ]]; then
export PATH=$KUBE_ROOT/third_party/etcd:$PATH
@@ -45,6 +48,11 @@ kube::etcd::start() {
exit 1
fi
fi
}
kube::etcd::start() {
# validate before running
kube::etcd::validate
# Start etcd
ETCD_DIR=${ETCD_DIR:-$(mktemp -d 2>/dev/null || mktemp -d -t test-etcd.XXXXXX)}