Skip to content

Commit

Permalink
Update static_autoscaler tests & handle pod list processors errors as…
Browse files Browse the repository at this point in the history
… warnings
  • Loading branch information
atwamahmoud committed Nov 22, 2023
1 parent a1ae4d3 commit 5115f12
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package podlistprocessor

import (
"fmt"

apiv1 "k8s.io/api/core/v1"
"k8s.io/autoscaler/cluster-autoscaler/context"
core_utils "k8s.io/autoscaler/cluster-autoscaler/core/utils"
Expand All @@ -36,8 +38,7 @@ func NewFilterOutExpendablePodListProcessor() *filterOutExpendable {
func (p *filterOutExpendable) Process(context *context.AutoscalingContext, pods []*apiv1.Pod) ([]*apiv1.Pod, error) {
nodes, err := context.AllNodeLister().List()
if err != nil {
klog.Warningf("Failed to list all nodes while filtering expendable: %v", err)
return nil, err
return nil, fmt.Errorf("Failed to list all nodes while filtering expendable pods: %v", err)
}
expendablePodsPriorityCutoff := context.AutoscalingOptions.ExpendablePodsPriorityCutoff

Expand Down
6 changes: 5 additions & 1 deletion cluster-autoscaler/core/static_autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,11 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) caerrors.AutoscalerErr
a.AutoscalingContext.DebuggingSnapshotter.SetClusterNodes(l)
}

unschedulablePodsToHelp, _ := a.processors.PodListProcessor.Process(a.AutoscalingContext, unschedulablePods)
unschedulablePodsToHelp, err := a.processors.PodListProcessor.Process(a.AutoscalingContext, unschedulablePods)

if err != nil {
klog.Warningf("Failed to process unschedulable pods: %v", err)
}

// finally, filter out pods that are too "young" to safely be considered for a scale-up (delay is configurable)
unschedulablePodsToHelp = a.filterOutYoungPods(unschedulablePodsToHelp, currentTime)
Expand Down
Loading

0 comments on commit 5115f12

Please sign in to comment.