diff --git a/e2e/rbd.go b/e2e/rbd.go index 8bd81081c..8e2560259 100644 --- a/e2e/rbd.go +++ b/e2e/rbd.go @@ -815,11 +815,7 @@ var _ = Describe("RBD", func() { namespace := cephCSINamespace // create user Secret - secret, err := getSecret(vaultExamplePath + "user-secret.yaml") - if err != nil { - e2elog.Failf("failed to load user Secret: %v", err) - } - _, err = c.CoreV1().Secrets(namespace).Create(context.TODO(), &secret, metav1.CreateOptions{}) + err = retryKubectlFile(namespace, kubectlCreate, vaultExamplePath+"user-secret.yaml", deployTimeout) if err != nil { e2elog.Failf("failed to create user Secret: %v", err) } @@ -832,7 +828,11 @@ var _ = Describe("RBD", func() { validateRBDImageCount(f, 0, defaultRBDPool) // delete user secret - err = c.CoreV1().Secrets(namespace).Delete(context.TODO(), secret.Name, metav1.DeleteOptions{}) + err = retryKubectlFile(namespace, + kubectlDelete, + vaultExamplePath+"user-secret.yaml", + deployTimeout, + "--ignore-not-found=true") if err != nil { e2elog.Failf("failed to delete user Secret: %v", err) } @@ -867,11 +867,7 @@ var _ = Describe("RBD", func() { namespace := f.UniqueName // create user Secret - secret, err := getSecret(vaultExamplePath + "user-secret.yaml") - if err != nil { - e2elog.Failf("failed to load user Secret: %v", err) - } - _, err = c.CoreV1().Secrets(namespace).Create(context.TODO(), &secret, metav1.CreateOptions{}) + err = retryKubectlFile(namespace, kubectlCreate, vaultExamplePath+"user-secret.yaml", deployTimeout) if err != nil { e2elog.Failf("failed to create user Secret: %v", err) } @@ -884,7 +880,12 @@ var _ = Describe("RBD", func() { validateRBDImageCount(f, 0, defaultRBDPool) // delete user secret - err = c.CoreV1().Secrets(namespace).Delete(context.TODO(), secret.Name, metav1.DeleteOptions{}) + err = retryKubectlFile( + namespace, + kubectlDelete, + vaultExamplePath+"user-secret.yaml", + deployTimeout, + "--ignore-not-found=true") if err != nil { e2elog.Failf("failed to delete user Secret: %v", err) }