Commit Graph

10 Commits (f0b207df2dd297b0b54920c46978083dd8a081e9)

Author SHA1 Message Date
David Eads d8a5420b7c remove unneeded factory codec methods 2018-02-21 15:20:20 -05:00
Jeff Grafton ef56a8d6bb Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
Jeff Grafton efee0704c6 Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
Kubernetes Submit Queue 761fdeacaa
Merge pull request #55689 from luksa/kubectl_explain_kind_version
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Make kubectl explain print the Kind and APIVersion of the resource

**What this PR does / why we need it**:
Kubectl explain currently doesn't print out the Kind and APIversion of the resource being explained. When running `kubectl explain hpa.spec`, for example, there is no way of knowing whether you're looking at the `autoscaling/v1` or the `autoscaling/v2beta1` version. 
Also, `kubectl explain` is often used as a reference when writing YAML/JSON object manifests. It allows you to look up everything except the API version. Currently, you either need to know the API Version of a resource by heart or look it up in the online API docs. 
This PR fixes both problems by having `kubectl explain` print out the full Kind and APIVersion of the resource it is explaining.

Here are a few examples of the new output:
```
$ kubectl explain deploy
KIND:     Deployment
VERSION:  extensions/v1beta1

DESCRIPTION:
...


$ kubectl explain hpa.spec
KIND:     HorizontalPodAutoscaler
VERSION:  autoscaling/v1

RESOURCE: spec <Object>

DESCRIPTION:
...


$ kubectl explain hpa.spec.maxReplicas
KIND:     HorizontalPodAutoscaler
VERSION:  autoscaling/v1

FIELD:    maxReplicas <integer>

DESCRIPTION:
...


$ kubectl explain hpa.spec --recursive
KIND:     HorizontalPodAutoscaler
VERSION:  autoscaling/v1

RESOURCE: spec <Object>

DESCRIPTION:
     behaviour of autoscaler. More info:
     https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.

     specification of a horizontal pod autoscaler.

FIELDS:
   maxReplicas	<integer>
   minReplicas	<integer>
   scaleTargetRef	<Object>
      apiVersion	<string>
      kind	<string>
      name	<string>
   targetCPUUtilizationPercentage	<integer>
```

**Release note**:

```release-note
Kubectl explain now prints out the Kind and API version of the resource being explained
```
2017-12-15 08:12:28 -08:00
Nikhita Raghunath 4add679528 kubectl explain: ignore trailing period
kubectl explain ingress.spec.rules.http.paths. is valid
and defaults to kubectl explain ingress.spec.rules.http.paths

Rational: We use kubectl explain by adding fields
(e.g. service, then service.spec, then service.spec.ports ...)
so it's very easy to forget a trailing . at the end. We should
ignore the trailing period and display the result without it.
2017-11-15 17:52:04 +05:30
Marko Luksa c77d5d0f90 Kubectl explain now also prints the Kind and APIVersion of the resource 2017-11-14 11:05:19 +01:00
Antoine Pelisse 3ed58475c4 Update openapi to use kube-openapi code 2017-10-20 09:21:06 -07:00
Jeff Grafton aee5f457db update BUILD files 2017-10-15 18:18:13 -07:00
Antoine Pelisse 094116ac9a Add test for explain 2017-10-03 09:48:36 -07:00
Antoine Pelisse 249caa95b5 Rewrite `kubectl explain` to use openapi
This removes all dependencies on swagger 1.2 for explain.
2017-10-03 09:44:11 -07:00