mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 03:57:41 +00:00
Merge pull request #119399 from wackxu/optimizecodeforNodeUnschedulable
Optimize the code of NodeUnschedulable to reduce TolerationsTolerateT…
This commit is contained in:
commit
ea30d100f6
@ -61,14 +61,19 @@ func (pl *NodeUnschedulable) Name() string {
|
|||||||
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 {
|
||||||
node := nodeInfo.Node()
|
node := nodeInfo.Node()
|
||||||
|
|
||||||
|
if !node.Spec.Unschedulable {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// If pod tolerate unschedulable taint, it's also tolerate `node.Spec.Unschedulable`.
|
// If pod tolerate unschedulable taint, it's also tolerate `node.Spec.Unschedulable`.
|
||||||
podToleratesUnschedulable := v1helper.TolerationsTolerateTaint(pod.Spec.Tolerations, &v1.Taint{
|
podToleratesUnschedulable := v1helper.TolerationsTolerateTaint(pod.Spec.Tolerations, &v1.Taint{
|
||||||
Key: v1.TaintNodeUnschedulable,
|
Key: v1.TaintNodeUnschedulable,
|
||||||
Effect: v1.TaintEffectNoSchedule,
|
Effect: v1.TaintEffectNoSchedule,
|
||||||
})
|
})
|
||||||
if node.Spec.Unschedulable && !podToleratesUnschedulable {
|
if !podToleratesUnschedulable {
|
||||||
return framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonUnschedulable)
|
return framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonUnschedulable)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user