diff --git a/pkg/scheduler/core/generic_scheduler.go b/pkg/scheduler/core/generic_scheduler.go index e31a9c3b57e..1dd238f6091 100644 --- a/pkg/scheduler/core/generic_scheduler.go +++ b/pkg/scheduler/core/generic_scheduler.go @@ -556,7 +556,7 @@ func (g *genericScheduler) findNodesThatFit(state *framework.CycleState, pod *v1 // addNominatedPods adds pods with equal or greater priority which are nominated // to run on the node given in nodeInfo to meta and nodeInfo. It returns 1) whether -// any pod was added, 2) augmented meta data, 3) augmented nodeInfo. +// any pod was added, 2) augmented metadata, 3) augmented CycleState 4) augmented nodeInfo. func (g *genericScheduler) addNominatedPods(pod *v1.Pod, meta predicates.PredicateMetadata, state *framework.CycleState, nodeInfo *schedulernodeinfo.NodeInfo, queue internalqueue.SchedulingQueue) (bool, predicates.PredicateMetadata, *framework.CycleState, *schedulernodeinfo.NodeInfo, error) { @@ -640,7 +640,7 @@ func (g *genericScheduler) podFitsOnNode( stateToUse := state nodeInfoToUse := info if i == 0 { - err := error(nil) + var err error podsAdded, metaToUse, stateToUse, nodeInfoToUse, err = g.addNominatedPods(pod, meta, state, info, queue) if err != nil { return false, []predicates.PredicateFailureReason{}, nil, err diff --git a/pkg/scheduler/framework/plugins/migration/utils.go b/pkg/scheduler/framework/plugins/migration/utils.go index f5bfcb5039b..fb6ba859a98 100644 --- a/pkg/scheduler/framework/plugins/migration/utils.go +++ b/pkg/scheduler/framework/plugins/migration/utils.go @@ -21,6 +21,14 @@ import ( framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1" ) +const ( + // PredicatesStateKey is the key in CycleState to PredicateStateData + PredicatesStateKey = "predicates" + + // PrioritiesStateKey is the key in CycleState to PrioritiesStateData + PrioritiesStateKey = "priorities" +) + // PredicateResultToFrameworkStatus converts a predicate result (PredicateFailureReason + error) // to a framework status. func PredicateResultToFrameworkStatus(reasons []predicates.PredicateFailureReason, err error) *framework.Status { @@ -48,14 +56,6 @@ func ErrorToFrameworkStatus(err error) *framework.Status { return nil } -const ( - // PredicatesStateKey is the key in CycleState to PredicateStateData - PredicatesStateKey = "predicates" - - // PrioritiesStateKey is the key in CycleState to PrioritiesStateData - PrioritiesStateKey = "priorities" -) - // PredicatesStateData is a pointer to PredicateMetadata. In the normal case, StateData is supposed to // be generated and stored in CycleState by a framework plugin (like a PreFilter pre-computing data for // its corresponding Filter). However, during migration, the scheduler will inject a pointer to