diff --git a/pkg/scheduler/backend/queue/backoff_queue.go b/pkg/scheduler/backend/queue/backoff_queue.go index 733f41adcd5..0ad7f478680 100644 --- a/pkg/scheduler/backend/queue/backoff_queue.go +++ b/pkg/scheduler/backend/queue/backoff_queue.go @@ -218,6 +218,10 @@ func (bq *backoffQueue) isPodBackingoff(podInfo *framework.QueuedPodInfo) bool { // because of the fact that the backoff time is calculated based on podInfo.Attempts, // which doesn't get changed until the pod's scheduling is retried. func (bq *backoffQueue) getBackoffTime(podInfo *framework.QueuedPodInfo) time.Time { + if bq.podMaxBackoff == 0 { + // If podMaxBackoff is set to 0, the backoff should be disabled completely. + return time.Time{} + } count := podInfo.UnschedulableCount if podInfo.ConsecutiveErrorsCount > 0 { // This Pod has experienced an error status at the last scheduling cycle, diff --git a/pkg/scheduler/backend/queue/backoff_queue_test.go b/pkg/scheduler/backend/queue/backoff_queue_test.go index 3b5122889e1..078f6853ddf 100644 --- a/pkg/scheduler/backend/queue/backoff_queue_test.go +++ b/pkg/scheduler/backend/queue/backoff_queue_test.go @@ -67,6 +67,13 @@ func TestBackoffQueue_getBackoffTime(t *testing.T) { podInfo: &framework.QueuedPodInfo{UnschedulableCount: 5, ConsecutiveErrorsCount: 16, Timestamp: time.Date(2023, 10, 1, 0, 0, 0, 0, time.UTC)}, want: time.Date(2023, 10, 1, 0, 0, 32, 0, time.UTC), }, + { + name: "zero maxBackoffDuration means no backoff", + initialBackoffDuration: 0, + maxBackoffDuration: 0, + podInfo: &framework.QueuedPodInfo{UnschedulableCount: 16, Timestamp: time.Date(2023, 10, 1, 0, 0, 0, 0, time.UTC)}, + want: time.Time{}, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {