Skip to content

Commit

Permalink
Merge pull request kubernetes#30955 from lojies/modifygetresource
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue

use valid_resources to replace kubectl.PossibleResourceTypes

```release
Fix resource list printed by kubectl help 
```

 `kubectl get` return 

> 
You must specify the type of resource to get. Valid resource types include:
   * componentstatuses (aka 'cs')
   * configmaps
   * daemonsets (aka 'ds')
   * deployments
   * events (aka 'ev')
   * endpoints (aka 'ep')
   * horizontalpodautoscalers (aka 'hpa')
   * ingress (aka 'ing')
   * jobs
   * limitranges (aka 'limits')
   * nodes (aka 'no')
   * namespaces (aka 'ns')
   * pods (aka 'po')
   * persistentvolumes (aka 'pv')
   * persistentvolumeclaims (aka 'pvc')
   * quota
   * resourcequotas (aka 'quota')
   * replicasets (aka 'rs')
   * replicationcontrollers (aka 'rc')
   * secrets
   * serviceaccounts (aka 'sa')
   * services (aka 'svc')
error: Required resource not specified.
See 'kubectl get -h' for help and examples.

while `kubectl get --help` return

> root@k8s-node1:~# kubectl get --help
Display one or many resources.
Possible resource types include (case insensitive): pods (po), services (svc), deployments,
replicasets (rs), replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits),
persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota), namespaces (ns),
serviceaccounts (sa), ingresses (ing), horizontalpodautoscalers (hpa), daemonsets (ds), configmaps,
componentstatuses (cs), endpoints (ep), and secrets.
By specifying the output as 'template' and providing a Go template as the value
of the --template flag, you can filter the attributes of the fetched resource(s).
......

kubectl.PossibleResourceTypes missing some resouces such as jobs quota.
describe and explain have the same problem.

i think using valid_resources to replace kubectl.PossibleResourceTypes more suitable.
  • Loading branch information
Kubernetes Submit Queue authored Aug 19, 2016
2 parents 0341d3d + f81fef1 commit 3787a06
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 10 deletions.
3 changes: 1 addition & 2 deletions pkg/kubectl/cmd/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ var (
will first check for an exact match on TYPE and NAME_PREFIX. If no such resource
exists, it will output details for every resource that has a name prefixed with NAME_PREFIX.
`) +
kubectl.PossibleResourceTypes
`) + valid_resources

describe_example = dedent.Dedent(`
# Describe a node
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubectl/cmd/explain.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var (
explainLong = dedent.Dedent(`
Documentation of resources.
`) + kubectl.PossibleResourceTypes
`) + valid_resources
)

// NewCmdExplain returns a cobra command for swagger docs
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubectl/cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
get_long = dedent.Dedent(`
Display one or many resources.
`) + kubectl.PossibleResourceTypes + dedent.Dedent(`
`) + valid_resources + dedent.Dedent(`
This command will hide resources that have completed. For instance, pods that are in the Succeeded or Failed phases.
You can see the full results for any resource by providing the '--show-all' flag.
Expand Down
6 changes: 0 additions & 6 deletions pkg/kubectl/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ import (

const (
kubectlAnnotationPrefix = "kubectl.kubernetes.io/"
// TODO: auto-generate this
PossibleResourceTypes = `Possible resource types include (case insensitive): pods (aka 'po'), services (aka 'svc'), deployments (aka 'deploy'),
replicasets (aka 'rs'), replicationcontrollers (aka 'rc'), nodes (aka 'no'), events (aka 'ev'), limitranges (aka 'limits'),
persistentvolumes (aka 'pv'), persistentvolumeclaims (aka 'pvc'), resourcequotas (aka 'quota'), namespaces (aka 'ns'),
serviceaccounts (aka 'sa'), ingresses (aka 'ing'), horizontalpodautoscalers (aka 'hpa'), daemonsets (aka 'ds'), configmaps (aka 'cm'),
componentstatuses (aka 'cs), endpoints (aka 'ep'), petsets (alpha feature, may be unstable) and secrets.`
)

type NamespaceInfo struct {
Expand Down

0 comments on commit 3787a06

Please sign in to comment.