mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-12 21:40:29 +00:00
[Framework] Add UnschedulableAndUnresolvable status code
The status can be used by (Pre)Filter plugins to indicate that preemption wouldn't change the decision of the filter. Signed-off-by: Aldo Culquicondor <acondor@google.com>
This commit is contained in:
@@ -53,9 +53,16 @@ const (
|
||||
Success Code = iota
|
||||
// Error is used for internal plugin errors, unexpected input, etc.
|
||||
Error
|
||||
// Unschedulable is used when a plugin finds a pod unschedulable.
|
||||
// Unschedulable is used when a plugin finds a pod unschedulable. The scheduler might attempt to
|
||||
// preempt other pods to get this pod scheduled. Use UnschedulableAndUnresolvable to make the
|
||||
// scheduler skip preemption.
|
||||
// The accompanying status message should explain why the pod is unschedulable.
|
||||
Unschedulable
|
||||
// UnschedulableAndUnresolvable is used when a (pre-)filter plugin finds a pod unschedulable and
|
||||
// preemption would not change anything. Plugins should return Unschedulable if it is possible
|
||||
// that the pod can get scheduled with preemption.
|
||||
// The accompanying status message should explain why the pod is unschedulable.
|
||||
UnschedulableAndUnresolvable
|
||||
// Wait is used when a permit plugin finds a pod scheduling should wait.
|
||||
Wait
|
||||
// Skip is used when a bind plugin chooses to skip binding.
|
||||
@@ -100,6 +107,12 @@ func (s *Status) IsSuccess() bool {
|
||||
return s.Code() == Success
|
||||
}
|
||||
|
||||
// IsUnschedulable returns true if "Status" is Unschedulable (Unschedulable or UnschedulableAndUnresolvable).
|
||||
func (s *Status) IsUnschedulable() bool {
|
||||
code := s.Code()
|
||||
return code == Unschedulable || code == UnschedulableAndUnresolvable
|
||||
}
|
||||
|
||||
// AsError returns an "error" object with the same message as that of the Status.
|
||||
func (s *Status) AsError() error {
|
||||
if s.IsSuccess() {
|
||||
|
||||
Reference in New Issue
Block a user