Move scheduler interface to pkg/scheduler/framework

This commit is contained in:
Ali
2020-10-10 01:41:44 +11:00
parent 1dff024e64
commit 09b2e8f638
142 changed files with 1450 additions and 1362 deletions

View File

@@ -14,8 +14,8 @@ go_library(
importpath = "k8s.io/kubernetes/pkg/scheduler/testing",
deps = [
"//pkg/scheduler/apis/config:go_default_library",
"//pkg/scheduler/framework:go_default_library",
"//pkg/scheduler/framework/runtime:go_default_library",
"//pkg/scheduler/framework/v1alpha1:go_default_library",
"//pkg/scheduler/util:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/resource:go_default_library",

View File

@@ -25,8 +25,8 @@ import (
"k8s.io/apimachinery/pkg/runtime"
corev1helpers "k8s.io/component-helpers/scheduling/corev1"
extenderv1 "k8s.io/kube-scheduler/extender/v1"
"k8s.io/kubernetes/pkg/scheduler/framework"
frameworkruntime "k8s.io/kubernetes/pkg/scheduler/framework/runtime"
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
"k8s.io/kubernetes/pkg/scheduler/util"
)
@@ -112,7 +112,7 @@ type node2PrioritizerPlugin struct{}
// NewNode2PrioritizerPlugin returns a factory function to build node2PrioritizerPlugin.
func NewNode2PrioritizerPlugin() frameworkruntime.PluginFactory {
return func(_ runtime.Object, _ framework.FrameworkHandle) (framework.Plugin, error) {
return func(_ runtime.Object, _ framework.Handle) (framework.Plugin, error) {
return &node2PrioritizerPlugin{}, nil
}
}

View File

@@ -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,

View File

@@ -18,8 +18,8 @@ package testing
import (
schedulerapi "k8s.io/kubernetes/pkg/scheduler/apis/config"
"k8s.io/kubernetes/pkg/scheduler/framework"
"k8s.io/kubernetes/pkg/scheduler/framework/runtime"
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
)
// NewFramework creates a Framework from the register functions and options.