k8s.io/kubernetes@v1.31.0-alpha.0.0.20240520171757-56147500dadc/cmd/kubeadm/app/kubeadm.go (about) 1 /* 2 Copyright 2016 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package app 18 19 import ( 20 "flag" 21 "os" 22 23 "github.com/spf13/pflag" 24 25 cliflag "k8s.io/component-base/cli/flag" 26 "k8s.io/klog/v2" 27 28 "k8s.io/kubernetes/cmd/kubeadm/app/cmd" 29 ) 30 31 // Run creates and executes new kubeadm command 32 func Run() error { 33 klog.InitFlags(nil) 34 pflag.CommandLine.SetNormalizeFunc(cliflag.WordSepNormalizeFunc) 35 pflag.CommandLine.AddGoFlagSet(flag.CommandLine) 36 37 pflag.Set("logtostderr", "true") 38 // We do not want these flags to show up in --help 39 // These MarkHidden calls must be after the lines above 40 pflag.CommandLine.MarkHidden("alsologtostderr") 41 pflag.CommandLine.MarkHidden("log-backtrace-at") 42 pflag.CommandLine.MarkHidden("log-dir") 43 pflag.CommandLine.MarkHidden("logtostderr") 44 pflag.CommandLine.MarkHidden("log-file") //nolint:errcheck 45 pflag.CommandLine.MarkHidden("log-file-max-size") //nolint:errcheck 46 pflag.CommandLine.MarkHidden("one-output") //nolint:errcheck 47 pflag.CommandLine.MarkHidden("skip-log-headers") //nolint:errcheck 48 pflag.CommandLine.MarkHidden("stderrthreshold") 49 pflag.CommandLine.MarkHidden("vmodule") 50 51 cmd := cmd.NewKubeadmCommand(os.Stdin, os.Stdout, os.Stderr) 52 return cmd.Execute() 53 }