code cleanup for kubectl port-forward

code cleanup for kubectl port-forward

code cleanup for kubectl port-forward

Kubernetes-commit: 555fa97cda1f24631642698e31c2b7b55c003cca
This commit is contained in:
xiongzhongliang 2020-12-27 00:49:18 +08:00 committed by Kubernetes Publisher
parent 73dbcbddc7
commit 7222c38716
1 changed files with 3 additions and 9 deletions

View File

@ -110,15 +110,9 @@ func NewCmdPortForward(f cmdutil.Factory, streams genericclioptions.IOStreams) *
Long: portforwardLong,
Example: portforwardExample,
Run: func(cmd *cobra.Command, args []string) {
if err := opts.Complete(f, cmd, args); err != nil {
cmdutil.CheckErr(err)
}
if err := opts.Validate(); err != nil {
cmdutil.CheckErr(cmdutil.UsageErrorf(cmd, "%v", err.Error()))
}
if err := opts.RunPortForward(); err != nil {
cmdutil.CheckErr(err)
}
cmdutil.CheckErr(opts.Complete(f, cmd, args))
cmdutil.CheckErr(opts.Validate())
cmdutil.CheckErr(opts.RunPortForward())
},
}
cmdutil.AddPodRunningTimeoutFlag(cmd, defaultPodPortForwardWaitTimeout)