This repository has been archived by the owner on Sep 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdelete-yatai.sh
executable file
·39 lines (34 loc) · 1.93 KB
/
delete-yatai.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
#!/bin/bash
CURRETN_CONTEXT=$(kubectl config current-context)
echo -e "\033[01;31mWarning: this will permanently delete all Yatai resources, existing model deployments, and in-cluster minio, postgresql DB data. Note that external DB and blob storage will not be deleted.\033[00m"
echo -e "\033[01;31mWarning: this also means that all resources under the \033[00m\033[01;32myatai\033[00m, \033[00m\033[01;32myatai-system\033[00m, \033[00m\033[01;32myatai-operators\033[00m, and \033[00m\033[01;32myatai-components\033[00m \033[01;31mnamespaces will be permanently deleted.\033[00m"
echo -e "\033[01;31mCurrent kubernetes context: \033[00m\033[01;32m$CURRETN_CONTEXT\033[00m"
read -p "Are you sure to delete Yatai in cluster '$CURRETN_CONTEXT'? [y/n] " -n 1 -r
echo # move to a new line
read -p "(Double check) Are you sure to delete Yatai in cluster '$CURRETN_CONTEXT'? [y/n] " -n 1 -r
echo # move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 # handle exits from shell or function but don't exit interactive shell
fi
echo "Uninstalling yatai helm chart from cluster.."
set -x
helm list -n yatai-system | tail -n +2 | awk '{print $1}' | xargs -I{} helm -n yatai-system uninstall {}
set +x
echo "Deleting all crd resources and BentoDeployment.."
set -x
kubectl delete crd bentodeployments.serving.yatai.ai
kubectl delete crd deployments.component.yatai.ai
set +x
echo "Removing additional yatai related namespaces and resources.."
set -x
helm list -n yatai-components | tail -n +2 | awk '{print $1}' | xargs -I{} helm -n yatai-components uninstall {}
kubectl delete namespace yatai-components
helm list -n yatai-operators | tail -n +2 | awk '{print $1}' | xargs -I{} helm -n yatai-operators uninstall {}
kubectl delete namespace yatai-operators
kubectl delete namespace yatai-builders
kubectl delete namespace yatai
kubectl delete ingressclass yatai-ingress
kubectl delete namespace yatai-system
set +x
echo "Done"