mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 01:06:27 +00:00
Add support for writing out of tree custom scheduler plugins
This commit is contained in:
parent
8c3b7d7679
commit
ea8e1e01c5
@ -58,6 +58,8 @@ import (
|
|||||||
"k8s.io/klog"
|
"k8s.io/klog"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var frameworkRegistry = framework.NewRegistry()
|
||||||
|
|
||||||
// NewSchedulerCommand creates a *cobra.Command object with default parameters
|
// NewSchedulerCommand creates a *cobra.Command object with default parameters
|
||||||
func NewSchedulerCommand() *cobra.Command {
|
func NewSchedulerCommand() *cobra.Command {
|
||||||
opts, err := options.NewOptions()
|
opts, err := options.NewOptions()
|
||||||
@ -175,7 +177,7 @@ func Run(cc schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}) error
|
|||||||
cc.Recorder,
|
cc.Recorder,
|
||||||
cc.ComponentConfig.AlgorithmSource,
|
cc.ComponentConfig.AlgorithmSource,
|
||||||
stopCh,
|
stopCh,
|
||||||
framework.NewRegistry(),
|
frameworkRegistry,
|
||||||
cc.ComponentConfig.Plugins,
|
cc.ComponentConfig.Plugins,
|
||||||
cc.ComponentConfig.PluginConfig,
|
cc.ComponentConfig.PluginConfig,
|
||||||
scheduler.WithName(cc.ComponentConfig.SchedulerName),
|
scheduler.WithName(cc.ComponentConfig.SchedulerName),
|
||||||
@ -326,3 +328,9 @@ func newHealthzHandler(config *kubeschedulerconfig.KubeSchedulerConfiguration, s
|
|||||||
}
|
}
|
||||||
return pathRecorderMux
|
return pathRecorderMux
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RegisterFrameworkPlugin adds a new plugin to the registry. If a plugin with the same name
|
||||||
|
// exists, it returns an error.
|
||||||
|
func RegisterFrameworkPlugin(name string, factory framework.PluginFactory) error {
|
||||||
|
return frameworkRegistry.Register(name, factory)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user