Commit 442a22d1 authored by He Simei's avatar He Simei

tear down resources before tear down the cluster

parent 8cc75a47
...@@ -117,6 +117,15 @@ function clear-kubeconfig() { ...@@ -117,6 +117,15 @@ function clear-kubeconfig() {
echo "Cleared config for ${CONTEXT} from ${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. # Gets username, password for the current-context in kubeconfig, if they exist.
# Assumed vars: # Assumed vars:
# KUBECONFIG # if unset, defaults to global # KUBECONFIG # if unset, defaults to global
...@@ -278,3 +287,4 @@ function tars_from_version() { ...@@ -278,3 +287,4 @@ function tars_from_version() {
exit 1 exit 1
fi fi
} }
...@@ -409,6 +409,9 @@ function provision-masterandminion() { ...@@ -409,6 +409,9 @@ function provision-masterandminion() {
function kube-down { function kube-down {
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE-"config-default.sh"}" source "${KUBE_ROOT}/cluster/ubuntu/${KUBE_CONFIG_FILE-"config-default.sh"}"
source "${KUBE_ROOT}/cluster/common.sh"
tear_down_alive_resources
ii=0 ii=0
for i in ${nodes}; do for i in ${nodes}; do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment