Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
eff5f17b
Commit
eff5f17b
authored
Jul 14, 2015
by
Eric Tune
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10806 from hurf/help_describe
Add a better help message for kubectl describe
parents
ed26ffe9
6dd8a1df
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
24 deletions
+39
-24
kubectl-describe.1
docs/man/man1/kubectl-describe.1
+6
-0
kubectl_describe.md
docs/user-guide/kubectl/kubectl_describe.md
+6
-1
cmd.go
pkg/kubectl/cmd/cmd.go
+12
-0
describe.go
pkg/kubectl/cmd/describe.go
+13
-3
get.go
pkg/kubectl/cmd/get.go
+2
-20
No files found.
docs/man/man1/kubectl-describe.1
View file @
eff5f17b
...
@@ -26,6 +26,12 @@ $ kubectl describe RESOURCE NAME\_PREFIX
...
@@ -26,6 +26,12 @@ $ kubectl describe RESOURCE NAME\_PREFIX
will first check for an exact match on RESOURCE and NAME\_PREFIX. If no such resource
will first check for an exact match on RESOURCE and NAME\_PREFIX. If no such resource
exists, it will output details for every resource that has a name prefixed with NAME\_PREFIX
exists, it will output details for every resource that has a name prefixed with NAME\_PREFIX
.PP
Possible resources include pods (po), replicationcontrollers (rc), services
(svc), nodes (no), events (ev), componentstatuses (cs), limitRanges (limits),
persistentVolumes (pv), persistentVolumeClaims (pvc), resourceQuotas (quota)
or secrets.
.SH OPTIONS
.SH OPTIONS
.PP
.PP
...
...
docs/user-guide/kubectl/kubectl_describe.md
View file @
eff5f17b
...
@@ -29,6 +29,11 @@ $ kubectl describe RESOURCE NAME_PREFIX
...
@@ -29,6 +29,11 @@ $ kubectl describe RESOURCE NAME_PREFIX
will first check for an exact match on RESOURCE and NAME_PREFIX. If no such resource
will first check for an exact match on RESOURCE and NAME_PREFIX. If no such resource
exists, it will output details for every resource that has a name prefixed with NAME_PREFIX
exists, it will output details for every resource that has a name prefixed with NAME_PREFIX
Possible resources include pods (po), replicationcontrollers (rc), services
(svc), nodes (no), events (ev), componentstatuses (cs), limitRanges (limits),
persistentVolumes (pv), persistentVolumeClaims (pvc), resourceQuotas (quota)
or secrets.
```
```
kubectl describe (RESOURCE NAME_PREFIX | RESOURCE/NAME)
kubectl describe (RESOURCE NAME_PREFIX | RESOURCE/NAME)
```
```
...
@@ -89,7 +94,7 @@ $ kubectl describe pods frontend
...
@@ -89,7 +94,7 @@ $ kubectl describe pods frontend
### SEE ALSO
### SEE ALSO
*
[
kubectl
](
kubectl.md
)
- kubectl controls the Kubernetes cluster manager
*
[
kubectl
](
kubectl.md
)
- kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra at 2015-07-14 0
0:11:42.955631296
+0000 UTC
###### Auto generated by spf13/cobra at 2015-07-14 0
8:21:33.374469932
+0000 UTC
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
...
...
pkg/kubectl/cmd/cmd.go
View file @
eff5f17b
...
@@ -91,6 +91,18 @@ __custom_func() {
...
@@ -91,6 +91,18 @@ __custom_func() {
esac
esac
}
}
`
`
valid_resources
=
`Valid resource types include:
* pods (aka 'po')
* replicationcontrollers (aka 'rc')
* services (aka 'svc')
* nodes (aka 'no')
* events (aka 'ev')
* secrets
* limits
* persistentVolumes (aka 'pv')
* persistentVolumeClaims (aka 'pvc')
* quota
`
)
)
// NewKubectlCommand creates the `kubectl` command and its nested children.
// NewKubectlCommand creates the `kubectl` command and its nested children.
...
...
pkg/kubectl/cmd/describe.go
View file @
eff5f17b
...
@@ -23,7 +23,7 @@ import (
...
@@ -23,7 +23,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
apierrors
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/meta"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/meta"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl"
cmdutil
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
cmdutil
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util"
...
@@ -40,7 +40,12 @@ given resource or group of resources.
...
@@ -40,7 +40,12 @@ given resource or group of resources.
$ kubectl describe RESOURCE NAME_PREFIX
$ kubectl describe RESOURCE NAME_PREFIX
will first check for an exact match on RESOURCE and NAME_PREFIX. If no such resource
will first check for an exact match on RESOURCE and NAME_PREFIX. If no such resource
exists, it will output details for every resource that has a name prefixed with NAME_PREFIX`
exists, it will output details for every resource that has a name prefixed with NAME_PREFIX
Possible resources include pods (po), replicationcontrollers (rc), services
(svc), nodes (no), events (ev), componentstatuses (cs), limitRanges (limits),
persistentVolumes (pv), persistentVolumeClaims (pvc), resourceQuotas (quota)
or secrets.`
describe_example
=
`// Describe a node
describe_example
=
`// Describe a node
$ kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
$ kubectl describe nodes kubernetes-minion-emt8.c.myproject.internal
...
@@ -78,6 +83,11 @@ func RunDescribe(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []s
...
@@ -78,6 +83,11 @@ func RunDescribe(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []s
return
err
return
err
}
}
if
len
(
args
)
==
0
{
fmt
.
Fprint
(
out
,
"You must specify the type of resource to describe. "
,
valid_resources
)
return
cmdutil
.
UsageError
(
cmd
,
"Required resource not specified."
)
}
mapper
,
typer
:=
f
.
Object
()
mapper
,
typer
:=
f
.
Object
()
r
:=
resource
.
NewBuilder
(
mapper
,
typer
,
f
.
ClientMapperForCommand
())
.
r
:=
resource
.
NewBuilder
(
mapper
,
typer
,
f
.
ClientMapperForCommand
())
.
ContinueOnError
()
.
ContinueOnError
()
.
...
@@ -101,7 +111,7 @@ func RunDescribe(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []s
...
@@ -101,7 +111,7 @@ func RunDescribe(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []s
}
}
infos
,
err
:=
r
.
Infos
()
infos
,
err
:=
r
.
Infos
()
if
err
!=
nil
{
if
err
!=
nil
{
if
errors
.
IsNotFound
(
err
)
&&
len
(
args
)
==
2
{
if
api
errors
.
IsNotFound
(
err
)
&&
len
(
args
)
==
2
{
return
DescribeMatchingResources
(
mapper
,
typer
,
describer
,
f
,
cmdNamespace
,
args
[
0
],
args
[
1
],
out
)
return
DescribeMatchingResources
(
mapper
,
typer
,
describer
,
f
,
cmdNamespace
,
args
[
0
],
args
[
1
],
out
)
}
}
return
err
return
err
...
...
pkg/kubectl/cmd/get.go
View file @
eff5f17b
...
@@ -17,7 +17,6 @@ limitations under the License.
...
@@ -17,7 +17,6 @@ limitations under the License.
package
cmd
package
cmd
import
(
import
(
"errors"
"fmt"
"fmt"
"io"
"io"
...
@@ -101,25 +100,8 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string
...
@@ -101,25 +100,8 @@ func RunGet(f *cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string
}
}
if
len
(
args
)
==
0
{
if
len
(
args
)
==
0
{
fmt
.
Fprint
(
out
,
`
fmt
.
Fprint
(
out
,
"You must specify the type of resource to get. "
,
valid_resources
)
You must specify the type of resource to get. Valid resource types include:
return
cmdutil
.
UsageError
(
cmd
,
"Required resource not specified."
)
* componentStatuses (aka 'cs')
* endpoints (aka 'ep')
* events (aka 'ev')
* limits
* namespaces
* nodes (aka 'no')
* persistentVolumeClaims (aka 'pvc')
* persistentVolumes (aka 'pv')
* pods (aka 'po')
* podTemplates
* quota
* replicationcontrollers (aka 'rc')
* secrets
* serviceAccounts
* services
`
)
return
errors
.
New
(
"Required resource not specified."
)
}
}
// handle watch separately since we cannot watch multiple resource types
// handle watch separately since we cannot watch multiple resource types
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment