refactor undeploy script

Signed-off-by: Kevin Wang <kevinwzf0126@gmail.com>
This commit is contained in:
Kevin Wang 2020-12-22 21:33:15 +08:00 committed by Hongcai Ren
parent b2dbcca719
commit 304c2a2623
1 changed files with 5 additions and 16 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
set +e
set -o errexit
set -o nounset
set -o pipefail
@ -12,19 +12,8 @@ function usage() {
SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
# delete controller-manager
kubectl delete -f "${SCRIPT_ROOT}/artifacts/deploy/controller-manager.yaml"
KUBECONFIG_PATH=${KUBECONFIG_PATH:-"${HOME}/.kube"}
HOST_CLUSTER_KUBECONFIG="${KUBECONFIG_PATH}/karmada.config"
# delete APIs
kubectl delete -f "${SCRIPT_ROOT}/artifacts/deploy/membercluster.karmada.io_memberclusters.yaml"
kubectl delete -f "${SCRIPT_ROOT}/artifacts/deploy/propagationstrategy.karmada.io_propagationpolicies.yaml"
kubectl delete -f "${SCRIPT_ROOT}/artifacts/deploy/propagationstrategy.karmada.io_propagationbindings.yaml"
kubectl delete -f "${SCRIPT_ROOT}/artifacts/deploy/propagationstrategy.karmada.io_propagationworks.yaml"
# delete service account, cluster role
kubectl delete -f "${SCRIPT_ROOT}/artifacts/deploy/serviceaccount.yaml"
kubectl delete -f "${SCRIPT_ROOT}/artifacts/deploy/clusterrole.yaml"
kubectl delete -f "${SCRIPT_ROOT}/artifacts/deploy/clusterrolebinding.yaml"
# delete namespace for control plane components
kubectl delete -f "${SCRIPT_ROOT}/artifacts/deploy/namespace.yaml"
export KUBECONFIG=${HOST_CLUSTER_KUBECONFIG}
kubectl delete ns karmada-system