Skip to content

Commit

Permalink
release-1.15: CSI: Make cleanup more verbose, and don't fail get on n…
Browse files Browse the repository at this point in the history
…ot exist

Signed-off-by: Tiger Kaovilai <[email protected]>
  • Loading branch information
kaovilai committed Dec 3, 2024
1 parent dd1c6a6 commit b261838
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/util/csi/volume_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 493 in pkg/util/csi/volume_snapshot.go

View check run for this annotation

Codecov / codecov/patch

pkg/util/csi/volume_snapshot.go#L493

Added line #L493 was not covered by tests
return
}

Expand All @@ -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",

Check warning on line 505 in pkg/util/csi/volume_snapshot.go

View check run for this annotation

Codecov / codecov/patch

pkg/util/csi/volume_snapshot.go#L505

Added line #L505 was not covered by tests
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)

Check warning on line 511 in pkg/util/csi/volume_snapshot.go

View check run for this annotation

Codecov / codecov/patch

pkg/util/csi/volume_snapshot.go#L511

Added line #L511 was not covered by tests
} else {
log.Infof("Deleted volumesnapshot with volumesnapshotContent %s/%s",
vs.Namespace, vs.Name)
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit b261838

Please sign in to comment.