Split scheduler framework implementation into new runtime package

This commit is contained in:
Ali Farah
2020-06-19 19:05:45 +10:00
parent e24a42f07b
commit a22e115a0e
58 changed files with 663 additions and 562 deletions

View File

@@ -16,7 +16,7 @@ go_library(
"//pkg/api/legacyscheme:go_default_library",
"//pkg/scheduler:go_default_library",
"//pkg/scheduler/apis/config:go_default_library",
"//pkg/scheduler/framework/v1alpha1:go_default_library",
"//pkg/scheduler/framework/runtime:go_default_library",
"//pkg/scheduler/metrics:go_default_library",
"//pkg/scheduler/profile:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",

View File

@@ -57,13 +57,13 @@ import (
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/scheduler"
kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config"
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
"k8s.io/kubernetes/pkg/scheduler/framework/runtime"
"k8s.io/kubernetes/pkg/scheduler/metrics"
"k8s.io/kubernetes/pkg/scheduler/profile"
)
// Option configures a framework.Registry.
type Option func(framework.Registry) error
type Option func(runtime.Registry) error
// NewSchedulerCommand creates a *cobra.Command object with default parameters and registryOptions
func NewSchedulerCommand(registryOptions ...Option) *cobra.Command {
@@ -299,8 +299,8 @@ func getRecorderFactory(cc *schedulerserverconfig.CompletedConfig) profile.Recor
// WithPlugin creates an Option based on plugin name and factory. Please don't remove this function: it is used to register out-of-tree plugins,
// hence there are no references to it from the kubernetes scheduler code base.
func WithPlugin(name string, factory framework.PluginFactory) Option {
return func(registry framework.Registry) error {
func WithPlugin(name string, factory runtime.PluginFactory) Option {
return func(registry runtime.Registry) error {
return registry.Register(name, factory)
}
}
@@ -319,7 +319,7 @@ func Setup(ctx context.Context, opts *options.Options, outOfTreeRegistryOptions
// Get the completed config
cc := c.Complete()
outOfTreeRegistry := make(framework.Registry)
outOfTreeRegistry := make(runtime.Registry)
for _, option := range outOfTreeRegistryOptions {
if err := option(outOfTreeRegistry); err != nil {
return nil, nil, err