Checked node.Unscheulable in Toleration predicate.

Signed-off-by: Da K. Ma <madaxa@cn.ibm.com>
pull/6/head
Da K. Ma 2018-01-23 20:54:11 +08:00
parent c9c6901303
commit 430ebffe2b
1 changed files with 8 additions and 0 deletions

View File

@ -1395,6 +1395,14 @@ func (c *PodAffinityChecker) satisfiesPodsAffinityAntiAffinity(pod *v1.Pod, node
// PodToleratesNodeTaints checks if a pod tolerations can tolerate the node taints // PodToleratesNodeTaints checks if a pod tolerations can tolerate the node taints
func PodToleratesNodeTaints(pod *v1.Pod, meta algorithm.PredicateMetadata, nodeInfo *schedulercache.NodeInfo) (bool, []algorithm.PredicateFailureReason, error) { func PodToleratesNodeTaints(pod *v1.Pod, meta algorithm.PredicateMetadata, nodeInfo *schedulercache.NodeInfo) (bool, []algorithm.PredicateFailureReason, error) {
if nodeInfo == nil || nodeInfo.Node() == nil {
return false, []algorithm.PredicateFailureReason{ErrNodeUnknownCondition}, nil
}
if nodeInfo.Node().Spec.Unschedulable {
return false, []algorithm.PredicateFailureReason{ErrNodeUnschedulable}, nil
}
return podToleratesNodeTaints(pod, nodeInfo, func(t *v1.Taint) bool { return podToleratesNodeTaints(pod, nodeInfo, func(t *v1.Taint) bool {
// PodToleratesNodeTaints is only interested in NoSchedule and NoExecute taints. // PodToleratesNodeTaints is only interested in NoSchedule and NoExecute taints.
return t.Effect == v1.TaintEffectNoSchedule || t.Effect == v1.TaintEffectNoExecute return t.Effect == v1.TaintEffectNoSchedule || t.Effect == v1.TaintEffectNoExecute