diff --git a/pkg/scheduler/framework/interface.go b/pkg/scheduler/framework/interface.go index 456e2838d6b..65a115dc0d1 100644 --- a/pkg/scheduler/framework/interface.go +++ b/pkg/scheduler/framework/interface.go @@ -95,12 +95,13 @@ const ( Unschedulable // UnschedulableAndUnresolvable is used when a plugin finds a pod unschedulable and // other postFilter plugins like preemption would not change anything. + // See the comment on PostFilter interface for more details about how PostFilter should handle this status. // Plugins should return Unschedulable if it is possible that the pod can get scheduled // after running other postFilter plugins. // The accompanying status message should explain why the pod is unschedulable. // // We regard the backoff as a penalty of wasting the scheduling cycle. - // When the scheduling queue requeues Pods, which was rejected with Unschedulable in the last scheduling, + // When the scheduling queue requeues Pods, which was rejected with UnschedulableAndUnresolvable in the last scheduling, // the Pod goes through backoff. UnschedulableAndUnresolvable // Wait is used when a Permit plugin finds a pod scheduling should wait. @@ -438,7 +439,17 @@ type FilterPlugin interface { // after a pod cannot be scheduled. type PostFilterPlugin interface { Plugin - // PostFilter is called by the scheduling framework. + // PostFilter is called by the scheduling framework + // when the scheduling cycle failed at PreFilter or Filter by Unschedulable or UnschedulableAndUnresolvable. + // NodeToStatusMap has statuses that each Node got in the Filter phase. + // If this scheduling cycle failed at PreFilter, all Nodes have the status from the rejector PreFilter plugin in NodeToStatusMap. + // Note that the scheduling framework runs PostFilter plugins even when PreFilter returned UnschedulableAndUnresolvable. + // In that case, NodeToStatusMap contains all Nodes with UnschedulableAndUnresolvable. + // + // Also, ignoring Nodes with UnschedulableAndUnresolvable is the responsibility of each PostFilter plugin, + // meaning NodeToStatusMap obviously could have Nodes with UnschedulableAndUnresolvable + // and the scheduling framework does call PostFilter even when all Nodes in NodeToStatusMap are UnschedulableAndUnresolvable. + // // A PostFilter plugin should return one of the following statuses: // - Unschedulable: the plugin gets executed successfully but the pod cannot be made schedulable. // - Success: the plugin gets executed successfully and the pod can be made schedulable.