Merge pull request #871 from sameshai/bugfix-778
external-snapshotter constantly retrying CreateSnapshot calls on error w/o backoff
This commit is contained in:
@@ -41,7 +41,6 @@ import (
|
|||||||
groupsnapshotlisters "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumegroupsnapshot/v1alpha1"
|
groupsnapshotlisters "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumegroupsnapshot/v1alpha1"
|
||||||
snapshotlisters "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1"
|
snapshotlisters "github.com/kubernetes-csi/external-snapshotter/client/v6/listers/volumesnapshot/v1"
|
||||||
"github.com/kubernetes-csi/external-snapshotter/v6/pkg/snapshotter"
|
"github.com/kubernetes-csi/external-snapshotter/v6/pkg/snapshotter"
|
||||||
"github.com/kubernetes-csi/external-snapshotter/v6/pkg/utils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type csiSnapshotSideCarController struct {
|
type csiSnapshotSideCarController struct {
|
||||||
@@ -116,20 +115,12 @@ func NewCSISnapshotSideCarController(
|
|||||||
cache.ResourceEventHandlerFuncs{
|
cache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: func(obj interface{}) { ctrl.enqueueContentWork(obj) },
|
AddFunc: func(obj interface{}) { ctrl.enqueueContentWork(obj) },
|
||||||
UpdateFunc: func(oldObj, newObj interface{}) {
|
UpdateFunc: func(oldObj, newObj interface{}) {
|
||||||
// If the CSI driver fails to create a snapshot and returns a failure (indicated by content.Status.Error), the
|
// Considering the object is modified more than once during the workflow we are not relying on the
|
||||||
// CSI Snapshotter sidecar will remove the "AnnVolumeSnapshotBeingCreated" annotation from the
|
// "AnnVolumeSnapshotBeingCreated" annotation. Instead we will just check if newobj status has error
|
||||||
// VolumeSnapshotContent.
|
// and avoid the immediate re-queue. This allows the retry to happen with exponential backoff.
|
||||||
// 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)
|
newSnapContent := newObj.(*crdv1.VolumeSnapshotContent)
|
||||||
if newSnapContent.Status != nil && newSnapContent.Status.Error != nil {
|
if newSnapContent.Status != nil && newSnapContent.Status.Error != nil {
|
||||||
oldSnapContent := oldObj.(*crdv1.VolumeSnapshotContent)
|
return
|
||||||
_, newExists := newSnapContent.ObjectMeta.Annotations[utils.AnnVolumeSnapshotBeingCreated]
|
|
||||||
_, oldExists := oldSnapContent.ObjectMeta.Annotations[utils.AnnVolumeSnapshotBeingCreated]
|
|
||||||
if !newExists && oldExists {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ctrl.enqueueContentWork(newObj)
|
ctrl.enqueueContentWork(newObj)
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user