-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkube-down.sh
45 lines (32 loc) · 930 Bytes
/
kube-down.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
# Tear down a Kubernetes cluster.
set -o errexit
set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")
if [ $# -le 0 ];then
echo -e "Environment para should be set" >&2
exit 1
fi
envfile=$1
if [ -f "${KUBE_ROOT}/env/${envfile}.sh" ]; then
source "${KUBE_ROOT}/env/${envfile}.sh"
else
echo -e "Canot find Environment file ${KUBE_ROOT}/env/${envfile}.sh " >&2
exit 1
fi
source ${KUBE_ROOT}/utils/util.sh
echo
echo -en "${color_red}Warning: All data will be delete (集群所有数据都将被删除)!!! Are you sure? (Y/n)${color_norm}"
read
if [[ ${REPLY} != "Y" && ${REPLY} != "y" ]]; then
exit 0
fi
echo -e "${color_green}Bringing down cluster ${color_norm}"
echo -e "${color_green}... calling verify-prereqs${color_norm}" >&2
verify-prereqs
echo
echo -e "${color_green}... calling kube-down${color_norm}" >&2
kube-down
echo -e "${color_green}Done${color_norm}"
echo