Merge pull request #43443 from irfanurrehman/kubefed-doc-1

Automatic merge from submit-queue (batch tested with PRs 43443, 46193, 49071, 47252)

[Federation][Kubefed] Support reference document autogeneration for kubefed

This PR is needed to address the documentation issue https://github.com/kubernetes/kubernetes.github.io/issues/2888

Apart from the code auto generation have updated some descriptions for consistency.

**Special notes for your reviewer**:
@kubernetes/sig-federation-misc 
cc @madhusudancs @csbell  

**Release note**:

```NONE
```
pull/6/head
Kubernetes Submit Queue 2017-07-25 21:52:45 -07:00 committed by GitHub
commit 66a1ae38ea
15 changed files with 48 additions and 9 deletions

View File

@ -60,6 +60,7 @@ package_group(
package_group(
name = "FEDERATION_BAD",
packages = [
"//federation/cmd/genfeddocs",
"//federation/cmd/kubefed/app",
"//federation/pkg/kubefed",
"//federation/pkg/kubefed/init",

View File

@ -6,6 +6,12 @@ docs/admin/kube-apiserver.md
docs/admin/kube-controller-manager.md
docs/admin/kube-proxy.md
docs/admin/kube-scheduler.md
docs/admin/kubefed.md
docs/admin/kubefed_init.md
docs/admin/kubefed_join.md
docs/admin/kubefed_options.md
docs/admin/kubefed_unjoin.md
docs/admin/kubefed_version.md
docs/admin/kubelet.md
docs/man/man1/cloud-controller-manager.1
docs/man/man1/kube-apiserver.1

3
docs/admin/kubefed.md Normal file
View File

@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.

View File

@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.

View File

@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.

View File

@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.

View File

@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.

View File

@ -0,0 +1,3 @@
This file is autogenerated, but we've stopped checking such files into the
repository to reduce the need for rebases. Please run hack/generate-docs.sh to
populate this file.

View File

@ -22,6 +22,9 @@ go_library(
"//cmd/genutils:go_default_library",
"//federation/cmd/federation-apiserver/app:go_default_library",
"//federation/cmd/federation-controller-manager/app:go_default_library",
"//federation/cmd/kubefed/app:go_default_library",
"//federation/pkg/kubefed:go_default_library",
"//pkg/kubectl/cmd/util:go_default_library",
"//vendor/github.com/spf13/cobra/doc:go_default_library",
],
)

View File

@ -24,6 +24,9 @@ import (
"k8s.io/kubernetes/cmd/genutils"
fedapiservapp "k8s.io/kubernetes/federation/cmd/federation-apiserver/app"
fedcmapp "k8s.io/kubernetes/federation/cmd/federation-controller-manager/app"
kubefedapp "k8s.io/kubernetes/federation/cmd/kubefed/app"
"k8s.io/kubernetes/federation/pkg/kubefed"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
)
// Note: We have a separate binary for generating federation docs and kube docs because of the way api groups are api.Registry.
@ -57,6 +60,10 @@ func main() {
// generate docs for kube-controller-manager
controllermanager := fedcmapp.NewControllerManagerCommand()
doc.GenMarkdownTree(controllermanager, outDir)
case "kubefed":
// generate docs for kubefed
kubefed := kubefed.NewKubeFedCommand(cmdutil.NewFactory(nil), os.Stdin, os.Stdout, os.Stderr, kubefedapp.GetDefaultServerImage(), kubefedapp.DefaultEtcdImage)
doc.GenMarkdownTree(kubefed, outDir)
default:
fmt.Fprintf(os.Stderr, "Module %s is not supported", module)
os.Exit(1)

View File

@ -30,14 +30,17 @@ import (
const (
hyperkubeImageName = "gcr.io/google_containers/hyperkube-amd64"
defaultEtcdImage = "gcr.io/google_containers/etcd:3.0.17"
DefaultEtcdImage = "gcr.io/google_containers/etcd:3.0.17"
)
func GetDefaultServerImage() string {
return fmt.Sprintf("%s:%s", hyperkubeImageName, version.Get())
}
func Run() error {
logs.InitLogs()
defer logs.FlushLogs()
defaultServerImage := fmt.Sprintf("%s:%s", hyperkubeImageName, version.Get())
cmd := kubefed.NewKubeFedCommand(cmdutil.NewFactory(nil), os.Stdin, os.Stdout, os.Stderr, defaultServerImage, defaultEtcdImage)
cmd := kubefed.NewKubeFedCommand(cmdutil.NewFactory(nil), os.Stdin, os.Stdout, os.Stderr, GetDefaultServerImage(), DefaultEtcdImage)
return cmd.Execute()
}

View File

@ -96,7 +96,7 @@ const (
var (
init_long = templates.LongDesc(`
Initialize a federation control plane.
Init initializes a federation control plane.
Federation control plane is hosted inside a Kubernetes
cluster. The host cluster must be specified using the
@ -178,7 +178,7 @@ func NewCmdInit(cmdOut io.Writer, config util.AdminConfig, defaultServerImage, d
cmd := &cobra.Command{
Use: "init FEDERATION_NAME --host-cluster-context=HOST_CONTEXT",
Short: "init initializes a federation control plane",
Short: "Initialize a federation control plane",
Long: init_long,
Example: init_example,
Run: func(cmd *cobra.Command, args []string) {

View File

@ -56,7 +56,7 @@ const (
var (
join_long = templates.LongDesc(`
Join a cluster to a federation.
Join adds a cluster to a federation.
Current context is assumed to be a federation API
server. Please use the --context flag otherwise.`)

View File

@ -40,12 +40,12 @@ import (
var (
unjoin_long = templates.LongDesc(`
Unjoin removes a cluster from a federation.
Unjoin a cluster from a federation.
Current context is assumed to be a federation endpoint.
Please use the --context flag otherwise.`)
unjoin_example = templates.Examples(`
# Unjoin removes the specified cluster from a federation.
# Unjoin the specified cluster from a federation.
# Federation control plane's host cluster context name
# must be specified via the --host-cluster-context flag
# to properly cleanup the credentials.
@ -72,7 +72,7 @@ func NewCmdUnjoin(f cmdutil.Factory, cmdOut, cmdErr io.Writer, config util.Admin
cmd := &cobra.Command{
Use: "unjoin CLUSTER_NAME --host-cluster-context=HOST_CONTEXT",
Short: "Unjoins a cluster from a federation",
Short: "Unjoin a cluster from a federation",
Long: unjoin_long,
Example: unjoin_example,
Run: func(cmd *cobra.Command, args []string) {

View File

@ -215,6 +215,7 @@ kube::util::gen-docs() {
# to generate. The actual binary for running federation is hyperkube.
"${genfeddocs}" "${dest}/docs/admin/" "federation-apiserver"
"${genfeddocs}" "${dest}/docs/admin/" "federation-controller-manager"
"${genfeddocs}" "${dest}/docs/admin/" "kubefed"
mkdir -p "${dest}/docs/man/man1/"
"${genman}" "${dest}/docs/man/man1/" "kube-apiserver"