Return all predicate failures instead of the first one

This commit is contained in:
Wei Huang
2019-12-06 15:48:05 -08:00
parent 2fbe432d23
commit a136108d2b
8 changed files with 291 additions and 94 deletions

View File

@@ -41,12 +41,17 @@ func PredicateResultToFrameworkStatus(reasons []predicates.PredicateFailureReaso
return nil
}
if r := predicates.UnresolvablePredicateExists(reasons); r != nil {
return framework.NewStatus(framework.UnschedulableAndUnresolvable, r.GetReason())
code := framework.Unschedulable
if predicates.UnresolvablePredicateExists(reasons) {
code = framework.UnschedulableAndUnresolvable
}
// We will just use the first reason.
return framework.NewStatus(framework.Unschedulable, reasons[0].GetReason())
// We will keep all failure reasons.
var failureReasons []string
for _, reason := range reasons {
failureReasons = append(failureReasons, reason.GetReason())
}
return framework.NewStatus(code, failureReasons...)
}
// ErrorToFrameworkStatus converts an error to a framework status.