From 004c5f5a3989869dae0fc8d4d155ca41530a8f6d Mon Sep 17 00:00:00 2001 From: googs1025 Date: Tue, 18 Feb 2025 09:13:09 +0800 Subject: [PATCH] chore: remove unnecessary check for node is zero --- pkg/scheduler/framework/plugins/interpodaffinity/scoring.go | 4 ---- pkg/scheduler/framework/plugins/nodeaffinity/node_affinity.go | 3 --- .../framework/plugins/tainttoleration/taint_toleration.go | 3 --- 3 files changed, 10 deletions(-) diff --git a/pkg/scheduler/framework/plugins/interpodaffinity/scoring.go b/pkg/scheduler/framework/plugins/interpodaffinity/scoring.go index 44a173aee8b..c3490821519 100644 --- a/pkg/scheduler/framework/plugins/interpodaffinity/scoring.go +++ b/pkg/scheduler/framework/plugins/interpodaffinity/scoring.go @@ -130,10 +130,6 @@ func (pl *InterPodAffinity) PreScore( pod *v1.Pod, nodes []*framework.NodeInfo, ) *framework.Status { - if len(nodes) == 0 { - // No nodes to score. - return framework.NewStatus(framework.Skip) - } if pl.sharedLister == nil { return framework.NewStatus(framework.Error, "empty shared lister in InterPodAffinity PreScore") diff --git a/pkg/scheduler/framework/plugins/nodeaffinity/node_affinity.go b/pkg/scheduler/framework/plugins/nodeaffinity/node_affinity.go index 0a8c4f3561f..b123d9e2356 100644 --- a/pkg/scheduler/framework/plugins/nodeaffinity/node_affinity.go +++ b/pkg/scheduler/framework/plugins/nodeaffinity/node_affinity.go @@ -238,9 +238,6 @@ func (s *preScoreState) Clone() framework.StateData { // PreScore builds and writes cycle state used by Score and NormalizeScore. func (pl *NodeAffinity) PreScore(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodes []*framework.NodeInfo) *framework.Status { - if len(nodes) == 0 { - return nil - } preferredNodeAffinity, err := getPodPreferredNodeAffinity(pod) if err != nil { return framework.AsStatus(err) diff --git a/pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go b/pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go index 5caff62235d..af9cb74d8c8 100644 --- a/pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go +++ b/pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go @@ -143,9 +143,6 @@ func getAllTolerationPreferNoSchedule(tolerations []v1.Toleration) (tolerationLi // PreScore builds and writes cycle state used by Score and NormalizeScore. func (pl *TaintToleration) PreScore(ctx context.Context, cycleState *framework.CycleState, pod *v1.Pod, nodes []*framework.NodeInfo) *framework.Status { - if len(nodes) == 0 { - return nil - } tolerationsPreferNoSchedule := getAllTolerationPreferNoSchedule(pod.Spec.Tolerations) state := &preScoreState{ tolerationsPreferNoSchedule: tolerationsPreferNoSchedule,