diff --git a/scripts/runtime/teardown.sh b/scripts/runtime/teardown.sh index 38ee1f7..36b2b49 100755 --- a/scripts/runtime/teardown.sh +++ b/scripts/runtime/teardown.sh @@ -50,7 +50,12 @@ kubectl -n stackrox delete --grace-period=0 --force deploy/central deploy/sensor kubectl -n stackrox get application -o name | xargs kubectl -n stackrox delete --wait # DO NOT ADD ANY NON-NAMESPACED RESOURCES TO THIS LIST, OTHERWISE ALL RESOURCES IN THE CLUSTER OF THAT TYPE # WILL BE DELETED! -kubectl -n stackrox get cm,deploy,ds,hpa,networkpolicy,role,rolebinding,secret,svc,serviceaccount,pvc -o name | xargs kubectl -n stackrox delete --wait +{ + kubectl -n stackrox get cm,deploy,ds,hpa,networkpolicy,role,rolebinding,secret,svc,serviceaccount,pvc -o name + # Delete operator CRs. This is broken out into a separate invocation, as the entire command fails + # if the CRDs are not available + kubectl -n stackrox get central.platform.stackrox.io,securedcluster.platform.stackrox.io -o name 2>/dev/null || true +} | xargs kubectl -n stackrox delete --wait # Only delete cluster-wide RBAC/PSP-related resources that contain have the app.kubernetes.io/name=stackrox label. kubectl -n stackrox get clusterrole,clusterrolebinding,psp,validatingwebhookconfiguration -o name -l app.kubernetes.io/name=stackrox | xargs kubectl -n stackrox delete --wait