Repository: kubernetes/kubernetes
File: pkg/scheduler/framework/interface.go (Go)

Code before:

	// HasPostFilterPlugins returns true if at least one PostFilter plugin is defined.
	HasPostFilterPlugins() bool

	// HasScorePlugins returns true if at least one Score plugin is defined.
	HasScorePlugins() bool

	// ListPlugins returns a map of extension point name to list of configured Plugins.
	ListPlugins() *config.Plugins

	// PercentageOfNodesToScore returns percentageOfNodesToScore associated to a profile.
	PercentageOfNodesToScore() *int32

	// SetPodNominator sets the PodNominator
	SetPodNominator(nominator fwk.PodNominator)
	// SetPodActivator sets the PodActivator
	SetPodActivator(activator fwk.PodActivator)
	// SetAPICacher sets the APICacher
	SetAPICacher(apiCacher fwk.APICacher)

	// Close calls Close method of each plugin.
	Close() error
}

// NewPostFilterResult creates PostFilterResult with a provided nominated node
// and a list of victims that need to be preempted to make the pod schedulable.
func NewPostFilterResult(nodeName string, victims []*v1.Pod) *fwk.PostFilterResult {
	return &fwk.PostFilterResult{
		NominatingInfo: &fwk.NominatingInfo{
			NominatedNodeName: nodeName,
			NominatingMode:    fwk.ModeOverride,
		},
		Victims: victims,
	}
}

// NewPostFilterResultWithNominatedNode creates PostFilterResult with a provided
// nominated node. The list of victims is set to nil.
// This function is preserved for backward compatibility - PostFilter plugins
// should use the NewPostFilterResult function instead, however.
func NewPostFilterResultWithNominatedNode(nodeName string) *fwk.PostFilterResult {
	return NewPostFilterResult(nodeName, nil)
}


Review comment (suggestion):
```suggestion
// and a list of victims (if any) that need to be preempted to make the pod schedulable.
```

Code after:
	// binding, it should return code=5("skip") status. Otherwise, it should return "Error"
	// or "Success". If none of the plugins handled binding, RunBindPlugins returns
	// code=5("skip") status.
	RunBindPlugins(ctx context.Context, state fwk.CycleState, pod *v1.Pod, nodeName string) *fwk.Status

	// HasFilterPlugins returns true if at least one Filter plugin is defined.
	HasFilterPlugins() bool

	// HasPostFilterPlugins returns true if at least one PostFilter plugin is defined.
	HasPostFilterPlugins() bool

	// HasScorePlugins returns true if at least one Score plugin is defined.
	HasScorePlugins() bool

	// ListPlugins returns a map of extension point name to list of configured Plugins.
	ListPlugins() *config.Plugins

	// PercentageOfNodesToScore returns percentageOfNodesToScore associated to a profile.
	PercentageOfNodesToScore() *int32

	// SetPodNominator sets the PodNominator
	SetPodNominator(nominator fwk.PodNominator)
	// SetPodActivator sets the PodActivator
	SetPodActivator(activator fwk.PodActivator)
	// SetAPICacher sets the APICacher
	SetAPICacher(apiCacher fwk.APICacher)

	// Close calls Close method of each plugin.
	Close() error
}

// NewPostFilterResult creates PostFilterResult with a provided nominated node
// and a list of victims (if any) that need to be preempted to make the pod schedulable.
func NewPostFilterResult(nodeName string, victims []*v1.Pod) *fwk.PostFilterResult {
	return &fwk.PostFilterResult{
		NominatingInfo: &fwk.NominatingInfo{
			NominatedNodeName: nodeName,
			NominatingMode:    fwk.ModeOverride,
		},
		Victims: victims,
	}
}

// Deprecated: use NewPostFilterResult instead, even if no victims were identified.
// Deprecated in Kubernetes 1.36 and will be removed in 1.38.
func NewPostFilterResultWithNominatedNode(nodeName string) *fwk.PostFilterResult {
	return NewPostFilterResult(nodeName, nil)
}