mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #111153 from SataQiu/fix-scheduler-20220715
scheduler: remove useless null pointer check about nodeInfo for in-tree plugins
This commit is contained in:
commit
93b6af95a0
@ -59,7 +59,8 @@ func (pl *NodeUnschedulable) Name() string {
|
|||||||
|
|
||||||
// Filter invoked at the filter extension point.
|
// Filter invoked at the filter extension point.
|
||||||
func (pl *NodeUnschedulable) Filter(ctx context.Context, _ *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status {
|
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)
|
return framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonUnknownCondition)
|
||||||
}
|
}
|
||||||
// If pod tolerate unschedulable taint, it's also tolerate `node.Spec.Unschedulable`.
|
// 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,
|
Effect: v1.TaintEffectNoSchedule,
|
||||||
})
|
})
|
||||||
// TODO (k82cn): deprecates `node.Spec.Unschedulable` in 1.13.
|
// 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 framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonUnschedulable)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -62,7 +62,8 @@ func (pl *TaintToleration) EventsToRegister() []framework.ClusterEvent {
|
|||||||
|
|
||||||
// Filter invoked at the filter extension point.
|
// 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 {
|
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"))
|
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
|
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 {
|
if !isUntolerated {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user