Merge pull request #100877 from lojies/schedulerlogstructured

Structured Logging migration: modify logs of kube-scheduler
This commit is contained in:
Kubernetes Prow Robot 2021-04-10 19:04:45 -07:00 committed by GitHub
commit 89056f66c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ func LogOrWriteConfig(fileName string, cfg *kubeschedulerconfig.KubeSchedulerCon
return err
}
configString := string(bytes)
klog.Infof("Using component config:\n%+v\n", configString)
klog.InfoS("Using component config", "config", configString)
}
if len(fileName) > 0 {
@ -81,7 +81,7 @@ func LogOrWriteConfig(fileName string, cfg *kubeschedulerconfig.KubeSchedulerCon
if err := encoder.Encode(cfg, configFile); err != nil {
return err
}
klog.Infof("Wrote configuration to: %s\n", fileName)
klog.InfoS("Wrote configuration", "file", fileName)
os.Exit(0)
}
return nil

View File

@ -135,7 +135,7 @@ func runCommand(cmd *cobra.Command, opts *options.Options, registryOptions ...Op
// Run executes the scheduler based on the given configuration. It only returns on error or when context is done.
func Run(ctx context.Context, cc *schedulerserverconfig.CompletedConfig, sched *scheduler.Scheduler) error {
// To help debugging, immediately log version
klog.V(1).Infof("Starting Kubernetes Scheduler version %+v", version.Get())
klog.V(1).InfoS("Starting Kubernetes Scheduler version", "version", version.Get())
// Configz registration.
if cz, err := configz.New("componentconfig"); err == nil {