Merge pull request #84812 from alculquicondor/fix/write-config

Write scheduler configuration from config file
This commit is contained in:
Kubernetes Prow Robot 2019-11-06 12:20:58 -08:00 committed by GitHub
commit e6287b05c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,22 +123,24 @@ func runCommand(cmd *cobra.Command, args []string, opts *options.Options, regist
}
if errs := opts.Validate(); len(errs) > 0 {
fmt.Fprintf(os.Stderr, "%v\n", utilerrors.NewAggregate(errs))
os.Exit(1)
return utilerrors.NewAggregate(errs)
}
if len(opts.WriteConfigTo) > 0 {
if err := options.WriteConfigFile(opts.WriteConfigTo, &opts.ComponentConfig); err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
c := &schedulerserverconfig.Config{}
if err := opts.ApplyTo(c); err != nil {
return err
}
if err := options.WriteConfigFile(opts.WriteConfigTo, &c.ComponentConfig); err != nil {
return err
}
klog.Infof("Wrote configuration to: %s\n", opts.WriteConfigTo)
return nil
}
c, err := opts.Config()
if err != nil {
fmt.Fprintf(os.Stderr, "%v\n", err)
os.Exit(1)
return err
}
// Get the completed config