mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +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 {
|
||||
node := nodeInfo.Node()
|
||||
|
||||
if !node.Spec.Unschedulable {
|
||||
return nil
|
||||
}
|
||||
|
||||
// If pod tolerate unschedulable taint, it's also tolerate `node.Spec.Unschedulable`.
|
||||
podToleratesUnschedulable := v1helper.TolerationsTolerateTaint(pod.Spec.Tolerations, &v1.Taint{
|
||||
Key: v1.TaintNodeUnschedulable,
|
||||
Effect: v1.TaintEffectNoSchedule,
|
||||
})
|
||||
if node.Spec.Unschedulable && !podToleratesUnschedulable {
|
||||
if !podToleratesUnschedulable {
|
||||
return framework.NewStatus(framework.UnschedulableAndUnresolvable, ErrReasonUnschedulable)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user