Add upcoming nodes to ClusterSnapshot

This commit is contained in:
Łukasz Osipiuk 2020-01-15 17:47:18 +01:00
parent 83d1c4ff8a
commit 7e62105cb9
1 changed files with 11 additions and 1 deletions

View File

@ -370,9 +370,19 @@ func (a *StaticAutoscaler) RunOnce(currentTime time.Time) errors.AutoscalerError
// we tread pods with nominated node-name as scheduled for sake of scale-up considerations
scheduledPods = append(scheduledPods, unschedulableWaitingForLowerPriorityPreemption...)
// add upcoming nodes to ClusterSnapshot
upcomingNodes := getUpcomingNodeInfos(a.clusterStateRegistry, nodeInfosForGroups)
for _, upcomingNode := range upcomingNodes {
err = a.ClusterSnapshot.AddNode(upcomingNode)
if err != nil {
klog.Errorf("Failed to add upcoming node %s to cluster snapshot: %v", upcomingNode.Name, err)
return errors.ToAutoscalerError(errors.InternalError, err)
}
}
unschedulablePodsToHelp, scheduledPods, _ := a.processors.PodListProcessor.Process(
a.AutoscalingContext, unschedulablePods, scheduledPods, allNodes, readyNodes,
getUpcomingNodeInfos(a.clusterStateRegistry, nodeInfosForGroups))
upcomingNodes)
// finally, filter out pods that are too "young" to safely be considered for a scale-up (delay is configurable)
unschedulablePodsToHelp = a.filterOutYoungPods(unschedulablePodsToHelp, currentTime)