mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Merge pull request #100370 from houjun41544/20210318-nodeinfoIsNil
Remove redundant checks
This commit is contained in:
commit
74763cd7e8
@ -121,9 +121,6 @@ func (pl *NodeLabel) Score(ctx context.Context, state *framework.CycleState, pod
|
|||||||
}
|
}
|
||||||
|
|
||||||
node := nodeInfo.Node()
|
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))
|
size := int64(len(pl.args.PresentLabelsPreference) + len(pl.args.AbsentLabelsPreference))
|
||||||
if size == 0 {
|
if size == 0 {
|
||||||
|
@ -51,9 +51,6 @@ func (pl *NodePreferAvoidPods) Score(ctx context.Context, state *framework.Cycle
|
|||||||
}
|
}
|
||||||
|
|
||||||
node := nodeInfo.Node()
|
node := nodeInfo.Node()
|
||||||
if node == nil {
|
|
||||||
return 0, framework.NewStatus(framework.Error, "node not found")
|
|
||||||
}
|
|
||||||
|
|
||||||
controllerRef := metav1.GetControllerOf(pod)
|
controllerRef := metav1.GetControllerOf(pod)
|
||||||
if controllerRef != nil {
|
if controllerRef != nil {
|
||||||
|
@ -146,7 +146,7 @@ func countIntolerableTaintsPreferNoSchedule(taints []v1.Taint, tolerations []v1.
|
|||||||
// Score invoked at the Score extension point.
|
// 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) {
|
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)
|
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))
|
return 0, framework.AsStatus(fmt.Errorf("getting node %q from Snapshot: %w", nodeName, err))
|
||||||
}
|
}
|
||||||
node := nodeInfo.Node()
|
node := nodeInfo.Node()
|
||||||
|
Loading…
Reference in New Issue
Block a user