Skip to content

Commit 5828223

Browse files
committed
Rename PluginOption to Option
1 parent 107e989 commit 5828223

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

cmd/kube-scheduler/app/server.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ import (
5858
"k8s.io/klog"
5959
)
6060

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
6363

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 {
6666
opts, err := options.NewOptions()
6767
if err != nil {
6868
klog.Fatalf("unable to initialize command options: %v", err)
@@ -78,7 +78,7 @@ constraints, affinity and anti-affinity specifications, data locality, inter-wor
7878
interference, deadlines, and so on. Workload-specific requirements will be exposed
7979
through the API as necessary.`,
8080
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 {
8282
fmt.Fprintf(os.Stderr, "%v\n", err)
8383
os.Exit(1)
8484
}
@@ -109,7 +109,7 @@ through the API as necessary.`,
109109
}
110110

111111
// 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 {
113113
verflag.PrintAndExitIfRequested()
114114
utilflag.PrintFlags(cmd.Flags())
115115

@@ -154,16 +154,16 @@ func runCommand(cmd *cobra.Command, args []string, opts *options.Options, plugin
154154
return fmt.Errorf("unable to register configz: %s", err)
155155
}
156156

157-
return Run(cc, stopCh, pluginOptions...)
157+
return Run(cc, stopCh, registryOptions...)
158158
}
159159

160160
// 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 {
162162
// To help debugging, immediately log version
163163
klog.V(1).Infof("Starting Kubernetes Scheduler version %+v", version.Get())
164164

165165
registry := framework.NewRegistry()
166-
for _, option := range pluginOptions {
166+
for _, option := range registryOptions {
167167
if err := option(registry); err != nil {
168168
return err
169169
}
@@ -336,8 +336,8 @@ func newHealthzHandler(config *kubeschedulerconfig.KubeSchedulerConfiguration, s
336336
return pathRecorderMux
337337
}
338338

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 {
341341
return func(registry framework.Registry) error {
342342
return registry.Register(name, factory)
343343
}

0 commit comments

Comments
 (0)