mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-09 16:00:22 +00:00
e2e: pass non-empty Namespace/Name in deletePVCAndPV()
When getting the PVC or PV failed, the returned object may contain empty values. If that happens, a retry uses the empty values for Namespace and Name, which will never be successful. Instead, use the Namespace and Name attributes from the original object, and not from the object returned by the Get() call. Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
parent
2df55a55a3
commit
dbbda5473b
@ -138,8 +138,8 @@ func deletePVCAndPV(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, pv *v
|
||||
pvcToDelete.Status.String(),
|
||||
int(time.Since(start).Seconds()))
|
||||
pvcToDelete, err = c.CoreV1().
|
||||
PersistentVolumeClaims(pvcToDelete.Namespace).
|
||||
Get(context.TODO(), pvcToDelete.Name, metav1.GetOptions{})
|
||||
PersistentVolumeClaims(pvc.Namespace).
|
||||
Get(context.TODO(), pvc.Name, metav1.GetOptions{})
|
||||
if err == nil {
|
||||
if pvcToDelete.Status.Phase == "" {
|
||||
// this is unexpected, an empty Phase is not defined
|
||||
@ -176,7 +176,7 @@ func deletePVCAndPV(c kubernetes.Interface, pvc *v1.PersistentVolumeClaim, pv *v
|
||||
pvToDelete.Status.String(),
|
||||
int(time.Since(start).Seconds()))
|
||||
|
||||
pvToDelete, err = c.CoreV1().PersistentVolumes().Get(context.TODO(), pvToDelete.Name, metav1.GetOptions{})
|
||||
pvToDelete, err = c.CoreV1().PersistentVolumes().Get(context.TODO(), pv.Name, metav1.GetOptions{})
|
||||
if err == nil {
|
||||
return false, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user