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

View File

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