Commit 178b5f76 authored by Brendan Burns's avatar Brendan Burns

address comments

parent d8daa07f
......@@ -18,6 +18,10 @@ stdout. You can optionally specify a directory with \-\-output\-directory. If y
build a set of files in that directory. By default only dumps things in the 'kube\-system' namespace, but you can
switch to a different namespace with the \-\-namespaces flag, or specify \-\-all\-namespaces to dump all namespaces.
.PP
The command also dumps the logs of all of the pods in the cluster, these logs are dumped into different directories
based on namespace and pod name.
.SH OPTIONS
.PP
......@@ -131,6 +135,27 @@ switch to a different namespace with the \-\-namespaces flag, or specify \-\-all
comma\-separated list of pattern=N settings for file\-filtered logging
.SH EXAMPLE
.PP
.RS
.nf
# Dump current cluster state to stdout
kubectl cluster\-info dump
# Dump current cluster state to /path/to/cluster\-state
kubectl cluster\-info dump \-\-output\-directory=/path/to/cluster\-state
# Dump all namespaces to stdout
kubectl cluster\-info dump \-\-all\-namespaces
# Dump a set of namespaces to /path/to/cluster\-state
kubectl cluster\-info dump \-\-namespaces default,kube\-system \-\-output\-directory=/path/to/cluster\-state
.fi
.RE
.SH SEE ALSO
.PP
\fBkubectl\-cluster\-info(1)\fP,
......
......@@ -14,6 +14,7 @@ kubectl cluster\-info \- Display cluster info
.SH DESCRIPTION
.PP
Display addresses of the master and services with label kubernetes.io/cluster\-service=true
To further debug and diagnose cluster problems, use 'kubectl cluster\-info dump'.
.SH OPTIONS
......
......@@ -40,6 +40,7 @@ Display cluster info
Display addresses of the master and services with label kubernetes.io/cluster-service=true
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
```
kubectl cluster-info
......@@ -84,7 +85,7 @@ kubectl cluster-info
* [kubectl](kubectl.md) - kubectl controls the Kubernetes cluster manager
* [kubectl cluster-info dump](kubectl_cluster-info_dump.md) - Dump lots of relevant info for debugging and diagnosis.
###### Auto generated by spf13/cobra on 27-Apr-2016
###### Auto generated by spf13/cobra on 16-May-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_cluster-info.md?pixel)]()
......
......@@ -40,9 +40,28 @@ stdout. You can optionally specify a directory with --output-directory. If you
build a set of files in that directory. By default only dumps things in the 'kube-system' namespace, but you can
switch to a different namespace with the --namespaces flag, or specify --all-namespaces to dump all namespaces.
The command also dumps the logs of all of the pods in the cluster, these logs are dumped into different directories
based on namespace and pod name.
```
kubectl cluster-info dump
```
### Examples
```
# Dump current cluster state to stdout
kubectl cluster-info dump
# Dump current cluster state to /path/to/cluster-state
kubectl cluster-info dump --output-directory=/path/to/cluster-state
# Dump all namespaces to stdout
kubectl cluster-info dump --all-namespaces
# Dump a set of namespaces to /path/to/cluster-state
kubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state
```
### Options
......@@ -85,7 +104,7 @@ kubectl cluster-info dump
* [kubectl cluster-info](kubectl_cluster-info.md) - Display cluster info
###### Auto generated by spf13/cobra on 27-Apr-2016
###### Auto generated by spf13/cobra on 16-May-2016
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/user-guide/kubectl/kubectl_cluster-info_dump.md?pixel)]()
......
name: cluster-info
synopsis: Display cluster info
description: |
description: |-
Display addresses of the master and services with label kubernetes.io/cluster-service=true
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
options:
- name: include-extended-apis
default_value: "true"
......
......@@ -33,9 +33,10 @@ import (
// NewCmdCreateSecret groups subcommands to create various types of secrets
func NewCmdClusterInfoDump(f *cmdutil.Factory, cmdOut io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "dump",
Short: "Dump lots of relevant info for debugging and diagnosis.",
Long: dumpLong + "\n" + dumpExample,
Use: "dump",
Short: "Dump lots of relevant info for debugging and diagnosis.",
Long: dumpLong,
Example: dumpExample,
Run: func(cmd *cobra.Command, args []string) {
cmdutil.CheckErr(dumpClusterInfo(f, cmd, args, cmdOut))
},
......@@ -57,17 +58,17 @@ The command also dumps the logs of all of the pods in the cluster, these logs ar
based on namespace and pod name.
`
dumpExample = ` # Dump current cluster state to stdout
kubectl cluster-info dump
dumpExample = `# Dump current cluster state to stdout
kubectl cluster-info dump
# Dump current cluster state to /path/to/cluster-state
kubectl cluster-info dump --output-directory=/path/to/cluster-state
# Dump current cluster state to /path/to/cluster-state
kubectl cluster-info dump --output-directory=/path/to/cluster-state
# Dump all namespaces to stdout
kubectl cluster-info dump --all-namespaces
# Dump all namespaces to stdout
kubectl cluster-info dump --all-namespaces
# Dump a set of namespaces to /path/to/cluster-state
kubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state`
# Dump a set of namespaces to /path/to/cluster-state
kubectl cluster-info dump --namespaces default,kube-system --output-directory=/path/to/cluster-state`
)
func setupOutputWriter(cmd *cobra.Command, defaultWriter io.Writer, filename string) io.Writer {
......
......@@ -24,21 +24,21 @@ import (
"testing"
)
func TestGetWriterNoOp(t *testing.T) {
func TestSetupOutputWriterNoOp(t *testing.T) {
tests := []string{"", "-"}
for _, test := range tests {
out := &bytes.Buffer{}
f, _, _ := NewAPIFactory()
cmd := NewCmdClusterInfoDump(f, os.Stdout)
cmd.Flag("output-directory").Value.Set(test)
writer := getWriter(cmd, out, "/some/file/that/should/be/ignored")
writer := setupOutputWriter(cmd, out, "/some/file/that/should/be/ignored")
if writer != out {
t.Errorf("expected: %v, saw: %v", out, writer)
}
}
}
func TestGetWriterFile(t *testing.T) {
func TestSetupOutputWriterFile(t *testing.T) {
file := "output.json"
dir, err := ioutil.TempDir(os.TempDir(), "out")
if err != nil {
......@@ -51,7 +51,7 @@ func TestGetWriterFile(t *testing.T) {
f, _, _ := NewAPIFactory()
cmd := NewCmdClusterInfoDump(f, os.Stdout)
cmd.Flag("output-directory").Value.Set(dir)
writer := getWriter(cmd, out, file)
writer := setupOutputWriter(cmd, out, file)
if writer == out {
t.Errorf("expected: %v, saw: %v", out, writer)
}
......
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