-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a script to remove all the resources deployed as the part of CSI …
…Driver - added a version specific destroy script parallel to deploy-script - cleanup gitignore - Useful to cleanup the resources which can interfere with the redeployments or on some automations based on the Driver deployment
- Loading branch information
1 parent
9734686
commit 0ab8133
Showing
14 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../util/destroy-hostpath.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script performs the step to destroy the hostpath plugin driver | ||
# completely by checking all the resources. | ||
# This should be in sync with the deploy script based on any future additions/deletions | ||
# of the resources | ||
|
||
# The script assumes that kubectl is available on the OS path | ||
# where it is executed. | ||
|
||
set -e | ||
set -o pipefail | ||
|
||
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
LABELS=(csi-snapshotter csi-hostpathplugin csi-attacher csi-resizer csi-hostpath-driver csi-provisioner csi-hostpath-socat) | ||
|
||
run () { | ||
echo "$@" >&2 | ||
"$@" | ||
|
||
for label in "${LABELS[@]}"; do | ||
kubectl delete all,role,clusterrole,rolebinding,clusterrolebinding,sa -l app=${label} || true | ||
done | ||
|
||
# delete hostpath plugin as a fall back | ||
echo "deleting hostpath components" | ||
for i in $(ls ${BASE_DIR}/hostpath/*.yaml | sort); do | ||
echo "deleting $i" | ||
kubectl delete -f "$i" || true | ||
done | ||
|
||
} | ||
|
||
run | ||
|
||
# Wait until all pods are not deleted. We have to make some assumptions | ||
# about the deployment here, otherwise we wouldn't know what to wait | ||
# for: the expectation is that we run attacher, provisioner, | ||
# snapshotter, resizer, socat and hostpath plugin in the default namespace. | ||
expected_running_pods=0 | ||
cnt=0 | ||
while [ $(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l) -gt ${expected_running_pods} ]; do | ||
if [ $cnt -gt 30 ]; then | ||
echo "$(kubectl get pods 2>/dev/null | grep '^csi-hostpath.* Running ' | wc -l) running pods:" | ||
kubectl describe pods | ||
|
||
echo >&2 "ERROR: hostpath deployment still ready after over 5min" | ||
exit 1 | ||
fi | ||
echo $(date +%H:%M:%S) "waiting for hostpath deployment to delete, attempt #$cnt" | ||
cnt=$(($cnt + 1)) | ||
sleep 10 | ||
done | ||
|
||
|