return error if got InsufficientResourceError and fit=true

This commit is contained in:
Hongchao Deng 2016-01-12 08:46:35 -08:00
parent 111b603c95
commit 252a956150

View File

@ -129,8 +129,12 @@ func findNodesThatFit(pod *api.Pod, machineToPods map[string][]*api.Pod, predica
for name, predicate := range predicateFuncs {
fit, err := predicate(pod, machineToPods[node.Name], node.Name)
if err != nil {
switch err.(type) {
switch e := err.(type) {
case *predicates.InsufficientResourceError:
if fit {
err := fmt.Errorf("got InsufficientResourceError: %v, but also fit='true' which is unexpected", e)
return api.NodeList{}, FailedPredicateMap{}, err
}
default:
return api.NodeList{}, FailedPredicateMap{}, err
}