Skip to content

Commit

Permalink
Revert "Remove voyager crds before uninstalling operator (#1010)"
Browse files Browse the repository at this point in the history
This reverts commit 7f9e749.
  • Loading branch information
tamalsaha committed May 3, 2018
1 parent 1722a23 commit 4f82002
Showing 1 changed file with 25 additions and 28 deletions.
53 changes: 25 additions & 28 deletions hack/deploy/voyager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,31 @@ while test $# -gt 0; do
done

if [ "$VOYAGER_UNINSTALL" -eq 1 ]; then
# delete webhooks and apiservices
kubectl delete validatingwebhookconfiguration -l app=voyager || true
kubectl delete mutatingwebhookconfiguration -l app=voyager || true
kubectl delete apiservice -l app=voyager
# delete voyager operator
kubectl delete deployment -l app=voyager --namespace $VOYAGER_NAMESPACE
kubectl delete service -l app=voyager --namespace $VOYAGER_NAMESPACE
kubectl delete secret -l app=voyager --namespace $VOYAGER_NAMESPACE
# delete RBAC objects, if --rbac flag was used.
kubectl delete serviceaccount -l app=voyager --namespace $VOYAGER_NAMESPACE
kubectl delete clusterrolebindings -l app=voyager
kubectl delete clusterrole -l app=voyager
kubectl delete rolebindings -l app=voyager --namespace $VOYAGER_NAMESPACE
kubectl delete role -l app=voyager --namespace $VOYAGER_NAMESPACE

echo "waiting for voyager operator pod to stop running"
for (( ; ; )); do
pods=($(kubectl get pods --all-namespaces -l app=voyager -o jsonpath='{range .items[*]}{.metadata.name} {end}'))
total=${#pods[*]}
if [ $total -eq 0 ] ; then
break
fi
sleep 2
done

# https://github.com/kubernetes/kubernetes/issues/60538
if [ "$VOYAGER_PURGE" -eq 1 ]; then
for crd in "${crds[@]}"; do
Expand All @@ -256,36 +281,8 @@ if [ "$VOYAGER_UNINSTALL" -eq 1 ]; then
# delete crd
kubectl delete crd ${crd}.voyager.appscode.com || true
done

echo "waiting 5 seconds ..."
sleep 5;
fi

# delete webhooks and apiservices
kubectl delete validatingwebhookconfiguration -l app=voyager || true
kubectl delete mutatingwebhookconfiguration -l app=voyager || true
kubectl delete apiservice -l app=voyager
# delete voyager operator
kubectl delete deployment -l app=voyager --namespace $VOYAGER_NAMESPACE
kubectl delete service -l app=voyager --namespace $VOYAGER_NAMESPACE
kubectl delete secret -l app=voyager --namespace $VOYAGER_NAMESPACE
# delete RBAC objects, if --rbac flag was used.
kubectl delete serviceaccount -l app=voyager --namespace $VOYAGER_NAMESPACE
kubectl delete clusterrolebindings -l app=voyager
kubectl delete clusterrole -l app=voyager
kubectl delete rolebindings -l app=voyager --namespace $VOYAGER_NAMESPACE
kubectl delete role -l app=voyager --namespace $VOYAGER_NAMESPACE

echo "waiting for voyager operator pod to stop running"
for (( ; ; )); do
pods=($(kubectl get pods --all-namespaces -l app=voyager -o jsonpath='{range .items[*]}{.metadata.name} {end}'))
total=${#pods[*]}
if [ $total -eq 0 ] ; then
break
fi
sleep 2
done

echo
echo "Successfully uninstalled Voyager!"
exit 0
Expand Down

0 comments on commit 4f82002

Please sign in to comment.