Remove redundant checks

This commit is contained in:
houjun
2021-03-18 19:52:39 +08:00
parent 0c6d922812
commit 4c6d5ea709
3 changed files with 1 additions and 7 deletions

View File

@@ -120,9 +120,6 @@ func (pl *NodeLabel) Score(ctx context.Context, state *framework.CycleState, pod
}
node := nodeInfo.Node()
if node == nil {
return 0, framework.NewStatus(framework.Error, "node not found")
}
size := int64(len(pl.args.PresentLabelsPreference) + len(pl.args.AbsentLabelsPreference))
if size == 0 {

View File

@@ -51,9 +51,6 @@ func (pl *NodePreferAvoidPods) Score(ctx context.Context, state *framework.Cycle
}
node := nodeInfo.Node()
if node == nil {
return 0, framework.NewStatus(framework.Error, "node not found")
}
controllerRef := metav1.GetControllerOf(pod)
if controllerRef != nil {

View File

@@ -137,7 +137,7 @@ func countIntolerableTaintsPreferNoSchedule(taints []v1.Taint, tolerations []v1.
// Score invoked at the Score extension point.
func (pl *TaintToleration) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status) {
nodeInfo, err := pl.handle.SnapshotSharedLister().NodeInfos().Get(nodeName)
if err != nil || nodeInfo.Node() == nil {
if err != nil {
return 0, framework.AsStatus(fmt.Errorf("getting node %q from Snapshot: %w", nodeName, err))
}
node := nodeInfo.Node()