-
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.
- added a destroy-script for the resources installed"
- added labels to the resources
- Loading branch information
1 parent
9734686
commit 8ed7de5
Showing
11 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1 +1,17 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
.idea | ||
/bin | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ |
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 | ||
|
||
|