Removing unneeded if

This commit is contained in:
juanjo 2024-03-28 12:10:17 +01:00
parent f43d792b73
commit 6bc9e97e25
1 changed files with 9 additions and 11 deletions

View File

@ -173,17 +173,15 @@ func syncPV(ctx context.Context, c client.Client, log logr.Logger, ns string, pv
}
// If ReclaimPolicy is not "Delete", we proceed to clean up the ClaimRef.
if pv.Status.Phase == corev1.VolumeReleased {
pvCopy := pv.DeepCopy()
delete(pvCopy.Labels, labelKeyCleanup)
pvCopy.Spec.ClaimRef = nil
log.V(2).Info("Unsetting PV's claimRef", "pv", pv.Name)
if err := c.Update(ctx, pvCopy); err != nil {
return nil, err
}
log.Info("PV should be Available now")
pvCopy := pv.DeepCopy()
delete(pvCopy.Labels, labelKeyCleanup)
pvCopy.Spec.ClaimRef = nil
log.V(2).Info("Unsetting PV's claimRef", "pv", pv.Name)
if err := c.Update(ctx, pvCopy); err != nil {
return nil, err
}
log.Info("PV should be Available now")
return nil, nil
}
}