mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 20:17:41 +00:00
Clean up unnecessary else block and redundant variable assignment
This PR removes an unnecessary else block and eliminates a redundant variable assignment to improve code readability.
This commit is contained in:
parent
f5c5384181
commit
52e24a02ef
@ -133,13 +133,12 @@ for more information about scheduling and the kube-scheduler component.`,
|
||||
// runCommand runs the scheduler.
|
||||
func runCommand(cmd *cobra.Command, opts *options.Options, registryOptions ...Option) error {
|
||||
verflag.PrintAndExitIfRequested()
|
||||
fg := opts.ComponentGlobalsRegistry.FeatureGateFor(utilversion.DefaultKubeComponent)
|
||||
// Activate logging as soon as possible, after that
|
||||
// show flags with the final logging configuration.
|
||||
if err := logsapi.ValidateAndApply(opts.Logs, fg); err != nil {
|
||||
if err := logsapi.ValidateAndApply(opts.Logs, opts.ComponentGlobalsRegistry.FeatureGateFor(utilversion.DefaultKubeComponent)); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
cliflag.PrintFlags(cmd.Flags())
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
@ -169,11 +168,12 @@ func Run(ctx context.Context, cc *schedulerserverconfig.CompletedConfig, sched *
|
||||
logger.Info("Golang settings", "GOGC", os.Getenv("GOGC"), "GOMAXPROCS", os.Getenv("GOMAXPROCS"), "GOTRACEBACK", os.Getenv("GOTRACEBACK"))
|
||||
|
||||
// Configz registration.
|
||||
if cz, err := configz.New("componentconfig"); err == nil {
|
||||
cz.Set(cc.ComponentConfig)
|
||||
} else {
|
||||
cz, err := configz.New("componentconfig")
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to register configz: %s", err)
|
||||
}
|
||||
cz.Set(cc.ComponentConfig)
|
||||
|
||||
|
||||
// Start events processing pipeline.
|
||||
cc.EventBroadcaster.StartRecordingToSink(ctx.Done())
|
||||
|
Loading…
Reference in New Issue
Block a user