| 1234567891011121314151617181920212223242526272829303132 | #!/bin/bash#kubectl --namespace rook-ceph delete cephcluster rook-ceph --wait#helm --namespace rook-ceph uninstall rook-cephCLUSTER=$1OPERATOR=$1-oNAMESPACE=$1echo "Patching cluster $CLUSTER to allow deletes"echo kubectl --namespace ${NAMESPACE} patch cephcluster ${NAMESPACE} --type merge -p '{"spec":{"cleanupPolicy":{"confirmation":"yes-really-destroy-data"}}}'kubectl --namespace ${NAMESPACE} patch cephcluster ${NAMESPACE} --type merge -p '{"spec":{"cleanupPolicy":{"confirmation":"yes-really-destroy-data"}}}'kubectl delete storageclasses ceph-block ceph-bucket ceph-filesystem --waitkubectl --namespace ${NAMESPACE} delete cephobjectstore ceph-objectstore --forcekubectl --namespace ${NAMESPACE} delete cephfilesystem ceph-filesystem --forcekubectl --namespace ${NAMESPACE} delete cephblockpools ceph-blockpool --forcekubectl --namespace ${NAMESPACE} delete cephcluster ${CLUSTER} --waithelm --namespace ${NAMESPACE} uninstall ${CLUSTER}kubectl delete ns ${NAMESPACE} --waitfor i in $(kubectl get crd | grep ceph | awk '{print $1}'); do kubectl delete crd $i ; donefor i in $(kubectl get crd | grep objectbucket | awk '{print $1}'); do kubectl delete crd $i ; donefor i in $(kubectl get clusterrole | grep ceph | awk '{print $1}'); do kubectl delete clusterrole $i ; donefor i in $(kubectl get clusterrole | grep rbd | awk '{print $1}'); do kubectl delete clusterrole $i ; donefor i in $(kubectl get clusterrole | grep objectstorage- | awk '{print $1}'); do kubectl delete clusterrole $i ; donefor i in $(kubectl get clusterrolebinding | grep -E '(ceph|rook|rbd-csi|objectstorage-prov)' | awk '{print $1}' ) ; do kubectl delete clusterrolebinding $i ; done
 |