Skip to content

Instantly share code, notes, and snippets.

@rohantmp
Last active January 13, 2022 17:21
Show Gist options
  • Save rohantmp/5639c0af8cfab4904c54ea9a07cfd9a1 to your computer and use it in GitHub Desktop.
Save rohantmp/5639c0af8cfab4904c54ea9a07cfd9a1 to your computer and use it in GitHub Desktop.
Instructions to forcibly cleanup OCS
#!/bin/bash
set -x
#Delete any apps consuming PVCs based on OCS storageclasses, and then delete the PVs
#Delete the StorageCluster object without deleting its dependents.
oc delete -n openshift-storage storagecluster --all --wait=true --cascade=false
#Delete the Noobaa resource.
oc delete -n openshift-storage noobaa noobaa --wait=true
#Wait for the Noobaa PVC to be automatically deleted.
oc wait -n openshift-storage --for delete pvc -l noobaa-core=noobaa --timeout=5m
#Delete the CephCluster resource and wait for it to finish deleting.
oc delete -n openshift-storage cephcluster --all --wait=true --timeout=5m
#Delete the Namespaces and wait for them to finish deleting.
oc delete project openshift-storage --wait=true --timeout=5m
# remove the taint from storage nodes
oc adm taint nodes --all node.ocs.openshift.io/storage-
# unlabel the nodes the storage nodes
oc label node --all cluster.ocs.openshift.io/openshift-storage-
@rohantmp
Copy link
Author

Use this to check that everything is gone:

# wait for the namespace to terminate
while oc get ns|grep "openshift-storage"
do
    sleep 1
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment