|
|
|
@@ -24,8 +24,8 @@ import (
|
|
|
|
|
|
|
|
|
|
v1 "k8s.io/api/core/v1"
|
|
|
|
|
"k8s.io/apimachinery/pkg/runtime"
|
|
|
|
|
"k8s.io/kubernetes/pkg/scheduler/framework"
|
|
|
|
|
frameworkruntime "k8s.io/kubernetes/pkg/scheduler/framework/runtime"
|
|
|
|
|
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// ErrReasonFake is a fake error message denotes the filter function errored.
|
|
|
|
@@ -45,7 +45,7 @@ func (pl *FalseFilterPlugin) Filter(_ context.Context, _ *framework.CycleState,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewFalseFilterPlugin initializes a FalseFilterPlugin and returns it.
|
|
|
|
|
func NewFalseFilterPlugin(_ runtime.Object, _ framework.FrameworkHandle) (framework.Plugin, error) {
|
|
|
|
|
func NewFalseFilterPlugin(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
|
|
|
|
|
return &FalseFilterPlugin{}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -63,7 +63,7 @@ func (pl *TrueFilterPlugin) Filter(_ context.Context, _ *framework.CycleState, p
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewTrueFilterPlugin initializes a TrueFilterPlugin and returns it.
|
|
|
|
|
func NewTrueFilterPlugin(_ runtime.Object, _ framework.FrameworkHandle) (framework.Plugin, error) {
|
|
|
|
|
func NewTrueFilterPlugin(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
|
|
|
|
|
return &TrueFilterPlugin{}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -92,7 +92,7 @@ func (pl *FakeFilterPlugin) Filter(_ context.Context, _ *framework.CycleState, p
|
|
|
|
|
|
|
|
|
|
// NewFakeFilterPlugin initializes a fakeFilterPlugin and returns it.
|
|
|
|
|
func NewFakeFilterPlugin(failedNodeReturnCodeMap map[string]framework.Code) frameworkruntime.PluginFactory {
|
|
|
|
|
return func(_ runtime.Object, _ framework.FrameworkHandle) (framework.Plugin, error) {
|
|
|
|
|
return func(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
|
|
|
|
|
return &FakeFilterPlugin{
|
|
|
|
|
FailedNodeReturnCodeMap: failedNodeReturnCodeMap,
|
|
|
|
|
}, nil
|
|
|
|
@@ -121,7 +121,7 @@ func (pl *MatchFilterPlugin) Filter(_ context.Context, _ *framework.CycleState,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewMatchFilterPlugin initializes a MatchFilterPlugin and returns it.
|
|
|
|
|
func NewMatchFilterPlugin(_ runtime.Object, _ framework.FrameworkHandle) (framework.Plugin, error) {
|
|
|
|
|
func NewMatchFilterPlugin(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
|
|
|
|
|
return &MatchFilterPlugin{}, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -147,7 +147,7 @@ func (pl *FakePreFilterPlugin) PreFilterExtensions() framework.PreFilterExtensio
|
|
|
|
|
|
|
|
|
|
// NewFakePreFilterPlugin initializes a fakePreFilterPlugin and returns it.
|
|
|
|
|
func NewFakePreFilterPlugin(status *framework.Status) frameworkruntime.PluginFactory {
|
|
|
|
|
return func(_ runtime.Object, _ framework.FrameworkHandle) (framework.Plugin, error) {
|
|
|
|
|
return func(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
|
|
|
|
|
return &FakePreFilterPlugin{
|
|
|
|
|
Status: status,
|
|
|
|
|
}, nil
|
|
|
|
@@ -175,7 +175,7 @@ func (pl *FakeReservePlugin) Unreserve(_ context.Context, _ *framework.CycleStat
|
|
|
|
|
|
|
|
|
|
// NewFakeReservePlugin initializes a fakeReservePlugin and returns it.
|
|
|
|
|
func NewFakeReservePlugin(status *framework.Status) frameworkruntime.PluginFactory {
|
|
|
|
|
return func(_ runtime.Object, _ framework.FrameworkHandle) (framework.Plugin, error) {
|
|
|
|
|
return func(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
|
|
|
|
|
return &FakeReservePlugin{
|
|
|
|
|
Status: status,
|
|
|
|
|
}, nil
|
|
|
|
@@ -199,7 +199,7 @@ func (pl *FakePreBindPlugin) PreBind(_ context.Context, _ *framework.CycleState,
|
|
|
|
|
|
|
|
|
|
// NewFakePreBindPlugin initializes a fakePreBindPlugin and returns it.
|
|
|
|
|
func NewFakePreBindPlugin(status *framework.Status) frameworkruntime.PluginFactory {
|
|
|
|
|
return func(_ runtime.Object, _ framework.FrameworkHandle) (framework.Plugin, error) {
|
|
|
|
|
return func(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
|
|
|
|
|
return &FakePreBindPlugin{
|
|
|
|
|
Status: status,
|
|
|
|
|
}, nil
|
|
|
|
@@ -224,7 +224,7 @@ func (pl *FakePermitPlugin) Permit(_ context.Context, _ *framework.CycleState, _
|
|
|
|
|
|
|
|
|
|
// NewFakePermitPlugin initializes a fakePermitPlugin and returns it.
|
|
|
|
|
func NewFakePermitPlugin(status *framework.Status, timeout time.Duration) frameworkruntime.PluginFactory {
|
|
|
|
|
return func(_ runtime.Object, _ framework.FrameworkHandle) (framework.Plugin, error) {
|
|
|
|
|
return func(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
|
|
|
|
|
return &FakePermitPlugin{
|
|
|
|
|
Status: status,
|
|
|
|
|
Timeout: timeout,
|
|
|
|
|