mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 22:46:12 +00:00
kubeadm: only add the klog flags that are still supported for kubeadm, rather than disabling the unwanted flags
This commit is contained in:
parent
f4ea903712
commit
7f30b3494b
@ -30,24 +30,19 @@ import (
|
||||
|
||||
// Run creates and executes new kubeadm command
|
||||
func Run() error {
|
||||
klog.InitFlags(nil)
|
||||
var allFlags flag.FlagSet
|
||||
klog.InitFlags(&allFlags)
|
||||
// only add the flags that are still supported for kubeadm
|
||||
allFlags.VisitAll(func(f *flag.Flag) {
|
||||
switch f.Name {
|
||||
case "v", "add_dir_header", "skip_headers":
|
||||
flag.CommandLine.Var(f.Value, f.Name, f.Usage)
|
||||
}
|
||||
})
|
||||
|
||||
pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
|
||||
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
||||
|
||||
pflag.Set("logtostderr", "true")
|
||||
// We do not want these flags to show up in --help
|
||||
// These MarkHidden calls must be after the lines above
|
||||
pflag.CommandLine.MarkHidden("alsologtostderr")
|
||||
pflag.CommandLine.MarkHidden("log-backtrace-at")
|
||||
pflag.CommandLine.MarkHidden("log-dir")
|
||||
pflag.CommandLine.MarkHidden("logtostderr")
|
||||
pflag.CommandLine.MarkHidden("log-file") //nolint:errcheck
|
||||
pflag.CommandLine.MarkHidden("log-file-max-size") //nolint:errcheck
|
||||
pflag.CommandLine.MarkHidden("one-output") //nolint:errcheck
|
||||
pflag.CommandLine.MarkHidden("skip-log-headers") //nolint:errcheck
|
||||
pflag.CommandLine.MarkHidden("stderrthreshold")
|
||||
pflag.CommandLine.MarkHidden("vmodule")
|
||||
|
||||
cmd := cmd.NewKubeadmCommand(os.Stdin, os.Stdout, os.Stderr)
|
||||
return cmd.Execute()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user