#!/bin/bash

OBJECTS=$(kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n $1 | sort | awk '{print $1}'  | grep \/ )

for i in ${OBJECTS} ; do
  kubectl -n $1 delete $i &
done

echo ""
sleep 15
echo ""
OBJECTS=$(kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n $1 | sort | awk '{print $1}'  | grep \/ )

for i in ${OBJECTS} ; do
  kubectl -n $1 delete $i --force &
done

echo ""
sleep 15
echo ""
OBJECTS=$(kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get --show-kind --ignore-not-found -n $1 | sort | awk '{print $1}'  | grep \/ )

for i in ${OBJECTS} ; do
  kubectl -n $1 edit $i ;
done
