From b261838262db8de1f103a871dd3fa7d27e0add7b Mon Sep 17 00:00:00 2001 From: Tiger Kaovilai Date: Tue, 3 Dec 2024 14:52:01 -0500 Subject: [PATCH] release-1.15: CSI: Make cleanup more verbose, and don't fail get on not exist Signed-off-by: Tiger Kaovilai --- pkg/util/csi/volume_snapshot.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pkg/util/csi/volume_snapshot.go b/pkg/util/csi/volume_snapshot.go index 76a4d59fa5..bbef1855f7 100644 --- a/pkg/util/csi/volume_snapshot.go +++ b/pkg/util/csi/volume_snapshot.go @@ -490,7 +490,7 @@ func CleanupVolumeSnapshot( vs, ) if err != nil { - log.Debugf("Failed to get volumesnapshot %s/%s", volSnap.Namespace, volSnap.Name) + log.Infof("Failed to get volumesnapshot %s/%s", volSnap.Namespace, volSnap.Name) return } @@ -502,13 +502,13 @@ func CleanupVolumeSnapshot( crClient, ) if err != nil { - log.Debugf("Failed to patch DeletionPolicy of volume snapshot %s/%s", + log.Infof("Failed to patch DeletionPolicy of volume snapshot %s/%s", vs.Namespace, vs.Name) } } err = crClient.Delete(context.TODO(), vs) if err != nil { - log.Debugf("Failed to delete volumesnapshot %s/%s: %v", vs.Namespace, vs.Name, err) + log.Infof("Failed to delete volumesnapshot %s/%s: %v", vs.Namespace, vs.Name, err) } else { log.Infof("Deleted volumesnapshot with volumesnapshotContent %s/%s", vs.Namespace, vs.Name) @@ -701,6 +701,10 @@ func WaitUntilVSCHandleIsReady( crclient.ObjectKeyFromObject(volSnap), vs, ); err != nil { + // if not found, do not error out yet, we want to retry Get until timeout + if apierrors.IsNotFound(err) { + return false, nil + } return false, errors.Wrapf(err, fmt.Sprintf( "failed to get volumesnapshot %s/%s",