Merge pull request #50617 from irfanurrehman/kubefed-doc-fix

Automatic merge from submit-queue (batch tested with PRs 50302, 50573, 50500, 50633, 50617)

[Federation] Kubefed doc fix

Fixes https://github.com/kubernetes/kubernetes/issues/50615
@kubernetes/sig-federation-bugs 
@madhusudancs, would it be of any reason to have separate code for kubefed for the version and options subcommands (rather then using ```kubectl.NewCmdVersion()``` and ```kubectl.NewCmdOptions```). I dont see the need, but I might be missing something. 

**What this PR does / why we need it**:
Fixes https://github.com/kubernetes/kubernetes/issues/50615

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:

```NONE
```
pull/6/head
Kubernetes Submit Queue 2017-08-14 20:42:25 -07:00 committed by GitHub
commit b28b2deed2
2 changed files with 17 additions and 2 deletions

View File

@ -28,6 +28,7 @@ go_library(
"//pkg/kubectl/cmd/templates:go_default_library", "//pkg/kubectl/cmd/templates:go_default_library",
"//pkg/kubectl/cmd/util:go_default_library", "//pkg/kubectl/cmd/util:go_default_library",
"//pkg/kubectl/resource:go_default_library", "//pkg/kubectl/resource:go_default_library",
"//pkg/util/i18n:go_default_library",
"//vendor/github.com/golang/glog:go_default_library", "//vendor/github.com/golang/glog:go_default_library",
"//vendor/github.com/spf13/cobra:go_default_library", "//vendor/github.com/spf13/cobra:go_default_library",
"//vendor/github.com/spf13/pflag:go_default_library", "//vendor/github.com/spf13/pflag:go_default_library",

View File

@ -26,10 +26,20 @@ import (
kubectl "k8s.io/kubernetes/pkg/kubectl/cmd" kubectl "k8s.io/kubernetes/pkg/kubectl/cmd"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates" "k8s.io/kubernetes/pkg/kubectl/cmd/templates"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/util/i18n"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var (
kubefedVersionExample = templates.Examples(i18n.T(`
# Print the client and server versions for the current context
kubefed version`))
kubefedOptionsExample = templates.Examples(i18n.T(`
# Print flags inherited by all commands
kubefed options`))
)
// NewKubeFedCommand creates the `kubefed` command and its nested children. // NewKubeFedCommand creates the `kubefed` command and its nested children.
func NewKubeFedCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer, defaultServerImage, defaultEtcdImage string) *cobra.Command { func NewKubeFedCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer, defaultServerImage, defaultEtcdImage string) *cobra.Command {
// Parent command to which all subcommands are added. // Parent command to which all subcommands are added.
@ -66,8 +76,12 @@ func NewKubeFedCommand(f cmdutil.Factory, in io.Reader, out, err io.Writer, defa
} }
templates.ActsAsRootCommand(cmds, filters, groups...) templates.ActsAsRootCommand(cmds, filters, groups...)
cmds.AddCommand(kubectl.NewCmdVersion(f, out)) cmdVersion := kubectl.NewCmdVersion(f, out)
cmds.AddCommand(kubectl.NewCmdOptions(out)) cmdVersion.Example = kubefedVersionExample
cmds.AddCommand(cmdVersion)
cmdOptions := kubectl.NewCmdOptions(out)
cmdOptions.Example = kubefedOptionsExample
cmds.AddCommand(cmdOptions)
return cmds return cmds
} }