github.com/verrazzano/verrazzano@v1.7.1/ci/scripts/cleanup_kind_clusters.sh (about) 1 #!/bin/bash 2 # 3 # Copyright (c) 2022, Oracle and/or its affiliates. 4 # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 5 # 6 7 SCRIPT_DIR=$(cd $(dirname "$0"); pwd -P) 8 CLUSTER_NAME=$1 9 KUBECONFIG=$2 10 11 if [ -z "${KUBECONFIG}" ]; then 12 echo "KUBECONFIG must be set" 13 exit 1 14 fi 15 16 # Set CLEANUP_KIND_CONTAINERS to true, while second cluster and onwards 17 if [ "${CLEANUP_KIND_CONTAINERS}" == "true" ]; then 18 cd ${PLATFORM_OPERATOR_DIR}/build/scripts 19 ./cleanup.sh ${CLUSTER_NAME} 20 else 21 echo "Delete the cluster and kube config in multi-cluster environment" 22 kind delete cluster --name ${CLUSTER_NAME} 23 if [ -f "${KUBECONFIG}" ] 24 then 25 echo "Deleting the kubeconfig '${KUBECONFIG}' ..." 26 rm ${KUBECONFIG} 27 fi 28 fi 29 30 echo "Delete the cluster and kube config in multi-cluster environment" 31 kind delete cluster --name ${CLUSTER_NAME} 32 if [ -f "${KUBECONFIG}" ] 33 then 34 echo "Deleting the kubeconfig '${KUBECONFIG}' ..." 35 rm ${KUBECONFIG} 36 fi 37