Commit Graph

862 Commits (284e8182a402cfd545fc000fedaea071fed873b0)

Author SHA1 Message Date
Clayton Coleman 98e0c69907 Revert "refactor builder in kubectl factory"
This reverts commit 06c5be9802.
2017-11-19 19:02:21 -05:00
Kubernetes Submit Queue fa3047880d
Merge pull request #54867 from juanvallejo/jvallejo/move-print-success-cmdutil-factory
Automatic merge from submit-queue (batch tested with PRs 55233, 55927, 55903, 54867, 55940). 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>.

move cmd/util/printing.go#PrintSuccess to factory_builder.go

**Release note**:
```release-note
NONE
```

This patch is one in a series of patches that aims to move all
printing functions to the `cmdutil.Factory` in order to make
the factory the one-stop shop for accessing printers in the client.

This PR is related to https://github.com/kubernetes/kubernetes/pull/50113 and aims to break that set of changes
by introducing a portion of them in this commit in order to make 
them easier to review.

@fabianofranz @mengqiy @shiywang @seans3
2017-11-18 12:26:15 -08:00
Kubernetes Submit Queue 153b5f50f2
Merge pull request #53483 from apelisse/openapi-columns
Automatic merge from submit-queue (batch tested with PRs 50457, 55558, 53483, 55731, 52842). 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>.

Show openapi custom columns in `kubectl get`

Change the name of the flag to something slightly more user-friendly,
while making it default true. The flag is kept so that someone can
revert it temporarly if things go wrong.

**What this PR does / why we need it**: OpenAPI can specify for some columns to be used in `kubectl get`. That's very useful for non-core/hard-coded type in order to print more valuable data in get.

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

**Special notes for your reviewer**:

Closes kubernetes/kubectl#143

**Release note**:
```release-note
`kubectl get` will now use OpenAPI schema extensions by default to select columns for custom types.
```
2017-11-18 11:36:19 -08:00
Antoine Pelisse 9778b1a9ba openapi: Add EmptyResource/CreateOpenAPISchemaFunc test utils
Add a new EmptyResource class that implements openapi.Resources, but
just doesn't have any resources. That is useful for tests that expect
the OpenAPISchema to be working, but don't expect any actual result.

Also implement CreateOpenAPISchemaFunc to simply plug in the TestFactory
code when you want to use an actual APISchema.
2017-11-15 14:02:13 -08:00
juanvallejo 701d6536a2
move cmd/util/printing.go#PrintSuccess to factory_builder.go 2017-11-15 10:46:39 -05:00
Clayton Coleman b366afa00a
Move category expander out of kubectl/resource 2017-11-14 17:38:16 -05:00
Kubernetes Submit Queue e725361722
Merge pull request #54877 from juanvallejo/jvallejo/move-PrintResourceInfoRorCommand-cmdutil-factory
Automatic merge from submit-queue (batch tested with PRs 54602, 54877, 55243, 55509, 55128). 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>.

move cmd/util/printing.go#PrintResourceInfoForCommand -> factory…

**Release note**:
```release-note
NONE
```

This patch is one in a series of patches that aims to move all
printing functions to the `cmdutil.Factory` in order to make
the factory the one-stop shop for accessing printers in the client.

This PR is related to https://github.com/kubernetes/kubernetes/pull/50113 and aims to break the set of changes
introduced in this commit in order to make them easier to review.

@fabianofranz @mengqiy @shiywang @seans3
2017-11-14 03:03:23 -08:00
Kubernetes Submit Queue 7650665059
Merge pull request #54554 from zjj2wry/set-dep
Automatic merge from submit-queue (batch tested with PRs 53337, 55465, 55512, 55522, 54554). 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>.

switch UpdatePodSpecForObject to work on v1.PodSpec, use info.VersionedObject, and avoid conversion completely

**What this PR does / why we need it**:
ref #54212
ref #https://github.com/kubernetes/kubectl/issues/83

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

**Special notes for your reviewer**:
cc @liggitt @pwittrock 
**Release note**:

```release-note
NONE
```
2017-11-11 12:44:30 -08:00
Kubernetes Submit Queue 0ca74ef2e3
Merge pull request #54858 from wackxu/createpri
Automatic merge from submit-queue (batch tested with PRs 54460, 55258, 54858, 55506, 55510). 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>.

add create subcommand for priorityclass

**What this PR does / why we need it**:

add `create priorityclass` sub command


**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 #54857

**Special notes for your reviewer**:

**Release note**:

```release-note
add create priorityclass sub command
```
2017-11-11 10:45:23 -08:00
zhengjiajin dc312142ab remove todo: switch UpdatePodSpecForObject to work on v1.PodSpec, use info.VersionedObject, and avoid conversion completely 2017-11-11 02:36:12 +08:00
Antoine Pelisse 5c3c0f6e5b Add apelisse to OWNERS
I wrote most of this code anyway.
2017-11-09 15:39:31 -08:00
juanvallejo 4418591226
move cmd/util/printing.go#PrintResourceInfoForCommand -> factory_builder.go 2017-11-09 15:13:18 -05:00
Kubernetes Submit Queue f4d470c75c
Merge pull request #55162 from deads2k/cli-06-tolerate-error
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>.

tolerate discovery errors in the restmapper

Found this while investigating a related problem.  The restmapper can use the information it has found.  It doesn't have to discard all of it.
2017-11-09 08:36:44 -08:00
Dr. Stefan Schimanski bec617f3cc Update generated files 2017-11-09 12:14:08 +01:00
Dr. Stefan Schimanski 012b085ac8 pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
Dr. Stefan Schimanski d13b936a2a pkg/apis/core: fixup conversion func names in dependencies 2017-11-09 12:14:07 +01:00
Kubernetes Submit Queue 2ee10cc73e
Merge pull request #55092 from mengqiy/refactor_factory
Automatic merge from submit-queue (batch tested with PRs 55092, 55348, 55095, 55277, 55352). 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>.

refactor build in kubectl factory

Refactor kubectl factory and resource builder.

This will be helpful for `kinflate`.

```release-note
NONE
```

/assign @monopole
2017-11-08 21:18:16 -08:00
yland 456df2c74e Replace some occurances of kubernetes internal api types in kubectl 2017-11-08 18:27:45 +01:00
ymqytw 06c5be9802 refactor builder in kubectl factory 2017-11-07 20:16:27 -08:00
wackxu 741c58be7f add create subcommand for priorityclass 2017-11-07 15:03:01 +08:00
David Eads 8203b0b135 tolerate discovery errors in the restmapper 2017-11-06 08:22:44 -05:00
Kubernetes Submit Queue 2ecb368026
Merge pull request #53679 from kow3ns/workloadsv1
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>.

Workloads V1

**What this PR does / why we need it**: This PR promotes the Deployment, ReplicaSet, and DaemonSet StatefulSet, ControllerRevision kinds to the apps/v1 group version.

https://github.com/kubernetes/features/issues/353

**Special notes for your reviewer**:
There will be at least two followups to this PR. The first to add a scale sub-resource when the correct location is resolved, and the second to deal with Conditions in the workloads API.

While it would have been preferable to move the kinds individually providing a lesser burden on reviewers, this proved impracticable due to the intricacies of version resolution in kubectl for objects of the different kinds in the same group.  

```release-note
DaemonSet, Deployment, ReplicaSet, and StatefulSet have been promoted to GA and are available in the apps/v1 group version.
```
2017-11-03 15:17:16 -07:00
Kenneth Owens 5590c1fb94 gets the correct version of kubernetes client for DaemonSet and StatefulSet History and Rollback and updates test-cmd for new versions 2017-11-03 10:16:50 -07:00
ymqytw 5557f2e444 discovery client not depend on pkg/api/legacyscheme 2017-11-02 14:59:21 -07:00
Antoine Pelisse 8f7262e819 Update kube-openapi to use validation 2017-11-02 09:25:03 -07:00
Kubernetes Submit Queue 037b8ab8b3
Merge pull request #54446 from smarterclayton/cleanup_get
Automatic merge from submit-queue (batch tested with PRs 54446, 54202). 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>.

Create a new package for generic commands like get

This is in preparation for cleaning up the structure of `kubectl get` to ease implementing serverside get and streaming API responses. Moves a hardcoded constant into a method in preparation for a future serverside implementation. Also improves some existing description text.
2017-10-31 15:51:23 -07:00
Kubernetes Submit Queue f46f0efd31
Merge pull request #54572 from ellenkorbes/ellenmakesamess
Automatic merge from submit-queue (batch tested with PRs 54572, 54686). 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>.

kubectl partial env docs & examples

**What this PR does / why we need it**:

It adds documentation and examples to kubectl env.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: This PR partially addresses [#98](https://github.com/kubernetes/kubectl/issues/98).

**Special notes for your reviewer**:

This is a partial PR. I'm mostly looking for feedback as to whether I'm on the right track with this issue. Any feedback is appreciated. Thanks.

(This is my contribution to Outreachy's Kubernetes internship application.)

**Release note**:


```release-note
NONE
```
2017-10-30 21:45:14 -07:00
Clayton Coleman 93fed120fb
Move printing the valid resource types to a function
Should be calculated from discovery in the future. Also improve
descriptions on the affected commands.
2017-10-30 23:45:45 -04:00
Ellen Körbes 413eaecf32 Added comments & examples/tests to kubectl env package 2017-10-29 20:23:20 -02:00
ymqytw 4487cc5e15 switch some commands to use its own scheme 2017-10-27 18:31:42 -07:00
Maru Newby adc338d330 Remove all traces of federation 2017-10-26 13:37:37 -07:00
Kubernetes Submit Queue 507790c9c6 Merge pull request #54181 from apelisse/update-kube-openapi
Automatic merge from submit-queue (batch tested with PRs 54199, 54181, 54196). 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>.

Update openapi to use kube-openapi code

**What this PR does / why we need it**: OpenAPI code has moved to `github.com/kubernetes/kube-openapi`. Let's use that code as a dependency, since now it's duplicated.

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```

No user visible changes. Just code moving around.
2017-10-20 18:57:03 -07:00
Kubernetes Submit Queue d7eebdfdbe Merge pull request #54113 from spzala/groupkindvalidationtest
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>.

Create new unit tests for version and kind validation

This is a follow up PR per discussion in the
https://github.com/kubernetes/kubernetes/pull/53587
Creating new unit tests here for basic and aggregated validation of version
and kind group.



**What this PR does / why we need it**:

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-20 09:29:24 -07:00
Antoine Pelisse 3ed58475c4 Update openapi to use kube-openapi code 2017-10-20 09:21:06 -07:00
Kubernetes Submit Queue 2d914ee703 Merge pull request #53984 from sttts/sttts-legacyscheme
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>.

pkg/api: extract Scheme/Registry/Codecs into pkg/api/legacyscheme

This serves as

- a preparation for the pkg/api->pkg/apis/core move
- and makes the dependency to the scheme explicit when vizualizing
  left depenncies.

The later helps with our our efforts to split up the monolithic repo
into self-contained sub-repos, e.g. for kubectl, controller-manager
and kube-apiserver in the future.
2017-10-18 10:49:10 -07:00
Dr. Stefan Schimanski cad0364e73 Update bazel 2017-10-18 17:24:04 +02:00
Dr. Stefan Schimanski 7773a30f67 pkg/api/legacyscheme: fixup imports 2017-10-18 17:23:55 +02:00
Sahdev P. Zala 07be0a057a Create new unit tests for version and kind validation
This is a follow up PR per discussion in the
https://github.com/kubernetes/kubernetes/pull/53587
Creating new unit tests here for basic and aggregated validation of version
and kind group.
2017-10-17 23:10:20 -04:00
tanshanshan d2caaf1cbe fix bug 2017-10-18 10:06:06 +08:00
Kubernetes Submit Queue d97c759110 Merge pull request #53587 from spzala/master
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>.

Provide aggregated validation errors for version and kind

Currently the validation checks is done individually for version and
kind group. For example, if user provided yaml file is missing apiVersion
and kind fields, first they will receive error on apiVersion. Once user
update the file and try to recreate, an error on missing kind is displayed.
The behavior is same for wrong types of the fields.
These errors should be aggregated and displayed.

Examples of current validation:
1
test.yaml is missing apiVersion and kind:
$kubectl.sh create -f /home/sahdev/go/src/bugfixes/test.yaml
error: error validating "/home/sahdev/go/src/bugfixes/test.yaml": error validating data: apiVersion not set; if you choose to ignore these errors, turn validation off with --validate=false
2.
test.yaml is fixed for apiVersion but missing kind:
$kubectl.sh create -f /home/sahdev/go/src/bugfixes/test.yaml
error: error validating "/home/sahdev/go/src/bugfixes/test.yaml": error validating data: kind not set; if you choose to ignore these errors, turn validation off with --validate=false

Examples with aggregated validation: 
1.
error: error validating "/home/sahdev/go/src/bugfixes/test.yaml": error validating data: [apiVersion not set, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false
2.
error: error validating "/home/sahdev/go/src/bugfixes/testmix.yaml": error validating data: [apiVersion isn't string type, kind not set]; if you choose to ignore these errors, turn validation off with --validate=false



**What this PR does / why we need it**:
To provide aggregated validations to user for version and kind group.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-10-17 16:35:39 -07:00
Sahdev P. Zala 0c0a4696c7 Provide aggregated validation errors for version and kind
Currently the validation checks is done individually for version and
kind group. For example, if user provided yaml file is missing apiVersion
and kind fields, first they will receive error on apiVersion. Once user
update the file and try to recreate, an error on missing kind is displayed.
The behavior is same for wrong types of the fields.
These errors should be aggregated and displayed.
2017-10-17 13:31:12 -04:00
Kubernetes Submit Queue 74cd0f0766 Merge pull request #53861 from pwittrock/resource-validation-deps
Automatic merge from submit-queue (batch tested with PRs 53106, 52193, 51250, 52449, 53861). 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>.

Move version-conversion code out of shared kubectl resource package

```release-note
NONE
```
2017-10-16 14:47:28 -07:00
Phillip Wittrock 7ab3f96100 Move kubectl type conversion libs out of the resource & util package and into the conversion command.
Kubectl shouldn't have code that does type conversion.  This should be in the server.
2017-10-16 11:54:31 -07:00
Jeff Grafton aee5f457db update BUILD files 2017-10-15 18:18:13 -07:00
Kubernetes Submit Queue 4548a07c0e Merge pull request #53781 from sttts/sttts-kill-pkg-api-util
Automatic merge from submit-queue (batch tested with PRs 47039, 53681, 53303, 53181, 53781). 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>.

Get rid of pkg/api/util

Old helpers we can replace with apimachinery tools.
2017-10-12 15:45:31 -07:00
Kubernetes Submit Queue dc404d49d4 Merge pull request #53303 from liggitt/discovery-logging
Automatic merge from submit-queue (batch tested with PRs 47039, 53681, 53303, 53181, 53781). 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>.

Avoid fetching entire discovery tree when possible

For specific commands, we use discovery to determine whether a particular resource is available.

We should avoid fetching the entire discovery tree to check a single resource group version. As the number of groups grows, the performance hit and potential to encounter an error also grows.

```release-note
NONE
```
2017-10-12 15:45:26 -07:00
Dr. Stefan Schimanski a6f0cd01ee Get rid of pkg/api/util 2017-10-12 16:36:32 +02:00
Kubernetes Submit Queue 87bd30a142 Merge pull request #53606 from juanvallejo/jvallejo/add-approx-pod-template-factory-method
Automatic merge from submit-queue (batch tested with PRs 53606, 49361). 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>.

add ApproximatePodTemplateForObject factory method

Makes it possible to get at a pod spec template even if an object is scaled to zero, for use with commands that care about pod templates.

**Release note**:

```release-note
NONE
```

Related downstream patch and use-case: https://github.com/openshift/origin/pull/16379

cc @smarterclayton
2017-10-11 22:41:29 -07:00
Jordan Liggitt 59c4d7fdf3
Avoid fetching entire discovery tree when possible 2017-10-12 00:27:42 -04:00
Antoine Pelisse d1ce36371e kubectl: Remove swagger 1.2 entirely. 2017-10-10 14:50:56 -07:00
juanvallejo ba1914d514
add ApproximatePodTemplateForObject factory method 2017-10-09 14:57:23 -04:00
Kubernetes Submit Queue 9782a5a0a9 Merge pull request #52971 from dixudx/kubectl_not_parsing_labelSelector
Automatic merge from submit-queue (batch tested with PRs 51771, 52971). 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>.

pass labelSelector to server side opaquely

**What this PR does / why we need it**:
From @smarterclayton 
> The server is responsible for handling label selection for the most part. There is some level of client side processing possible, but for the most part `label selector` should be able to be passed opaquely.

xref #50140

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

**Special notes for your reviewer**:
/assign @smarterclayton @liggitt 

**Release note**:

```release-note
None
```
2017-10-08 23:30:37 -07:00
Kubernetes Submit Queue c4d3c57f8b Merge pull request #51447 from sakeven/rm_useless_code
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 useless code

Signed-off-by: sakeven <jc5930@sina.cn>



**What this PR does / why we need it**:

Function checkErrWithPrefix is never used, so we can safely remove it.

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

**Special notes for your reviewer**:

**Release note**:

```
NONE
```
2017-10-04 23:38:22 -07:00
Kubernetes Submit Queue 4cf9ee32c1 Merge pull request #53232 from apelisse/remove-swagger-validation
Automatic merge from submit-queue (batch tested with PRs 53228, 53232, 53353). 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 swagger 1.2 validation

**What this PR does / why we need it**:
Removes dependency on swagger 1.2 for validation. Always uses openapi.

cc @mbohlool 

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

**Special notes for your reviewer**:

**Release note**:
```release-note
Kubectl: Remove swagger 1.2 validation. Also removes options `--use-openapi` and `--schema-cache-dir` as these are no longer needed.
```
2017-10-03 19:27:17 -07:00
Antoine Pelisse 996bc521ee openapi: Add fake resource to simplify tests 2017-10-03 09:44:14 -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
Antoine Pelisse 80fd010e83 Remove swagger 1.2 validation 2017-10-03 08:18:21 -07:00
Kubernetes Submit Queue 1ddf2e8ab9 Merge pull request #52742 from apelisse/validate-resource-even-if-unregistered
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>.

openapi: Validate unregistered type, if they can be found

**What this PR does / why we need it**:
Types that are not registered/hard-coded in kubectl won't be validated, even if they could because they are defined in openapi. If they are neither registered nor in openapi, then skip validation. 

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-10-02 07:14:02 -07:00
Di Xu 279065aa6c pass labelSelector to server side opaquely 2017-09-30 14:54:27 +08:00
Antoine Pelisse d13c6d77eb openapi: Validate unregistered type, if they can be found 2017-09-29 20:22:15 -07:00
Di Xu 137cd9e6fc fix missing apps/replicaset in kubectl 2017-09-26 10:54:04 -07:00
Kubernetes Submit Queue 7c9e614cbb Merge pull request #52873 from ixdy/bazel-cleanup
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>..

bazel: build/test almost everything

**What this PR does / why we need it**: Miscellaneous cleanups and bug fixes. The main motivating idea here was to make `bazel build //...` and `bazel test //...` mostly work. (There's a few reasons these still don't work, but we're a lot closer.)

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

/assign @BenTheElder @mikedanese @spxtr
2017-09-24 00:04:36 -07:00
Kubernetes Submit Queue 963697564a Merge pull request #50672 from shiywang/fix0error
Automatic merge from submit-queue (batch tested with PRs 50890, 52484, 52542, 52567, 50672). 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 return 0 error in DefaultSubCommandRun

Fixes https://github.com/kubernetes/kubernetes/issues/50644
@mengqiy most of our command didn't return 1 when error, is because it invoke `DefaultSubCommandRun` which created in this pr https://github.com/kubernetes/kubernetes/pull/35206, I'm not sure if it's ok to directly add an `os.Exit` in that function, so also cc @juanvallejo @fabianofranz for review.

also @apelisse  @mengqiy  I think we don't have any test for check return value now ? cmiiw, I will add some test in test-cmd since it's easy to write scripts check return value, wdyt ?
2017-09-23 16:26:56 -07:00
Kubernetes Submit Queue f0b0659c11 Merge pull request #50890 from zjj2wry/fix-todo-fallback
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 todo(#42787)Add fallback for cronjobs, and move some useful funct…

…ion to cmdutil



**What this PR does / why we need it**:
remove todo
relation with #42787

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-09-23 16:19:00 -07:00
Kubernetes Submit Queue 9793bb3023 Merge pull request #51684 from tcharding/lint-plugins-env
Automatic merge from submit-queue (batch tested with PRs 51031, 51705, 51888, 51727, 51684). 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>..

kubectl: Fix golint warnings for plugins/*

**What this PR does / why we need it**:

We currently have an entry in `hack/.golint_failures` for `pkg/kubectl/plugins`. If we lint the files in `plugins/` then we can safely remove this entry.
 
`golint` emits the following warnings (only one of each type shown)
```
exported method EnvList.Slice should have comment or be unexported
error var IncompletePluginError should have name of the form ErrFoo
func name will be used as plugins.PluginsEnvVarPluginLoader by other packages, and that stutters; consider calling this EnvVarPluginLoader
```

This PR clears all `golint` warnings from `kubectl/plugins/`.

1. Remove entry from `hack/.golint_failures`
2. Add missing documentation to exported types and functions.
3. Rename error variables to `ErrFoo`.
4. Rename `PluginsEnvVarPluginLoader` to `KubectlPluginsPathPluginLoader` (mirrors env var name).
5. Rename `XDGDataPluginLoader` to `XDGDataDirsPluginLoader` (to make uniform change above).

**Special notes for your reviewer**:

Felt a bit dirty doing this cleanup because the code in `plugins/` is particularly clean and well written already.

**Release note**:

```release-note
NONE
```
/sig cli
/kind cleanup
2017-09-23 01:47:11 -07:00
Kubernetes Submit Queue 52cb89751f Merge pull request #48763 from juanvallejo/jvallejo/update-set-image-local-error-message
Automatic merge from submit-queue (batch tested with PRs 47806, 49539, 48763, 47049, 50600). 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>..

Add Local and Unstructured resource builder attributes and handle <rsrsc> / <name> pairs when --local is set

**Release note**:
```release-note
NONE
```

Related downstream BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1390139

Adds an error message if a non-filename (or stdin) resource is specified with the `--local` flag in any of the `kube set ...` sub-commands.

cc @fabianofranz @kubernetes/sig-cli-misc
2017-09-22 21:20:54 -07:00
Jeff Grafton 02fb4200dc Use buildozer to delete licenses() rules 2017-09-21 15:53:22 -07:00
Jeff Grafton 532bd482df Use buildozer to remove deprecated automanaged tags 2017-09-21 15:53:22 -07:00
Guangya Liu e005da697c Fixed test issue for image validation. 2017-09-20 00:38:28 -04:00
Shiyang Wang 87abe13022 fix return 0 error in DefaultSubCommandRun 2017-09-13 10:26:51 +08:00
Ma Shimiao b4afb09ab9 small tfix in cmd factory comment
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
2017-09-12 11:17:50 +08:00
ymqytw c17103f184 Revert "remove dup pkg and update reference"
This reverts commit 93be3f7735.

Revert "update vendor kube-openapi"

This reverts commit 006f80e35d.
2017-09-06 12:30:53 -07:00
Fabiano Franz 81407cef49 Category expansion fully based on discovery 2017-09-05 17:34:42 -03:00
juanvallejo 90d76adb4b
add Local and Unstructured builder attributes
Moves DisabledClientMapperForMapping wrapper to new Local attribute.
Removes Factory#NewUnstructuredBuilder in favor of new Unstructured
builder attribute.
2017-09-05 11:57:00 -04:00
ymqytw 93be3f7735 remove dup pkg and update reference 2017-09-04 18:20:25 -07:00
zhengjiajin 44f8bb1171 remove todo(#42787)Add fallback for cronjobs, and move some useful function to cmdutil 2017-09-04 18:41:19 +08:00
Kubernetes Submit Queue 0dedd13ad7 Merge pull request #51734 from soltysh/cronjobs_beta
Automatic merge from submit-queue

Enable batch/v1beta1.CronJobs by default

This PR re-applies the cronjobs->beta back (https://github.com/kubernetes/kubernetes/pull/51720)  with the fix from @shyamjvs.

Fixes #51692

@apelisse @dchen1107 @smarterclayton ptal
@janetkuo @erictune fyi
2017-09-03 18:22:27 -07:00
Kubernetes Submit Queue 0f2a72f9f5 Merge pull request #51546 from apelisse/remove-duplicate-fake-openapi
Automatic merge from submit-queue (batch tested with PRs 51682, 51546, 51369, 50924, 51827)

Remove duplicate fake and unused openapi

**What this PR does / why we need it**:
Follow-up on PR #50404

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-09-03 15:54:16 -07:00
Maciej Szulik 6962427b35
Enable batch/v1beta1.CronJobs by default 2017-09-03 11:17:33 +02:00
Kubernetes Submit Queue 5c0b265a9b Merge pull request #50497 from dixudx/kubectl-include-uninitialized
Automatic merge from submit-queue (batch tested with PRs 51301, 50497, 50112, 48184, 50993)

Introduce new flag "--include-uninitialized" to kubectl

**What this PR does / why we need it**:

Introduce `--include-uninitialized` as a global flag to kubectl

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

**Special notes for your reviewer**:
/assign @caesarxuchao @smarterclayton @ahmetb @deads2k 

**Release note**:

```release-note
Add flag "--include-uninitialized" to kubectl annotate, apply, edit-last-applied, delete, describe, edit, get, label, set. "--include-uninitialized=true" makes kubectl commands apply to uninitialized objects, which by default are ignored if the names of the objects are not provided. "--all" also makes kubectl commands apply to uninitialized objects. Please see the [initializer](https://kubernetes.io/docs/admin/extensible-admission-controllers/) doc for more details.
```
2017-09-02 23:50:00 -07:00
Antoine Pelisse 54b9c22f2a openapi: Remove unused test structure and code. 2017-09-01 08:45:44 -07:00
Antoine Pelisse 9287eb0c3e Change default validation to openapi
And also update the test to match the new error string.
2017-09-01 08:44:36 -07:00
Kubernetes Submit Queue 0f2c2bd847 Merge pull request #50404 from apelisse/http-cache
Automatic merge from submit-queue (batch tested with PRs 51480, 49616, 50123, 50846, 50404)

Kubectl to use http caching to cache openapi responses from the server

**What this PR does / why we need it**: 

This PR is trying to address the problems raised in #50254 

> * uses a disk-based cache that is not safe between processes (does not use atomic fs operations)
> * writes get/list responses to disk that should not be cached (like kubectl get secrets)
> * is vulnerable to partially written cache responses being used as responses to future requests
> * breaks uses of the client transport that make use of websockets
> * defaults to enabling the cache for any client builder using RecommendedConfigOverrideFlags or DefaultClientConfig which affects more components than just kubectl

All of these points are addressed by this pull-request:
1. It now uses atomic fs operations
2. Doesn't cache by default, only if requested by the client (and it's only done by openapi client)
3. Fixed because of atomic fs operations
4. Found the reason for the bug: Cache wrapper couldn't be unwrapped. I implemented the `WrappedRoundTripper` interface.
5. Since 2. is fixed, I think that should be fine

@smarterclayton @liggitt 

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Allows kubectl to use http caching mechanism for the OpenAPI schema. The cache directory can be configured through `--cache-dir` command line flag to kubectl. If set to empty string, caching will be disabled.
```
2017-08-31 20:08:46 -07:00
Antoine Pelisse d7eec6b51d Revert "Enable batch/v1beta1.CronJobs by default" 2017-08-31 09:54:16 -07:00
Di Xu be0cadde2e enforce include-uninitialized in several kubectl commands 2017-08-31 16:30:56 +08:00
tcharding 0d464cac2f Rename XDGDataPluginLoader to be uniform 2017-08-31 16:38:37 +10:00
tcharding 91eaa8a308 Rename PluginsEnvVarPluginLoader to stop stutter 2017-08-31 16:38:37 +10:00
Kubernetes Submit Queue ffcd6d1dce Merge pull request #51465 from soltysh/cronjob_beta
Automatic merge from submit-queue (batch tested with PRs 50775, 51397, 51168, 51465, 51536)

Enable batch/v1beta1.CronJobs by default

This PR moves to CronJobs beta entirely, enabling `batch/v1beta1` by default.

Related issue: #41039 

@erictune @janetkuo ptal

```release-note
Promote CronJobs to batch/v1beta1.
```
2017-08-30 15:14:32 -07:00
Antoine Pelisse a97a1ba14e c-go cache: Only cache discovery requests
Only cache discovery requests, and only for kubectl.
2017-08-30 15:01:46 -07:00
Maciej Szulik 2de214b044
Enable batch/v1beta1.CronJobs by default 2017-08-29 09:31:39 +02:00
sakeven 543eaf0f58 Remove useless code
Signed-off-by: sakeven <jc5930@sina.cn>
2017-08-28 14:05:31 +08:00
Di Xu 789a95971d kubectl add global flag --include-uninitialized 2017-08-26 13:52:36 +08:00
Antoine Pelisse 332b681bd1 Revert "Revert "Merge pull request #47353 from apelisse/http-cache""
This reverts commit 4ee72eb300.
2017-08-25 08:31:49 -07:00
zhengjiajin 357db0c39c Add kubectl set env command 2017-08-25 19:53:22 +08:00
Kubernetes Submit Queue 74f4fda7be Merge pull request #51223 from apelisse/openapi-reference-first-class
Automatic merge from submit-queue (batch tested with PRs 51148, 50816, 49741, 50858, 51223)

openapi: Change references to be first-class

**What this PR does / why we need it**:
References in the openapi are currently completely hidden from the
model, and just passed through as we walk the tree. The problem is that
they can have a different description and more importantly, different
extensions.

Change them to be first-class citizen, and fully part of the model. It
means that visitors have to implement one more function and decide if
something specific should be done with references. Validation is updated
to just completely ignore them and passthrough (like it was done
before).

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-08-24 21:51:11 -07:00
Kubernetes Submit Queue 83e9cadc02 Merge pull request #50578 from pwittrock/depsutils
Automatic merge from submit-queue (batch tested with PRs 51047, 48573, 50764, 51092, 50578)

Library updates to better support removing kubectl deps on kubernetes/kubernetes

**What this PR does / why we need it**:

**Which issue this PR fixes**: kubernetes/kubectl#50

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-08-23 17:56:20 -07:00
Antoine Pelisse 5ef3516780 openapi: Change reference to be first-class
References in the openapi are currently completely hidden from the
model, and just passed through as we walk the tree. The problem is that
they can have a different description and more importantly, different
extensions.

Change them to be first-class citizen, and fully part of the model. It
means that visitors have to implement one more function and decide if
something specific should be done with references. Validation is updated
to just completely ignore them and passthrough (like it was done
before).
2017-08-23 14:11:16 -07:00
Kubernetes Submit Queue 617dc79311 Merge pull request #50554 from zhangxiaoyu-zidif/refactor-factory-test
Automatic merge from submit-queue (batch tested with PRs 50257, 50247, 50665, 50554, 51077)

Refactor kubectl factory test case with sets.String

**What this PR does / why we need it**:
change to make got and want use sets.String instead, since that is both safe and more clearly shows the intent.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-08-23 02:35:11 -07:00
zhangxiaoyu-zidif e83e799d1d fix-review 2017-08-22 10:57:48 +08:00
Phillip Wittrock bc94cd5807 More PR comments 2017-08-21 16:06:48 -07:00
Antoine Pelisse 37aacf30b5 openapi validation: Ignore unknown types
This follows the exact same logic as swagger.
2017-08-21 09:08:31 -07:00
Antoine Pelisse a950afecdc openapi-validation: Handle List special case 2017-08-21 09:08:31 -07:00
Antoine Pelisse 4e87d2d572 openapi: Handle properly empty/null fileds 2017-08-21 09:08:31 -07:00
Antoine Pelisse aa1c79f32b openapi: Use "group" to look for resources 2017-08-21 09:08:31 -07:00
Antoine Pelisse b7b5457050 Validate against OpenAPI schema (if available) 2017-08-21 08:58:42 -07:00
Phillip Wittrock 32c5d938eb Update with PR comments 2017-08-17 12:18:57 -07:00
Jeffrey Regan dbc22ad6fd Remove kubectl's dependence on schema file in pkg/api/validation.
**What this PR does / why we need it**:

Makes functions in validation/schema.go private to kubectl,
further isolating kubectl.

**Which issue this PR fixes**

Part of a series of PRs to address kubernetes/community#598

**Release note**:
```release-note
NONE
```
2017-08-16 16:38:28 -07:00
Phillip Wittrock aca62a1741 Address PR comments 2017-08-16 14:22:32 -07:00
Dr. Stefan Schimanski c0dbe9a900 kubectl: simplify deepcopy calls 2017-08-16 10:58:51 +02:00
Kubernetes Submit Queue efe47a3988 Merge pull request #50023 from tcharding/kubectl-options
Automatic merge from submit-queue (batch tested with PRs 50023, 50639)

Correct case for starting character of option string

**What this PR does / why we need it**:

Kubectl-conventions.md states:

   "Flag descriptions should start with an uppercase letter and not have a period at the end of a sentence"

There are numerous cases where this is violated in `kubectl/cmd`. This PR is the result of an audit of all source files under `kublet/cmd` and corrects the case of the initial Flag description character.

/sig cli
/kind cleanup
/kind documentation

**Release note**:
```release-note
NONE
```
2017-08-15 11:23:53 -07:00
Phillip Wittrock e97a18b435 Support for using a client-go client from kubectl 2017-08-13 12:52:29 -07:00
Kubernetes Submit Queue 577fdf91c2 Merge pull request #50205 from dixudx/fix_kubectl_edit_panic_nil_list
Automatic merge from submit-queue (batch tested with PRs 50537, 49699, 50160, 49025, 50205)

not allowing "kubectl edit <resource>" when you got an empty list

**What this PR does / why we need it**:
`kubectl edit` will panic when adding an empty list.

> panic: runtime error: index out of range

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

**Special notes for your reviewer**:
/assign @errordeveloper @mengqiy @janetkuo @fabianofranz
/cc @rootfs @soltysh @sttts

**Release note**:

```release-note
not allowing "kubectl edit <resource>" when you got an empty list
```
2017-08-11 19:44:04 -07:00
Antoine Pelisse ba11c7370f openapi: Add validation logic
This allows validation of a yaml/json object against an openapi schema.
A lot more testing would be needed to validate the logic, and also this
is not plumbed in, so it can't be used by kubectl yet.
2017-08-11 17:02:31 -07:00
Antoine Pelisse eb735bfeb0 openapi: Move Fakes to testing package 2017-08-11 15:28:04 -07:00
Jeff Grafton a7f49c906d Use buildozer to delete licenses() rules except under third_party/ 2017-08-11 09:32:39 -07:00
Jeff Grafton 33276f06be Use buildozer to remove deprecated automanaged tags 2017-08-11 09:31:50 -07:00
Jeff Grafton cf55f9ed45 Autogenerate BUILD files 2017-08-11 09:30:23 -07:00
Di Xu 6b2f3c81e2 forbid kubectl edit an empty list 2017-08-11 08:44:13 +08:00
tcharding be04ad4aca Correct case for starting character of option string 2017-08-11 07:24:08 +10:00
Kubernetes Submit Queue 4dc4c3c4a4 Merge pull request #49624 from guangxuli/fix_daemonset_resource_type
Automatic merge from submit-queue (batch tested with PRs 50306, 49624)

Add daemonset to all categories

**What this PR does / why we need it**:
We could get daemonset resource by running command `kubectl get all`.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #
fix https://github.com/kubernetes/kubernetes/issues/49620
2017-08-10 06:27:19 -07:00
Kubernetes Submit Queue 6aeb790582 Merge pull request #49830 from jianglingxia/jlx72916
Automatic merge from submit-queue (batch tested with PRs 50418, 49830, 49206, 49061, 49912)

Renamed packge name to apiv1

**What this PR does / why we need it**:
Renamed packge name from k8s_api_v1 to apiv1
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-08-09 22:07:15 -07:00
Kubernetes Submit Queue 212928ad14 Merge pull request #49930 from soltysh/remove_scheduledjobs
Automatic merge from submit-queue (batch tested with PRs 50016, 49583, 49930, 46254, 50337)

Remove scheduledjobs

This is a prerequisite for promoting CronJobs to beta.

**Release note**:
```release-note
Remove deprecated ScheduledJobs endpoints, use CronJobs instead.
```
2017-08-09 14:14:30 -07:00
Kubernetes Submit Queue 190ee708a6 Merge pull request #48659 from shiywang/fix-sort
Automatic merge from submit-queue

Fix sort-by output problem

Fixes https://github.com/kubernetes/kubectl/issues/43

This bug was original introduced in pr here: https://github.com/kubernetes/kubernetes/pull/46265, I think next time if we touch something printer related package, maybe should let @smarterclayton have a review, although he is pretty busy I guess : ) and that package also changed a lot recently since he's been working on refactoring.
 
this is a quick and dirty fix, not sure if there's better way, I will add some regression test soon...

@kubernetes/sig-cli-pr-reviews 

```release-note
NONE
```

/assign @mengqiy 
/assign @smarterclayton
2017-08-09 10:56:49 -07:00
Kubernetes Submit Queue a5b4899ae2 Merge pull request #49223 from alexandercampbell/kubectl-impl-only-structuredgenerator
Automatic merge from submit-queue

kubectl: deploy generators don't need to impl Generator iface

The `kubectl create deployment` generators do not need to implement the Generator interface, since they are only used as implementations of the StructuredGenerator interface. I was able to delete some tests of their Generator methods as part of this change.

### Considerations for code reviewers

1. Every other StructuredGenerator implementation implements the Generator interface in additional. My change makes the "create deployment" generators a little unusual. I've added a docstring to this effect in `util/factory_client_access.go`.
2. This significantly reduces the maintenance / testing burden for future updates to `kubectl create deployment`.

**Release note**:

```release-note
NONE
```
2017-08-08 19:04:34 -07:00
Maciej Szulik e465962bf7
Remove ScheduledJobs support 2017-08-08 15:22:26 +02:00
Kubernetes Submit Queue 187e6ab0bc Merge pull request #50254 from liggitt/revert-disk-cache
Automatic merge from submit-queue (batch tested with PRs 50254, 50174, 50179)

Revert "Merge pull request #47353 from apelisse/http-cache"

Some issues were discovered with the caching merged in #47353:
* uses a disk-based cache that is not safe between processes (does not use atomic fs operations)
* writes get/list responses to disk that should not be cached (like `kubectl get secrets`)
* is vulnerable to partially written cache responses being used as responses to future requests
* breaks uses of the client transport that make use of websockets
* defaults to enabling the cache for any client builder using RecommendedConfigOverrideFlags or DefaultClientConfig which affects more components than just kubectl

This reverts commit fc89743dca, reversing changes made to 29ab38e898.
2017-08-08 04:02:51 -07:00
Kubernetes Submit Queue 535c0f6ff4 Merge pull request #46760 from xilabao/fix-parse-pairs
Automatic merge from submit-queue (batch tested with PRs 49524, 46760, 50206, 50166, 49603)

fix parse pairs

**What this PR does / why we need it**:
add check to `-`
```
# kubectl label pod foo -               
error: at least one label update is required
See 'kubectl label -h' for help and examples.
```

**Which issue this PR fixes**: 

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-08-07 13:51:57 -07:00
Jordan Liggitt 4ee72eb300
Revert "Merge pull request #47353 from apelisse/http-cache"
This reverts commit fc89743dca, reversing
changes made to 29ab38e898.
2017-08-07 16:20:34 -04:00
Antoine Pelisse a1d0384e82 openapi: Remove cache mechanism
The cache will be removed and replaced with HTTP Etag caching instead.
This patch is simply removing the existing mechanism.
2017-08-04 14:36:32 -07:00
Alexander Campbell 079883fe44 kubectl: deploy generators don't need to impl Generator iface
I was able to delete some outdated tests as part of this change.
2017-07-31 12:26:17 -07:00
jianglingxia 9e8d4b4188 Renamed packge name to apiv1 2017-07-29 16:47:14 +08:00
Kubernetes Submit Queue bc3c5bc0d6 Merge pull request #49146 from apelisse/openapi-new-structure
Automatic merge from submit-queue (batch tested with PRs 49665, 49689, 49495, 49146, 48934)

openapi: refactor into more generic structure

**What this PR does / why we need it**:
Refactor the openapi schema to be a more generic structure that can be
"visited" to get more specific types. Will be used by validation.

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-07-27 21:45:36 -07:00
guangxuli 7db36811be add daemonset to all categories 2017-07-26 15:41:47 +08:00
shashidharatd d51ae181a5 Auto generated files 2017-07-26 06:22:30 +05:30
shashidharatd dbbcb568d4 Converted usage of federation internal clientset to versioned clientset 2017-07-26 06:20:08 +05:30
Antoine Pelisse 064f806424 openapi: refactor into more generic structure
Refactor the openapi schema to be a more generic structure that can be
"visited" to get more specific types.
2017-07-25 11:45:29 -07:00
Kubernetes Submit Queue 1dbe09b1f6 Merge pull request #49326 from deads2k/cli-16-all
Automatic merge from submit-queue

add cronjobs to all

Categories were added to the discovery API, but the `kubectl` plumbing didn't make it.  We *did* make `kubectl all` gate on discovery information, so it can least be a superset.  

`cronjobs` are user resources, so I've added them to the list.

@kubernetes/sig-cli-misc 

```release-note
added cronjobs.batch to all, so kubectl get all returns them.
```
2017-07-21 23:18:58 -07:00
deads2k 1477b407c7 add cronjobs to all 2017-07-21 10:56:26 -04:00
ymqytw 9b393a83d4 update godep 2017-07-20 11:03:49 -07:00
ymqytw 3dfc8bf7f3 update import 2017-07-20 11:03:49 -07:00
deads2k a67255c170 make sure that the template param is the right type before using it 2017-07-18 13:48:29 -04:00
Shiyang Wang f1afc3d09d fix sort-by output problem 2017-07-17 10:26:34 +08:00
Kubernetes Submit Queue 8ce6378512 Merge pull request #46091 from xilabao/new-output-in-edit
Automatic merge from submit-queue (batch tested with PRs 46091, 48280)

allow output patch string in edit command

**What this PR does / why we need it**:
allow user to get the patch from edit command if user is not familiar with the patch format.

```
# ./cluster/kubectl.sh create role a --verb=get,list --resource=no
role "a" created

# ./cluster/kubectl.sh edit role a --output-patch=true
Patch: {"rules":[{"apiGroups":[""],"resources":["nodes"],"verbs":["get","list","delete"]}]}
role "a" edited

# ./cluster/kubectl.sh create role b --verb=get,list --resource=no
role "b" created

# ./cluster/kubectl.sh patch role b -p '{"rules":[{"apiGroups":[""],"resources":["nodes"],"verbs":["get","list","delete"]}]}'
role "b" patched
```
**Which issue this PR fixes**: fixes #47173

**Special notes for your reviewer**:

**Release note**:

```release-note
Could get the patch from kubectl edit command
```
2017-07-16 18:04:42 -07:00
Kubernetes Submit Queue fdb3b2af70 Merge pull request #48578 from fabianofranz/run_output_message_on_container_error
Automatic merge from submit-queue (batch tested with PRs 48578, 48895, 48958)

run must output message on container error

**What this PR does / why we need it**: `kubectl run` must output a message (instead of just exiting with an error code) on container error.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes https://github.com/openshift/origin/issues/15031 found in OpenShift

**Release note**:

```release-note
NONE
```
2017-07-14 13:45:51 -07:00
deads2k 0801ded425 remove dead code 2017-07-07 09:12:29 -04:00
Fabiano Franz f623b9b42f run must output message on container error 2017-07-07 00:33:48 -03:00
Kubernetes Submit Queue 73a94eac9e Merge pull request #48299 from mengqiy/kubectl_term
Automatic merge from submit-queue (batch tested with PRs 47918, 47964, 48151, 47881, 48299)

move term to kubectl/util

move term from pkg/util/term to pkg/kubectl/util/term

remove dependency of `k8s.io/kubernetes/pkg/util/term` for `pkg/kubelet/dockershim/exec.go` and `pkg/kubelet/dockershim/exec.go`

Ref: https://github.com/kubernetes/kubernetes/issues/48209

```release-note
NONE
```
/assign @apelisse @monopole 

cc: @pwittrock
2017-06-30 18:42:42 -07:00
Kubernetes Submit Queue 9c74026ffc Merge pull request #46803 from apelisse/new-download-openapi
Automatic merge from submit-queue (batch tested with PRs 43558, 48261, 42376, 46803, 47058)

OpenAPI downloads protobuf rather than Json

**What this PR does / why we need it**: 
The current implementation of the OpenAPI getter fetches the swagger in a Json format from the apiserver. The Json file is big (~1.7mb), which means that it takes a long time to download, and then a long time to parse. Because that is going to be needed on each `kubectl` run later, we want this to be as fast as possible.

The apiserver has been modified to be able to return a protobuf version of the swagger, which this patch intends to use.

Note that there is currently no piece of code that exists that allows us to go from the protobuf version of the file, back into Json and/or `spec.Swagger`. Because the protobuf is not very different (but significantly different enough that it can't be translated), I've updated the code to use `openapi_v2.Document` (the protobuf type) everywhere rather than `spec.Swagger`. The behavior should be identical though.

There are more changes that are coming in follow-up pull-requests: using the gzip version (also provided by the new apiserver) to even further reduce the size of the downloaded content, and use the HTTP Etag cache mechanism to completely get rid of recurrent fetch requests. I'm currently working on these two features.

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-06-30 16:28:48 -07:00
ymqytw f0ce897277 move term to kubectl/util 2017-06-30 15:00:24 -07:00
ymqytw 2510a47374 move crlf to kubectl/util 2017-06-29 15:48:41 -07:00