Merge pull request #110691 from yangjunmyfm192085/fixlogprint

Execute the Run function of kubelet, Remove invalid comments and remove run function
This commit is contained in:
Kubernetes Prow Robot 2022-07-05 11:27:19 -07:00 committed by GitHub
commit fe1d3fe637
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,10 +24,7 @@ package main
import ( import (
"os" "os"
"github.com/spf13/cobra"
"k8s.io/component-base/cli" "k8s.io/component-base/cli"
cliflag "k8s.io/component-base/cli/flag"
_ "k8s.io/component-base/logs/json/register" // for JSON log format registration _ "k8s.io/component-base/logs/json/register" // for JSON log format registration
_ "k8s.io/component-base/metrics/prometheus/restclient" _ "k8s.io/component-base/metrics/prometheus/restclient"
_ "k8s.io/component-base/metrics/prometheus/version" // for version metric registration _ "k8s.io/component-base/metrics/prometheus/version" // for version metric registration
@ -36,16 +33,6 @@ import (
func main() { func main() {
command := app.NewKubeletCommand() command := app.NewKubeletCommand()
code := cli.Run(command)
// kubelet uses a config file and does its own special
// parsing of flags and that config file. It initializes
// logging after it is done with that. Therefore it does
// not use cli.Run like other, simpler commands.
code := run(command)
os.Exit(code) os.Exit(code)
} }
func run(command *cobra.Command) int {
command.SetGlobalNormalizationFunc(cliflag.WordSepNormalizeFunc)
return cli.Run(command)
}