Skip to content

Commit

Permalink
Merge pull request #5092 from FeLvi-zzz/automated-cherry-pick-of-#481…
Browse files Browse the repository at this point in the history
…0-upstream-cluster-autoscaler-release-1.23

[release-1.23] Automated cherry pick of #4810: Continue CA loop when unregistered nodes were removed
  • Loading branch information
k8s-ci-robot authored Aug 18, 2022
2 parents df8acc3 + e54a844 commit 5af3685
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 1 addition & 2 deletions cluster-autoscaler/core/static_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,7 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError
klog.Warningf("Failed to remove unregistered nodes: %v", err)
}
if removedAny {
klog.V(0).Infof("Some unregistered nodes were removed, skipping iteration")
return nil
klog.V(0).Infof("Some unregistered nodes were removed")
}
}

Expand Down
4 changes: 4 additions & 0 deletions cluster-autoscaler/core/static_autoscaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,10 @@ func TestStaticAutoscalerRunOnce(t *testing.T) {
readyNodeLister.SetNodes([]*apiv1.Node{n1, n2})
allNodeLister.SetNodes([]*apiv1.Node{n1, n2})
scheduledPodMock.On("List").Return([]*apiv1.Pod{p1}, nil).Twice()
unschedulablePodMock.On("List").Return([]*apiv1.Pod{p2}, nil).Once()
daemonSetListerMock.On("List", labels.Everything()).Return([]*appsv1.DaemonSet{}, nil).Once()
onScaleDownMock.On("ScaleDown", "ng2", "n3").Return(nil).Once()
podDisruptionBudgetListerMock.On("List").Return([]*policyv1.PodDisruptionBudget{}, nil).Once()

err = autoscaler.RunOnce(time.Now().Add(5 * time.Hour))
waitForDeleteToFinish(t, autoscaler.scaleDown)
Expand Down Expand Up @@ -567,8 +569,10 @@ func TestStaticAutoscalerRunOnceWithALongUnregisteredNode(t *testing.T) {
readyNodeLister.SetNodes([]*apiv1.Node{n1, n2})
allNodeLister.SetNodes([]*apiv1.Node{n1, n2})
scheduledPodMock.On("List").Return([]*apiv1.Pod{p1}, nil).Twice()
unschedulablePodMock.On("List").Return([]*apiv1.Pod{p2}, nil).Once()
onScaleDownMock.On("ScaleDown", "ng1", "broken").Return(nil).Once()
daemonSetListerMock.On("List", labels.Everything()).Return([]*appsv1.DaemonSet{}, nil).Once()
podDisruptionBudgetListerMock.On("List").Return([]*policyv1.PodDisruptionBudget{}, nil).Once()

err = autoscaler.RunOnce(later.Add(2 * time.Hour))
waitForDeleteToFinish(t, autoscaler.scaleDown)
Expand Down

0 comments on commit 5af3685

Please sign in to comment.