Commit c51a89bc authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #30440 from sttts/sttts-fix-kubectl-logtostderr

Automatic merge from submit-queue Fix glog's --v in kubectl With https://github.com/kubernetes/kubernetes/pull/29147 kubectl lost its glog output to stderr because the `init()` func did not run anymore which had set `logtostderr` to true before. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30440) <!-- Reviewable:end -->
parents 613a2aa7 e07e65d4
...@@ -21,6 +21,7 @@ import ( ...@@ -21,6 +21,7 @@ import (
"k8s.io/kubernetes/pkg/kubectl/cmd" "k8s.io/kubernetes/pkg/kubectl/cmd"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/util/logs"
) )
/* /*
...@@ -28,6 +29,9 @@ WARNING: this logic is duplicated, with minor changes, in cmd/hyperkube/kubectl. ...@@ -28,6 +29,9 @@ WARNING: this logic is duplicated, with minor changes, in cmd/hyperkube/kubectl.
Any salient changes here will need to be manually reflected in that file. Any salient changes here will need to be manually reflected in that file.
*/ */
func Run() error { func Run() error {
logs.InitLogs()
defer logs.FlushLogs()
cmd := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, os.Stdout, os.Stderr) cmd := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, os.Stdout, os.Stderr)
return cmd.Execute() return cmd.Execute()
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment