Skip to content

Commit

Permalink
Allow disabling of failure thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
wongma7 committed Jan 16, 2019
1 parent 844c30e commit 9e64b4a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ func CreateProvisionedPVInterval(createProvisionedPVInterval time.Duration) func
}

// FailedProvisionThreshold is the threshold for max number of retries on
// failures of Provision. Defaults to 15.
// failures of Provision. Set to 0 to retry indefinitely. Defaults to 15.
func FailedProvisionThreshold(failedProvisionThreshold int) func(*ProvisionController) error {
return func(c *ProvisionController) error {
if c.HasRun() {
Expand All @@ -261,7 +261,7 @@ func FailedProvisionThreshold(failedProvisionThreshold int) func(*ProvisionContr
}

// FailedDeleteThreshold is the threshold for max number of retries on failures
// of Delete. Defaults to 15.
// of Delete. Set to 0 to retry indefinitely. Defaults to 15.
func FailedDeleteThreshold(failedDeleteThreshold int) func(*ProvisionController) error {
return func(c *ProvisionController) error {
if c.HasRun() {
Expand Down Expand Up @@ -684,7 +684,7 @@ func (ctrl *ProvisionController) processNextClaimWorkItem() bool {
}

if err := ctrl.syncClaimHandler(key); err != nil {
if ctrl.claimQueue.NumRequeues(obj) < ctrl.failedProvisionThreshold {
if ctrl.claimQueue.NumRequeues(obj) < ctrl.failedProvisionThreshold || ctrl.failedProvisionThreshold == 0 {
glog.Warningf("Retrying syncing claim %q because failures %v < threshold %v", key, ctrl.claimQueue.NumRequeues(obj), ctrl.failedProvisionThreshold)
ctrl.claimQueue.AddRateLimited(obj)
} else {
Expand Down Expand Up @@ -725,11 +725,11 @@ func (ctrl *ProvisionController) processNextVolumeWorkItem() bool {
}

if err := ctrl.syncVolumeHandler(key); err != nil {
if ctrl.volumeQueue.NumRequeues(obj) < ctrl.failedDeleteThreshold {
glog.Warningf("Retrying syncing volume %q because failures %v < threshold %v", key, ctrl.volumeQueue.NumRequeues(obj), ctrl.failedProvisionThreshold)
if ctrl.volumeQueue.NumRequeues(obj) < ctrl.failedDeleteThreshold || ctrl.failedDeleteThreshold == 0 {
glog.Warningf("Retrying syncing volume %q because failures %v < threshold %v", key, ctrl.volumeQueue.NumRequeues(obj), ctrl.failedDeleteThreshold)
ctrl.volumeQueue.AddRateLimited(obj)
} else {
glog.Errorf("Giving up syncing volume %q because failures %v >= threshold %v", key, ctrl.volumeQueue.NumRequeues(obj), ctrl.failedProvisionThreshold)
glog.Errorf("Giving up syncing volume %q because failures %v >= threshold %v", key, ctrl.volumeQueue.NumRequeues(obj), ctrl.failedDeleteThreshold)
// Done but do not Forget: it will not be in the queue but NumRequeues
// will be saved until the obj is deleted from kubernetes
}
Expand Down

0 comments on commit 9e64b4a

Please sign in to comment.