diff --git a/pkg/controller/volume/persistentvolume/BUILD b/pkg/controller/volume/persistentvolume/BUILD index b33660b39b1..2813145d88a 100644 --- a/pkg/controller/volume/persistentvolume/BUILD +++ b/pkg/controller/volume/persistentvolume/BUILD @@ -30,6 +30,7 @@ go_library( "//pkg/cloudprovider:go_default_library", "//pkg/controller:go_default_library", "//pkg/util/goroutinemap:go_default_library", + "//pkg/util/goroutinemap/exponentialbackoff:go_default_library", "//pkg/util/io:go_default_library", "//pkg/util/mount:go_default_library", "//pkg/volume:go_default_library", diff --git a/pkg/controller/volume/persistentvolume/pv_controller.go b/pkg/controller/volume/persistentvolume/pv_controller.go index 212a85bff52..6e42e1920b4 100644 --- a/pkg/controller/volume/persistentvolume/pv_controller.go +++ b/pkg/controller/volume/persistentvolume/pv_controller.go @@ -35,6 +35,7 @@ import ( storagelisters "k8s.io/kubernetes/pkg/client/listers/storage/v1beta1" "k8s.io/kubernetes/pkg/cloudprovider" "k8s.io/kubernetes/pkg/util/goroutinemap" + "k8s.io/kubernetes/pkg/util/goroutinemap/exponentialbackoff" vol "k8s.io/kubernetes/pkg/volume" "github.com/golang/glog" @@ -1414,9 +1415,12 @@ func (ctrl *PersistentVolumeController) scheduleOperation(operationName string, err := ctrl.runningOperations.Run(operationName, operation) if err != nil { - if goroutinemap.IsAlreadyExists(err) { + switch { + case goroutinemap.IsAlreadyExists(err): glog.V(4).Infof("operation %q is already running, skipping", operationName) - } else { + case exponentialbackoff.IsExponentialBackoff(err): + glog.V(4).Infof("operation %q postponed due to exponential backoff", operationName) + default: glog.Errorf("error scheduling operation %q: %v", operationName, err) } }