Commit Graph

18 Commits (dce1b881284a103909f5cfa969ff56e5e0565362)

Author SHA1 Message Date
Kubernetes Submit Queue f331434774
Merge pull request #60154 from deads2k/cli-11-decoder
Automatic merge from submit-queue (batch tested with PRs 60148, 60022, 59125, 60068, 60154). 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>.

 remove unneeded factory codec methods

Builds on https://github.com/kubernetes/kubernetes/pull/60117, so only the last commit is unique.

After we collapsed onto our own internal scheme for managing conversion and typing, the flexibility in codecs is the next area to collapse.  This pull eliminates those methods from the factory and then removes lots of dead code in the fake factories that supported this un-used flexibility

@kubernetes/sig-cli-maintainers 
@pwittrock @adohe @soltysh looking cleaner all the time.

```release-note
NONE
```
2018-02-21 18:09:51 -08:00
David Eads d8a5420b7c remove unneeded factory codec methods 2018-02-21 15:20:20 -05:00
Kubernetes Submit Queue 2b530438f1
Merge pull request #57087 from luksa/trailing_commas_test_swagger_json
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>.

Remove trailing commas from test-swagger.json

Trailing commas are not allowed in JSON. Commas are only allowed between values. See http://www.json.org/

**What this PR does / why we need it**:
Fixes invalid JSON in test-swagger.json

**Release note**:
```release-note
NONE
```
2018-02-21 09:51:26 -08: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 0e8683e173
Merge pull request #56746 from xuri/patch
Automatic merge from submit-queue (batch tested with PRs 56639, 56746, 56715, 56673, 56726). 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>.

Simple code and typo fixed.

**What this PR does / why we need it**:
Simple code and typo fixed.
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
none
**Special notes for your reviewer**:
none
**Release note**:

```release-note
NONE
```
2017-12-16 06:39:42 -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
Marko Luksa 2dd8aec34e Remove trailing commas from test-swagger.json
Trailing commas are not allowed in JSON.
2017-12-12 08:47:07 +01:00
Ri Xu 4b71941082
Simple code and typo fixed.
Signed-off-by: Ri Xu <xuri.me@gmail.com>
2017-12-02 21:12:39 +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
Kubernetes Submit Queue 45f8017e6d
Merge pull request #55283 from spzala/unreachabletest
Automatic merge from submit-queue (batch tested with PRs 55283, 55461, 55288, 53970, 55487). 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>.

Fix an unreachable kubectl explain field lookup test

In error case, the condition `gotErr != test.err && gotPath !=
test.expectedPath` never fulfill because in this case both gotPath and
test.expectedPath are always an empty string. So the err “err:  `field "what?"
does not exist`” doesn’t get tasted. For example, if you change the value of
`err:` to anything, the test still will pass. Also, since gotPath is empty
string in case of err, in the output error we probably don’t want to display
path. 



**What this PR does / why we need it**:
Fixes an unreachable unit test.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
None
```
2017-11-13 12:32:18 -08:00
Sahdev P. Zala 32d8fa0058 Fix an unreachable kubectl explain field lookup test
In error case, the condition “gotErr != test.err && gotPath !=
test.expectedPath” never fulfill because in this case both gotPath and
test.expectedPath always an empty string. So the err “err:  `field "what?"
does not exist`” doesn’t get tasted. For example, if you change the value of
“err” to anything, the test still will pass. Also, since gotPath is empty
string in case of err, in the output error we probably don’t want to display
path.
2017-11-10 11:32:57 -05:00
Antoine Pelisse 5c3c0f6e5b Add apelisse to OWNERS
I wrote most of this code anyway.
2017-11-09 15:39:31 -08: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