feat(reset): add reset script for cluster management and validation checks
Signed-off-by: 孙振宇 <>
This commit is contained in:
parent
7ae54597b6
commit
59c0e83d07
@ -11,7 +11,7 @@ bin_dir: /usr/local/bin
|
|||||||
|
|
||||||
|
|
||||||
## External LB example config
|
## External LB example config
|
||||||
apiserver_loadbalancer_domain_name: "lb.mathmast.com"
|
# apiserver_loadbalancer_domain_name: "lb.mathmast.com"
|
||||||
loadbalancer_apiserver:
|
loadbalancer_apiserver:
|
||||||
address: 4.155.160.32
|
address: 4.155.160.32
|
||||||
port: 6443
|
port: 6443
|
||||||
|
|||||||
30
cluster/ansible/reset.sh
Normal file
30
cluster/ansible/reset.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eu -o pipefail
|
||||||
|
|
||||||
|
# Check if `init.sh` has not run
|
||||||
|
if [ ! -d venv ]; then
|
||||||
|
echo "Please run init.sh first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if kubespray has not been cloned and its empty
|
||||||
|
if [ ! -d ../../3rd/kubespray ]; then
|
||||||
|
echo "Please run 'git submoudle --init --recursive' first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if `inventory.ini` has not been created
|
||||||
|
if [ ! -f ../../cluster/ansible/manifests/inventory.ini ]; then
|
||||||
|
echo "Please create your own inventory.ini first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Prompt user to input y to continue
|
||||||
|
read -p "WARNING: ARE YOU SURE TO RESET THE CLUSTER? THAT WILL DELETE ENTIRE CLUSTER [y/N]: " confirm
|
||||||
|
if [ "$confirm" != "y" ]; then
|
||||||
|
echo "Reset cluster has been canceled."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd ../../3rd/kubespray && ansible-playbook -i ../../cluster/ansible/manifests/inventory.ini ./reset.yml -kK -b
|
||||||
Loading…
Reference in New Issue
Block a user