Fixed force deleting core resources

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
Marcus Noble 2022-10-25 09:51:33 +01:00
parent 1127b5fc64
commit a6d474a93f
Signed by: AverageMarcus
GPG Key ID: B8F2DB8A7AEBAF78
1 changed files with 4 additions and 3 deletions

View File

@ -53,9 +53,10 @@ if [ ${#POS_ARGS[@]} -lt 2 ] && [[ "${SELECTOR}" == "" ]]; then
fi
function deleteResource() {
echo "Deleting ${1}"
kubectl patch -p '{"metadata":{"finalizers":null}}' --type=merge -n ${NAMESPACE} ${1} 1>/dev/null|| printf ""
kubectl delete -n ${NAMESPACE} ${1} 2>/dev/null || printf ""
RES="${1//.v1/}"
echo "Deleting ${RES}"
kubectl patch -p '{"metadata":{"finalizers":null}}' --type=merge -n ${NAMESPACE} ${RES} 1>/dev/null|| printf ""
kubectl delete -n ${NAMESPACE} ${RES} 2>/dev/null || printf ""
}
printf "⚠️ This could leave cloud resources undeleted if finalizers aren't honoured ⚠️\n\n"