mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Merge pull request #125179 from SataQiu/clean-20240528
kubeadm: only add the klog flags that are still supported for kubeadm, rather than disabling the unwanted flags
This commit is contained in:
		@@ -30,24 +30,19 @@ import (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Run creates and executes new kubeadm command
 | 
					// Run creates and executes new kubeadm command
 | 
				
			||||||
func Run() error {
 | 
					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.SetNormalizeFunc(cliflag.WordSepNormalizeFunc)
 | 
				
			||||||
	pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
 | 
						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)
 | 
						cmd := cmd.NewKubeadmCommand(os.Stdin, os.Stdout, os.Stderr)
 | 
				
			||||||
	return cmd.Execute()
 | 
						return cmd.Execute()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user