@@ -58,11 +58,11 @@ import (
58
58
"k8s.io/klog"
59
59
)
60
60
61
- // PluginOption is an function type used for dealing with scheduler registry .
62
- type PluginOption func (framework.Registry ) error
61
+ // Option configures a framework.Registry .
62
+ type Option func (framework.Registry ) error
63
63
64
- // NewSchedulerCommand creates a *cobra.Command object with default parameters and pluginOptions
65
- func NewSchedulerCommand (pluginOptions ... PluginOption ) * cobra.Command {
64
+ // NewSchedulerCommand creates a *cobra.Command object with default parameters and registryOptions
65
+ func NewSchedulerCommand (registryOptions ... Option ) * cobra.Command {
66
66
opts , err := options .NewOptions ()
67
67
if err != nil {
68
68
klog .Fatalf ("unable to initialize command options: %v" , err )
@@ -78,7 +78,7 @@ constraints, affinity and anti-affinity specifications, data locality, inter-wor
78
78
interference, deadlines, and so on. Workload-specific requirements will be exposed
79
79
through the API as necessary.` ,
80
80
Run : func (cmd * cobra.Command , args []string ) {
81
- if err := runCommand (cmd , args , opts , pluginOptions ... ); err != nil {
81
+ if err := runCommand (cmd , args , opts , registryOptions ... ); err != nil {
82
82
fmt .Fprintf (os .Stderr , "%v\n " , err )
83
83
os .Exit (1 )
84
84
}
@@ -109,7 +109,7 @@ through the API as necessary.`,
109
109
}
110
110
111
111
// runCommand runs the scheduler.
112
- func runCommand (cmd * cobra.Command , args []string , opts * options.Options , pluginOptions ... PluginOption ) error {
112
+ func runCommand (cmd * cobra.Command , args []string , opts * options.Options , registryOptions ... Option ) error {
113
113
verflag .PrintAndExitIfRequested ()
114
114
utilflag .PrintFlags (cmd .Flags ())
115
115
@@ -154,16 +154,16 @@ func runCommand(cmd *cobra.Command, args []string, opts *options.Options, plugin
154
154
return fmt .Errorf ("unable to register configz: %s" , err )
155
155
}
156
156
157
- return Run (cc , stopCh , pluginOptions ... )
157
+ return Run (cc , stopCh , registryOptions ... )
158
158
}
159
159
160
160
// Run executes the scheduler based on the given configuration. It only return on error or when stopCh is closed.
161
- func Run (cc schedulerserverconfig.CompletedConfig , stopCh <- chan struct {}, pluginOptions ... PluginOption ) error {
161
+ func Run (cc schedulerserverconfig.CompletedConfig , stopCh <- chan struct {}, registryOptions ... Option ) error {
162
162
// To help debugging, immediately log version
163
163
klog .V (1 ).Infof ("Starting Kubernetes Scheduler version %+v" , version .Get ())
164
164
165
165
registry := framework .NewRegistry ()
166
- for _ , option := range pluginOptions {
166
+ for _ , option := range registryOptions {
167
167
if err := option (registry ); err != nil {
168
168
return err
169
169
}
@@ -336,8 +336,8 @@ func newHealthzHandler(config *kubeschedulerconfig.KubeSchedulerConfiguration, s
336
336
return pathRecorderMux
337
337
}
338
338
339
- // WithPlugin creates a PluginOption based on plugin name and factory.
340
- func WithPlugin (name string , factory framework.PluginFactory ) PluginOption {
339
+ // WithPlugin creates an Option based on plugin name and factory.
340
+ func WithPlugin (name string , factory framework.PluginFactory ) Option {
341
341
return func (registry framework.Registry ) error {
342
342
return registry .Register (name , factory )
343
343
}
0 commit comments