Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute the Run function of kubelet, Remove invalid comments and remove run function #110691

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions cmd/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ package main
import (
"os"

"github.com/spf13/cobra"

"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/metrics/prometheus/restclient"
_ "k8s.io/component-base/metrics/prometheus/version" // for version metric registration
Expand All @@ -36,16 +33,6 @@ import (

func main() {
command := app.NewKubeletCommand()

// 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also eliminate the run function? It serves no purpose anymore.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And remove command.SetGlobalNormalizationFunc(cliflag.WordSepNormalizeFunc)?

That is done by cli.Run:

cmd.SetGlobalNormalizationFunc(cliflag.WordSepNormalizeFunc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated. could you please take a look again, thanks? @pohly

code := run(command)
code := cli.Run(command)
os.Exit(code)
}

func run(command *cobra.Command) int {
command.SetGlobalNormalizationFunc(cliflag.WordSepNormalizeFunc)
return cli.Run(command)
}