mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
scheduler: remove useless null pointer check about nodeInfo for in-tree plugins
This commit is contained in:
parent
27110bd821
commit
97d9d2bd17
@ -59,7 +59,8 @@ func (pl *NodeUnschedulable) Name() string {
|
||||
|
||||
// Filter invoked at the filter extension point.
|
||||
func (pl *NodeUnschedulable) Filter(ctx context.Context, _ *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status {
|
||||
if nodeInfo == nil || nodeInfo.Node() == nil {
|
||||
node := nodeInfo.Node()
|
||||
if node == nil {
|
||||
return framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonUnknownCondition)
|
||||
}
|
||||
// If pod tolerate unschedulable taint, it's also tolerate `node.Spec.Unschedulable`.
|
||||
@ -68,7 +69,7 @@ func (pl *NodeUnschedulable) Filter(ctx context.Context, _ *framework.CycleState
|
||||
Effect: v1.TaintEffectNoSchedule,
|
||||
})
|
||||
// TODO (k82cn): deprecates `node.Spec.Unschedulable` in 1.13.
|
||||
if nodeInfo.Node().Spec.Unschedulable && !podToleratesUnschedulable {
|
||||
if node.Spec.Unschedulable && !podToleratesUnschedulable {
|
||||
return framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonUnschedulable)
|
||||
}
|
||||
return nil
|
||||
|
@ -62,7 +62,8 @@ func (pl *TaintToleration) EventsToRegister() []framework.ClusterEvent {
|
||||
|
||||
// Filter invoked at the filter extension point.
|
||||
func (pl *TaintToleration) Filter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status {
|
||||
if nodeInfo == nil || nodeInfo.Node() == nil {
|
||||
node := nodeInfo.Node()
|
||||
if node == nil {
|
||||
return framework.AsStatus(fmt.Errorf("invalid nodeInfo"))
|
||||
}
|
||||
|
||||
@ -71,7 +72,7 @@ func (pl *TaintToleration) Filter(ctx context.Context, state *framework.CycleSta
|
||||
return t.Effect == v1.TaintEffectNoSchedule || t.Effect == v1.TaintEffectNoExecute
|
||||
}
|
||||
|
||||
taint, isUntolerated := v1helper.FindMatchingUntoleratedTaint(nodeInfo.Node().Spec.Taints, pod.Spec.Tolerations, filterPredicate)
|
||||
taint, isUntolerated := v1helper.FindMatchingUntoleratedTaint(node.Spec.Taints, pod.Spec.Tolerations, filterPredicate)
|
||||
if !isUntolerated {
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user