From 6bc9e97e2548125cce54c172f08c3ae84560d066 Mon Sep 17 00:00:00 2001 From: juanjo Date: Thu, 28 Mar 2024 12:10:17 +0100 Subject: [PATCH] Removing unneeded if --- .../actions.summerwind.net/sync_volumes.go | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/controllers/actions.summerwind.net/sync_volumes.go b/controllers/actions.summerwind.net/sync_volumes.go index 3c71bb1e..0b458765 100644 --- a/controllers/actions.summerwind.net/sync_volumes.go +++ b/controllers/actions.summerwind.net/sync_volumes.go @@ -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 -} \ No newline at end of file +}