Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cleanup of local cluster more robust. #4400

Merged
merged 1 commit into from
Feb 13, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 18 additions & 17 deletions hack/local-up-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ esac

GO_OUT="${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}"

cleanup()
{
echo "Cleaning up..."
[[ -n "${APISERVER_PID-}" ]] && sudo kill "${APISERVER_PID}"
[[ -n "${CTLRMGR_PID-}" ]] && sudo kill "${CTLRMGR_PID}"
[[ -n "${KUBELET_PID-}" ]] && sudo kill "${KUBELET_PID}"
[[ -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}"
exit 0
}

trap cleanup EXIT

APISERVER_LOG=/tmp/kube-apiserver.log
sudo "${GO_OUT}/kube-apiserver" \
--v=${LOG_LEVEL} \
Expand All @@ -99,7 +115,8 @@ sudo "${GO_OUT}/kube-apiserver" \
APISERVER_PID=$!

# Wait for kube-apiserver to come up before launching the rest of the components.
kube::util::wait_for_url "http://${API_HOST}:${API_PORT}/api/v1beta1/pods" "apiserver: "
echo "Waiting for apiserver to come up"
kube::util::wait_for_url "http://${API_HOST}:${API_PORT}/api/v1beta1/pods" "apiserver: " 1 10 || exit 1

CTLRMGR_LOG=/tmp/kube-controller-manager.log
sudo "${GO_OUT}/kube-controller-manager" \
Expand Down Expand Up @@ -147,20 +164,4 @@ To start using your cluster, open up another terminal/tab and run:
cluster/kubectl.sh
EOF

cleanup()
{
echo "Cleaning up..."
sudo kill "${APISERVER_PID}"
sudo kill "${CTLRMGR_PID}"
sudo kill "${KUBELET_PID}"
sudo kill "${PROXY_PID}"
sudo kill "${SCHEDULER_PID}"

kill "${ETCD_PID}"
rm -rf "${ETCD_DIR}"
exit 0
}

trap cleanup EXIT

while true; do sleep 1; done