From 3e1a4e2087f9ddecf609075f42f0f3f1d42d2530 Mon Sep 17 00:00:00 2001 From: Jakub Binkowski Date: Fri, 2 Jan 2026 15:12:51 +0000 Subject: [PATCH 1/3] new-pod-scale-up-delay=0 should effectively disable filtering out young pods --- cluster-autoscaler/core/static_autoscaler.go | 5 ++++- .../core/static_autoscaler_test.go | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cluster-autoscaler/core/static_autoscaler.go b/cluster-autoscaler/core/static_autoscaler.go index 60ac1fe9d5aa..d76dbbb43fd4 100644 --- a/cluster-autoscaler/core/static_autoscaler.go +++ b/cluster-autoscaler/core/static_autoscaler.go @@ -984,7 +984,10 @@ func (a *StaticAutoscaler) filterOutYoungPods(allUnschedulablePods []*apiv1.Pod, } } - if podAge > podScaleUpDelay { + // newPodScaleUpDelay <= 0 means that young pod filtering out is disabled. + // As pod age is calculated from CA loop start time, it is technically possible that some pods will have negative + // age and would be unnecesarily skipped by the current loop. + if podScaleUpDelay <= 0 || podAge > podScaleUpDelay { oldUnschedulablePods = append(oldUnschedulablePods, pod) } else { klog.V(3).Infof("Pod %s is %.3f seconds old, too new to consider unschedulable", pod.Name, podAge.Seconds()) diff --git a/cluster-autoscaler/core/static_autoscaler_test.go b/cluster-autoscaler/core/static_autoscaler_test.go index 7f76b5c481a5..9719e3f3334b 100644 --- a/cluster-autoscaler/core/static_autoscaler_test.go +++ b/cluster-autoscaler/core/static_autoscaler_test.go @@ -2836,6 +2836,8 @@ func TestFilterOutYoungPods(t *testing.T) { p4.Annotations = map[string]string{ annotations.PodScaleUpDelayAnnotationKey: "error", } + p5 := BuildTestPod("p5", 500, 1000) + p5.CreationTimestamp = metav1.NewTime(now) tests := []struct { name string @@ -2882,6 +2884,20 @@ func TestFilterOutYoungPods(t *testing.T) { expectedPods: []*apiv1.Pod{p1, p4}, expectedError: "Failed to parse pod", }, + { + name: "future pods included when podScaleUpDelay is 0", + newPodScaleUpDelay: 0, + runTime: now, + pods: []*apiv1.Pod{p1, p5}, + expectedPods: []*apiv1.Pod{p1, p5}, + }, + { + name: "future pods excluded when podScaleUpDelay is above 0", + newPodScaleUpDelay: 1 * time.Second, + runTime: now, + pods: []*apiv1.Pod{p1, p5}, + expectedPods: []*apiv1.Pod{p1}, + }, } for _, tt := range tests { From da87284aa0544987c166ec29f120e8ddcf2c70a3 Mon Sep 17 00:00:00 2001 From: Jakub Binkowski Date: Wed, 7 Jan 2026 07:51:30 +0000 Subject: [PATCH 2/3] Typo fix --- cluster-autoscaler/core/static_autoscaler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster-autoscaler/core/static_autoscaler.go b/cluster-autoscaler/core/static_autoscaler.go index d76dbbb43fd4..48158a1def9a 100644 --- a/cluster-autoscaler/core/static_autoscaler.go +++ b/cluster-autoscaler/core/static_autoscaler.go @@ -986,7 +986,7 @@ func (a *StaticAutoscaler) filterOutYoungPods(allUnschedulablePods []*apiv1.Pod, // newPodScaleUpDelay <= 0 means that young pod filtering out is disabled. // As pod age is calculated from CA loop start time, it is technically possible that some pods will have negative - // age and would be unnecesarily skipped by the current loop. + // age and would be unnecessarily skipped by the current loop. if podScaleUpDelay <= 0 || podAge > podScaleUpDelay { oldUnschedulablePods = append(oldUnschedulablePods, pod) } else { From f23bef78ff1ce1e9b8c7acb4811f51df36ce1e76 Mon Sep 17 00:00:00 2001 From: Jakub Binkowski Date: Wed, 7 Jan 2026 08:06:25 +0000 Subject: [PATCH 3/3] Format fix --- cluster-autoscaler/core/static_autoscaler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster-autoscaler/core/static_autoscaler.go b/cluster-autoscaler/core/static_autoscaler.go index 48158a1def9a..32b9251e677d 100644 --- a/cluster-autoscaler/core/static_autoscaler.go +++ b/cluster-autoscaler/core/static_autoscaler.go @@ -984,7 +984,7 @@ func (a *StaticAutoscaler) filterOutYoungPods(allUnschedulablePods []*apiv1.Pod, } } - // newPodScaleUpDelay <= 0 means that young pod filtering out is disabled. + // newPodScaleUpDelay <= 0 means that young pod filtering out is disabled. // As pod age is calculated from CA loop start time, it is technically possible that some pods will have negative // age and would be unnecessarily skipped by the current loop. if podScaleUpDelay <= 0 || podAge > podScaleUpDelay {