Skip to content

Commit 3cc88df

Browse files
committed
cleanup useless null pointer checks for nodeInfo.Node()
1 parent c2c0533 commit 3cc88df

2 files changed

Lines changed: 1 addition & 13 deletions

File tree

pkg/plugins/dynamic/plugins.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ func (ds *DynamicScheduler) Filter(ctx context.Context, state *framework.CycleSt
4242
return framework.NewStatus(framework.Success, "")
4343
}
4444

45-
node := nodeInfo.Node()
46-
if node == nil {
47-
return framework.NewStatus(framework.Error, "node not found")
48-
}
49-
5045
nodeAnnotations, nodeName := nodeInfo.Node().Annotations, nodeInfo.Node().Name
5146
if nodeAnnotations == nil {
5247
nodeAnnotations = map[string]string{}
@@ -77,9 +72,6 @@ func (ds *DynamicScheduler) Score(ctx context.Context, state *framework.CycleSta
7772
}
7873

7974
node := nodeInfo.Node()
80-
if node == nil {
81-
return 0, framework.NewStatus(framework.Error, "node not found")
82-
}
8375

8476
nodeAnnotations := node.Annotations
8577
if nodeAnnotations == nil {
@@ -90,7 +82,7 @@ func (ds *DynamicScheduler) Score(ctx context.Context, state *framework.CycleSta
9082

9183
score = score - int(hotValue*10)
9284

93-
finalScore := utils.NormalizeScore(int64(score),framework.MaxNodeScore,framework.MinNodeScore)
85+
finalScore := utils.NormalizeScore(int64(score), framework.MaxNodeScore, framework.MinNodeScore)
9486

9587
klog.V(4).Infof("[crane] Node[%s]'s final score is %d, while score is %d and hot value is %f", node.Name, finalScore, score, hotValue)
9688

pkg/plugins/noderesourcetopology/filter.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ func (tm *TopologyMatch) Filter(
5353
return framework.AsStatus(err)
5454
}
5555

56-
if nodeInfo.Node() == nil {
57-
return framework.NewStatus(framework.Error, "node(s) not found")
58-
}
59-
6056
if utils.IsDaemonsetPod(pod) || len(s.targetContainerIndices) == 0 {
6157
return nil
6258
}

0 commit comments

Comments
 (0)