@@ -97,17 +97,20 @@ func NewCSISnapshotSideCarController(
9797 cache.ResourceEventHandlerFuncs {
9898 AddFunc : func (obj interface {}) { ctrl .enqueueContentWork (obj ) },
9999 UpdateFunc : func (oldObj , newObj interface {}) {
100- // If the CSI driver fails to create a snapshot and returns a failure, the CSI Snapshotter sidecar
101- // will remove the "AnnVolumeSnapshotBeingCreated" annotation from the VolumeSnapshotContent.
100+ // If the CSI driver fails to create a snapshot and returns a failure (indicated by content.Status.Error), the
101+ // CSI Snapshotter sidecar will remove the "AnnVolumeSnapshotBeingCreated" annotation from the
102+ // VolumeSnapshotContent.
102103 // This will trigger a VolumeSnapshotContent update and it will cause the obj to be re-queued immediately
103104 // and CSI CreateSnapshot will be called again without exponential backoff.
104105 // So we are skipping the re-queue here to avoid CreateSnapshot being called without exponential backoff.
105106 newSnapContent := newObj .(* crdv1.VolumeSnapshotContent )
106- oldSnapContent := oldObj .(* crdv1.VolumeSnapshotContent )
107- _ , newExists := newSnapContent .ObjectMeta .Annotations [utils .AnnVolumeSnapshotBeingCreated ]
108- _ , oldExists := oldSnapContent .ObjectMeta .Annotations [utils .AnnVolumeSnapshotBeingCreated ]
109- if ! newExists && oldExists {
110- return
107+ if newSnapContent .Status .Error != nil {
108+ oldSnapContent := oldObj .(* crdv1.VolumeSnapshotContent )
109+ _ , newExists := newSnapContent .ObjectMeta .Annotations [utils .AnnVolumeSnapshotBeingCreated ]
110+ _ , oldExists := oldSnapContent .ObjectMeta .Annotations [utils .AnnVolumeSnapshotBeingCreated ]
111+ if ! newExists && oldExists {
112+ return
113+ }
111114 }
112115 ctrl .enqueueContentWork (newObj )
113116 },
0 commit comments