tear down resources before tear down the cluster

This commit is contained in:
He Simei 2015-09-02 10:24:46 +08:00
parent 8cc75a4734
commit 442a22d114
2 changed files with 13 additions and 0 deletions

View File

@ -117,6 +117,15 @@ function clear-kubeconfig() {
echo "Cleared config for ${CONTEXT} from ${KUBECONFIG}"
}
function tear_down_alive_resources() {
local kubectl="${KUBE_ROOT}/cluster/kubectl.sh"
"${kubectl}" delete rc --all
"${kubectl}" delete pods --all
"${kubectl}" delete svc --all
"${kubectl}" delete pvc --all
}
# Gets username, password for the current-context in kubeconfig, if they exist.
# Assumed vars:
# KUBECONFIG # if unset, defaults to global
@ -278,3 +287,4 @@ function tars_from_version() {
exit 1
fi
}

View File

@ -409,6 +409,9 @@ function provision-masterandminion() {
function kube-down {
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE-"config-default.sh"}"
source "${KUBE_ROOT}/cluster/common.sh"
tear_down_alive_resources
ii=0
for i in ${nodes}; do