Move users of factory.NewConfigFactory
to scheduler.New
This commit is contained in:
@@ -234,25 +234,6 @@ func initPolicyFromConfigMap(client clientset.Interface, policyRef *kubeschedule
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewFromConfigurator returns a new scheduler that is created entirely by the Configurator. Assumes Create() is implemented.
|
||||
// Supports intermediate Config mutation for now if you provide modifier functions which will run after Config is created.
|
||||
func NewFromConfigurator(c factory.Configurator, modifiers ...func(c *factory.Config)) (*Scheduler, error) {
|
||||
cfg, err := c.Create()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// Mutate it if any functions were provided, changes might be required for certain types of tests (i.e. change the recorder).
|
||||
for _, modifier := range modifiers {
|
||||
modifier(cfg)
|
||||
}
|
||||
// From this point on the config is immutable to the outside.
|
||||
s := &Scheduler{
|
||||
config: cfg,
|
||||
}
|
||||
metrics.Register()
|
||||
return s, nil
|
||||
}
|
||||
|
||||
// NewFromConfig returns a new scheduler using the provided Config.
|
||||
func NewFromConfig(config *factory.Config) *Scheduler {
|
||||
metrics.Register()
|
||||
|
Reference in New Issue
Block a user