Production test don't cleanup flag (#44)
* Production test don't cleanup flag For use in the future with uprade tests, we add a flag -c to the production test to not cleanup after the testing. Signed-off-by: Kevin Fox <[email protected]> * Incorperate feedback Signed-off-by: Kevin Fox <[email protected]> --------- Signed-off-by: Kevin Fox <[email protected]>
This commit is contained in:
@@ -19,6 +19,7 @@ helm_install=(helm upgrade --install --create-namespace)
|
|||||||
ns=spire-server
|
ns=spire-server
|
||||||
|
|
||||||
UPGRADE_ARGS=""
|
UPGRADE_ARGS=""
|
||||||
|
CLEANUP=1
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
case $i in
|
case $i in
|
||||||
@@ -26,17 +27,23 @@ for i in "$@"; do
|
|||||||
UPGRADE_ARGS="--repo $UPGRADE_REPO --version $UPGRADE_VERSION"
|
UPGRADE_ARGS="--repo $UPGRADE_REPO --version $UPGRADE_VERSION"
|
||||||
shift # past argument=value
|
shift # past argument=value
|
||||||
;;
|
;;
|
||||||
|
-c)
|
||||||
|
CLEANUP=0
|
||||||
|
shift # past argument=value
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
teardown() {
|
teardown() {
|
||||||
helm uninstall --namespace "${ns}" spire 2>/dev/null || true
|
if [ "${CLEANUP}" -eq 1 ]; then
|
||||||
kubectl delete ns "${ns}" 2>/dev/null || true
|
helm uninstall --namespace "${ns}" spire 2>/dev/null || true
|
||||||
kubectl delete ns spire-system 2>/dev/null || true
|
kubectl delete ns "${ns}" 2>/dev/null || true
|
||||||
helm uninstall --namespace cert-manager cert-manager 2>/dev/null || true
|
kubectl delete ns spire-system 2>/dev/null || true
|
||||||
kubectl delete ns cert-manager 2>/dev/null || true
|
helm uninstall --namespace cert-manager cert-manager 2>/dev/null || true
|
||||||
helm uninstall --namespace ingress-nginx 2>/dev/null || true
|
kubectl delete ns cert-manager 2>/dev/null || true
|
||||||
kubectl delete ns ingress-nginx 2>/dev/null || true
|
helm uninstall --namespace ingress-nginx 2>/dev/null || true
|
||||||
|
kubectl delete ns ingress-nginx 2>/dev/null || true
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT
|
trap 'trap - SIGTERM && teardown' SIGINT SIGTERM EXIT
|
||||||
|
|||||||
Reference in New Issue
Block a user