Skip to content

Commit

Permalink
Merge pull request kubernetes#6444 from you-n-g/master
Browse files Browse the repository at this point in the history
etcd should be started after the trap func set
  • Loading branch information
nikhiljindal committed Apr 6, 2015
2 parents ebb9828 + 802610b commit 7270010
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 9 additions & 1 deletion hack/lib/etcd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,16 @@ kube::etcd::start() {
curl -X PUT "http://${host}:${port}/v2/keys/_test"
}

kube::etcd::cleanup() {
kube::etcd::stop() {
kill "${ETCD_PID-}" >/dev/null 2>&1 || :
wait "${ETCD_PID-}" >/dev/null 2>&1 || :
}

kube::etcd::clean_etcd_dir() {
rm -rf "${ETCD_DIR-}"
}

kube::etcd::cleanup() {
kube::etcd::stop
kube::etcd::clean_etcd_dir
}
10 changes: 5 additions & 5 deletions hack/local-up-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ if [ "$?" != "0" ]; then
exit 1
fi

echo "Starting etcd"
kube::etcd::start

# Shut down anyway if there's an error.
set +e

Expand Down Expand Up @@ -106,14 +103,17 @@ cleanup()
[[ -n "${PROXY_PID-}" ]] && sudo kill "${PROXY_PID}"
[[ -n "${SCHEDULER_PID-}" ]] && sudo kill "${SCHEDULER_PID}"

[[ -n "${ETCD_PID-}" ]] && kill "${ETCD_PID}"
[[ -n "${ETCD_DIR-}" ]] && rm -rf "${ETCD_DIR}"
[[ -n "${ETCD_PID-}" ]] && kube::etcd::stop
[[ -n "${ETCD_DIR-}" ]] && kube::etcd::clean_etcd_dir

exit 0
}

trap cleanup EXIT

echo "Starting etcd"
kube::etcd::start

APISERVER_LOG=/tmp/kube-apiserver.log
sudo -E "${GO_OUT}/kube-apiserver" \
--v=${LOG_LEVEL} \
Expand Down

0 comments on commit 7270010

Please sign in to comment.