mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Avoid hard-coding list of Node Conditions
We assume that if a Condition isn't well-known, that it blocks scheduling of pods, and that the "unhealthy" value is api.ConditionTrue
This commit is contained in:
parent
c76fe8dcda
commit
511b2ecaa8
@ -507,15 +507,22 @@ func getNodeConditionPredicate() cache.NodeConditionPredicate {
|
|||||||
// - NodeReady condition status is ConditionTrue,
|
// - NodeReady condition status is ConditionTrue,
|
||||||
// - NodeOutOfDisk condition status is ConditionFalse,
|
// - NodeOutOfDisk condition status is ConditionFalse,
|
||||||
// - NodeNetworkUnavailable condition status is ConditionFalse.
|
// - NodeNetworkUnavailable condition status is ConditionFalse.
|
||||||
if cond.Type == api.NodeReady && cond.Status != api.ConditionTrue {
|
switch cond.Type {
|
||||||
glog.V(4).Infof("Ignoring node %v with %v condition status %v", node.Name, cond.Type, cond.Status)
|
case api.NodeReady:
|
||||||
return false
|
if cond.Status != api.ConditionTrue {
|
||||||
} else if cond.Type == api.NodeOutOfDisk && cond.Status != api.ConditionFalse {
|
glog.V(4).Infof("Ignoring node %v with %v condition status %v", node.Name, cond.Type, cond.Status)
|
||||||
glog.V(4).Infof("Ignoring node %v with %v condition status %v", node.Name, cond.Type, cond.Status)
|
return false
|
||||||
return false
|
}
|
||||||
} else if cond.Type == api.NodeNetworkUnavailable && cond.Status != api.ConditionFalse {
|
|
||||||
glog.V(4).Infof("Ignoring node %v with %v condition status %v", node.Name, cond.Type, cond.Status)
|
case api.NodeMemoryPressure, api.NodeDiskPressure:
|
||||||
return false
|
// We don't block on "pressure" conditions; these are warnings, not errors!
|
||||||
|
|
||||||
|
default:
|
||||||
|
// We assume everything else is blocking if the condition is True or Unknown
|
||||||
|
if cond.Status != api.ConditionFalse {
|
||||||
|
glog.V(4).Infof("Ignoring node %v with %v condition status %v", node.Name, cond.Type, cond.Status)
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Ignore nodes that are marked unschedulable
|
// Ignore nodes that are marked unschedulable
|
||||||
|
Loading…
Reference in New Issue
Block a user