external-snapshotter constantly retrying CreateSnapshot calls on error w/o backoff

This commit is contained in:
Sameer Shaikh
2023-06-29 21:17:27 +05:30
parent d8e698f609
commit 7fac9cdaf8

View File

@@ -115,14 +115,9 @@ func NewCSISnapshotSideCarController(
cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) { ctrl.enqueueContentWork(obj) },
UpdateFunc: func(oldObj, newObj interface{}) {
// If the CSI driver fails to create a snapshot and returns a failure (indicated by content.Status.Error), the
// CSI Snapshotter sidecar will remove the "AnnVolumeSnapshotBeingCreated" annotation from the
// VolumeSnapshotContent.
// This will trigger a VolumeSnapshotContent update and it will cause the obj to be re-queued immediately
// and CSI CreateSnapshot will be called again without exponential backoff.
// Considering the object is modified more than once during the workflow we are not relying on the annoations of oldobj and newobj.
// We will just check if newobj status has error and avoid re-queue.
// So we are skipping the re-queue here to avoid CreateSnapshot being called without exponential backoff.
// Considering the object is modified more than once during the workflow we are not relying on the
// "AnnVolumeSnapshotBeingCreated" annotation. Instead we will just check if newobj status has error
// and avoid the immediate re-queue. This allows the retry to happen with exponential backoff.
newSnapContent := newObj.(*crdv1.VolumeSnapshotContent)
if newSnapContent.Status != nil && newSnapContent.Status.Error != nil {
return