-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelete-driver.sh
executable file
·27 lines (21 loc) · 975 Bytes
/
delete-driver.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
#!/bin/bash
# This script will remove the Google Compute Engine Persistent Disk CSI Driver
# from the currently available Kubernetes cluster
#
# Args:
# GCE_PD_DRIVER_VERSION: The kustomize overlay to deploy (located under
# deploy/kubernetes/overlays).
set -o nounset
set -o errexit
readonly NAMESPACE="${GCE_PD_DRIVER_NAMESPACE:-gce-pd-csi-driver}"
readonly DEPLOY_VERSION="${GCE_PD_DRIVER_VERSION:-stable-master}"
readonly PKGDIR="${GOPATH}/src/sigs.k8s.io/gcp-compute-persistent-disk-csi-driver"
source "${PKGDIR}/deploy/common.sh"
ensure_kustomize
${KUSTOMIZE_PATH} build "${PKGDIR}/deploy/kubernetes/overlays/${DEPLOY_VERSION}" | ${KUBECTL} delete -v="${VERBOSITY}" --ignore-not-found -f -
${KUBECTL} delete secret cloud-sa -v="${VERBOSITY}" --ignore-not-found
if [[ "${NAMESPACE}" != "" && "${NAMESPACE}" != "default" ]] && \
${KUBECTL} get namespace "${NAMESPACE}" -v="${VERBOSITY}";
then
${KUBECTL} delete namespace "${NAMESPACE}" -v="${VERBOSITY}"
fi