e2e: do not fail deleting resources when "resource not found"

Sometimes the tests fail cleaning up due unavailable resources that are
listed in the .yaml files. Deleting the missing resources returns
"resource not found". By passing --ignore-not-found to kubectl, this
problem should not happen anymore (and possibly makes it more obvious
where tests do go wrong).
This commit is contained in:
Niels de Vos 2019-08-13 09:51:03 +02:00 committed by mergify[bot]
parent 17eb9fb47b
commit b812ec26df

View File

@ -56,22 +56,22 @@ func removeCephCSIResource() {
// cleanup rbd cluster roles deployed by rook
rbdPath := fmt.Sprintf("%s/%s/", rbdDirPath, "v1.13")
_, err = framework.RunKubectl("delete", "-f", rbdPath+rbdProvisionerRBAC)
_, err = framework.RunKubectl("delete", "--ignore-not-found", "-f", rbdPath+rbdProvisionerRBAC)
if err != nil {
e2elog.Logf("failed to delete provisioner rbac %v", err)
}
_, err = framework.RunKubectl("delete", "-f", rbdPath+rbdNodePluginRBAC)
_, err = framework.RunKubectl("delete", "--ignore-not-found", "-f", rbdPath+rbdNodePluginRBAC)
if err != nil {
e2elog.Logf("failed to delete nodeplugin rbac %v", err)
}
// cleanup cephfs cluster roles deployed by rook
cephfsPath := fmt.Sprintf("%s/%s/", cephfsDirPath, "v1.13")
_, err = framework.RunKubectl("delete", "-f", cephfsPath+cephfsProvisionerRBAC)
_, err = framework.RunKubectl("delete", "--ignore-not-found", "-f", cephfsPath+cephfsProvisionerRBAC)
if err != nil {
e2elog.Logf("failed to delete provisioner rbac %v", err)
}
_, err = framework.RunKubectl("delete", "-f", cephfsPath+cephfsNodePluginRBAC)
_, err = framework.RunKubectl("delete", "--ignore-not-found", "-f", cephfsPath+cephfsNodePluginRBAC)
if err != nil {
e2elog.Logf("failed to delete nodeplugin rbac %v", err)
}