Allow resync on pvc when there is no error on the object
This commit is contained in:
@@ -97,18 +97,21 @@ 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, the CSI Snapshotter sidecar
|
||||
// will remove the "AnnVolumeSnapshotBeingCreated" annotation from the VolumeSnapshotContent.
|
||||
// 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.
|
||||
// So we are skipping the re-queue here to avoid CreateSnapshot being called without exponential backoff.
|
||||
newSnapContent := newObj.(*crdv1.VolumeSnapshotContent)
|
||||
if newSnapContent.Status.Error != nil {
|
||||
oldSnapContent := oldObj.(*crdv1.VolumeSnapshotContent)
|
||||
_, newExists := newSnapContent.ObjectMeta.Annotations[utils.AnnVolumeSnapshotBeingCreated]
|
||||
_, oldExists := oldSnapContent.ObjectMeta.Annotations[utils.AnnVolumeSnapshotBeingCreated]
|
||||
if !newExists && oldExists {
|
||||
return
|
||||
}
|
||||
}
|
||||
ctrl.enqueueContentWork(newObj)
|
||||
},
|
||||
DeleteFunc: func(obj interface{}) { ctrl.enqueueContentWork(obj) },
|
||||
|
Reference in New Issue
Block a user