mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-08-08 23:37:11 +00:00
Skip backoff when PodMaxBackoffDuration is set to zero
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user