Commit Graph

2220 Commits (904b02075623d762c9a8f5580dfbb7c58f6dd743)

Author SHA1 Message Date
Clayton Coleman 469df12038
refactor: move ListOptions references to metav1 2017-01-23 17:52:46 -05:00
Kubernetes Submit Queue 5ea80569ae Merge pull request #40227 from deads2k/client-11-easy
Automatic merge from submit-queue

make client-go tools/auth and tools/clientcmd authoritative

These moved easily.  Pure mechanical.  I'll have a couple snip pulls for some of the more complicated packages.  `pkg/util/homedir` was a transitive that moved with. It was only used in `kubectl` and you'd need it to be consistent with `clientcmd` loading order.

@sttts
2017-01-23 09:07:17 -08:00
Kubernetes Submit Queue 1f1f3692bd Merge pull request #38445 from brendandburns/configmap2
Automatic merge from submit-queue (batch tested with PRs 38445, 40292)

Add the ability to edit fields within a config map.

Addresses part of https://github.com/kubernetes/kubernetes/issues/36222

Example command:

```console
$ kubectl edit configmap foo --config-map-data=bar
```

Will open the data element named `bar` in the `ConfigMap` named `foo` in `$EDITOR`, the edited contents are then updated back to the config map.

@kubernetes/sig-cli 

```release-note
Add a special purpose tool for editing individual fields in a ConfigMap with kubectl
```
2017-01-23 08:11:06 -08:00
deads2k 335ef747d6 mechanical 2017-01-23 10:03:55 -05:00
xilabao 93c63d76e8 fix --save-config in create subcommand 2017-01-23 15:15:37 +08:00
Kubernetes Submit Queue 6b293d4c13 Merge pull request #40242 from mikedanese/csr-get-help
Automatic merge from submit-queue (batch tested with PRs 40120, 40242)

add csr to kubectl get help
2017-01-20 16:25:46 -08:00
Kubernetes Submit Queue ffb2dc2e02 Merge pull request #40187 from tianshapjq/adjust-delete-pod-uid-helpinfo
Automatic merge from submit-queue (batch tested with PRs 40187, 40231, 40152)

remove the delete-pod-uid spec

**What this PR does / why we need it**:
remove the specifications about "kubectl delete pod uid" cause it's no longer supported.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #40121
2017-01-20 13:29:45 -08:00
Mike Danese e1491aa788 add csr to kubectl get help 2017-01-20 13:14:51 -08:00
Kubernetes Submit Queue 85d328f8da Merge pull request #40189 from xilabao/patch-5
Automatic merge from submit-queue (batch tested with PRs 37228, 40146, 40075, 38789, 40189)

update short help message in set resource

To keep the help message well-formed.
```
#kubectl set -h           
Configure application resources 

These commands help you make changes to existing application resources.

Available Commands:
  image       Update image of a pod template
  resources   update resource requests/limits on objects with pod templates
  selector    Set the selector on a resource

Usage:
  kubectl set SUBCOMMAND [options]
```

```release-note
NONE
```
2017-01-20 12:34:59 -08:00
deads2k ee6752ef20 find and replace 2017-01-20 08:04:53 -05:00
deads2k c587b8a21e re-run client-gen 2017-01-20 08:02:36 -05:00
Kubernetes Submit Queue 71802d2dc1 Merge pull request #40023 from soltysh/completions_boilerplate
Automatic merge from submit-queue (batch tested with PRs 39446, 40023, 36853)

Allow setting copyright header file for generated completions

This PR allows downstream vendors (like openshift) to generate completions with custom header, similarly to other generated code.

@fabianofranz ptal
@kubernetes/sig-cli-misc fyi
2017-01-19 18:53:47 -08:00
xilabao 5b3d59c235 update short help message in set resource 2017-01-19 18:53:43 -06:00
tianshapjq 69946cf886 remove the delete-pod-uid spec 2017-01-20 08:16:20 +08:00
Kubernetes Submit Queue e9d4e4341c Merge pull request #40087 from deads2k/generic-24-move-fields
Automatic merge from submit-queue

move pkg/fields to apimachinery

Purely mechanical move of `pkg/fields` to apimachinery.  

Discussed with @lavalamp on slack.  Moving this an `labels` to apimachinery.

@liggitt any concerns?  I think the idea of field selection should become generic and this ends up shared between client and server, so this is a more logical location.
2017-01-19 08:48:17 -08:00
Kubernetes Submit Queue 05c2a0825e Merge pull request #38871 from k82cn/k8s_25318
Automatic merge from submit-queue

Made multi-scheduler graduated to Beta and then v1.

fixes #25318
2017-01-19 07:58:51 -08:00
Maciej Szulik 56147c5174 Allow setting copyright header file for generated completions 2017-01-19 16:06:20 +01:00
deads2k 11e8068d3f move pkg/fields to apimachinery 2017-01-19 09:50:16 -05:00
deads2k 6c6616b41c move restclient/watch 2017-01-19 07:39:20 -05:00
deads2k cdb2934bbc remove kubernetes copy of clientcmd types 2017-01-19 07:39:19 -05:00
Klaus Ma c8c4b81963 Made multi-scheduler graduated to Beta and then v1. 2017-01-19 20:16:01 +08:00
Kubernetes Submit Queue 723fa08767 Merge pull request #39324 from wojtek-t/change_patch_api
Automatic merge from submit-queue

Prepare for using optimized conversion to/from map[string]interface{} in Patch operation

Ref #39017
2017-01-19 00:50:12 -08:00
Kubernetes Submit Queue 4520819df7 Merge pull request #39042 from juanvallejo/jvallejo/dont-filter-pods-if-json-or-yaml
Automatic merge from submit-queue (batch tested with PRs 36467, 36528, 39568, 40094, 39042)

do not filter kubectl get pods if -o json or yaml

Fixes: https://github.com/kubernetes/kubernetes/issues/38327

This patch sets the value of --show-all to true if the output format
specified is 'json' or 'yaml'.

**Release note**:
```release-note
release-note-none
```

@smarterclayton
2017-01-18 13:37:13 -08:00
juanvallejo 713df3d74e
remove check for multiple resource types 2017-01-18 13:26:13 -05:00
Jordan Liggitt e49554501f
Use versioned Taint/Toleration/AllowPods objects when marshalling 2017-01-18 12:52:14 -05:00
Wojciech Tyczynski d08abdb187 Allow for returning map[string]interface{} from patch. 2017-01-18 11:53:30 +01:00
Zihong Zheng 6b9860cf54 Allows kubectl create -f to filter by selector. 2017-01-17 19:18:51 -08:00
juanvallejo 430283b973 add OutputsRawFormat helper; default show-all on multiple resource kinds 2017-01-17 17:07:35 -05:00
Clayton Coleman bcde05753b
Correct import statements 2017-01-17 16:18:18 -05:00
Clayton Coleman 9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
Clayton Coleman 36acd90aba
Move APIs and core code to use metav1.ObjectMeta 2017-01-17 16:17:18 -05:00
Kubernetes Submit Queue f7305e6f43 Merge pull request #39974 from deads2k/api-60-move-patch
Automatic merge from submit-queue

Move PatchType to apimachinery/pkg/types

Fixes https://github.com/kubernetes/kubernetes/issues/39970

`PatchType` is shared by the client and server, they have to agree, and its critical for our API to function.

@smarterclayton @kubernetes/sig-api-machinery-misc
2017-01-17 07:29:06 -08:00
deads2k f31ecdd0f7 generated changes 2017-01-17 08:32:05 -05:00
deads2k 26c46971f2 move PatchType to apimachinery 2017-01-17 08:32:05 -05:00
Dr. Stefan Schimanski 52f6831576 genericapiserver: cut off kube pkg/version dependency 2017-01-17 12:34:05 +01:00
Maciej Szulik 4a0c9fa536 Fix ScheduledJob -> CronJob rename leftovers 2017-01-17 09:24:07 +01:00
Kubernetes Submit Queue 4937b05a46 Merge pull request #39853 from xingzhou/typo
Automatic merge from submit-queue

Fixed typo.
2017-01-16 20:44:43 -08:00
Kubernetes Submit Queue 6fe8ed738d Merge pull request #39401 from AdoHe/delete_refactor
Automatic merge from submit-queue (batch tested with PRs 39806, 39887, 39401)

refactor delete to remove cobra dependency

FYI. As part of CLI Q1 roadmap, we would like to reduce the dependency of Cobra from actual commands implementations. In this PR, I tried to refactor delete command to achieve this. @kubernetes/sig-cli-misc a quick review is quite welcome, and I am just working on more PRs.
2017-01-16 13:41:36 -08:00
Kubernetes Submit Queue adbf6c6eb6 Merge pull request #39887 from juanvallejo/jvallejo/export-list-of-user-resources
Automatic merge from submit-queue (batch tested with PRs 39806, 39887, 39401)

export list of user resources

This patch exports the list of "userResources" found in
`pkg/kubectl/cmd/util/shortcut_resmapper.go` to allow its use in
external packages and clients.

Related downstream PR: https://github.com/openshift/origin/pull/12147

**Release note**:
```release-note
release-note-none
```

cc @deads2k
2017-01-16 13:41:35 -08:00
Kubernetes Submit Queue 6defc30337 Merge pull request #39882 from deads2k/api-59-errors
Automatic merge from submit-queue (batch tested with PRs 38592, 39949, 39946, 39882)

move api/errors to apimachinery

`pkg/api/errors` is a set of helpers around `meta/v1.Status` that help to create and interpret various apiserver errors.  Things like `.NewNotFound` and `IsNotFound` pairings.  This pull moves it into apimachinery for use by the clients and servers.

@smarterclayton @lavalamp First commit is the move plus minor fitting.  Second commit is straight replace and generation.
2017-01-16 10:37:42 -08:00
deads2k 77b4d55982 mechanical 2017-01-16 09:35:12 -05:00
xilabao 8acbbb21e1 fix example in set selector
example run failed
2017-01-16 01:55:30 -06:00
AdoHe d6d82425a4 refactor delete to remove cobra dependency 2017-01-15 15:30:06 +08:00
Brendan Burns 31eca372c9 Add the ability to edit fields within a config map. 2017-01-14 21:12:27 -08:00
Kubernetes Submit Queue a6fa5c2bfd Merge pull request #39814 from deads2k/api-58-multi-register
Automatic merge from submit-queue

replace global registry in apimachinery with global registry in k8s.io/kubernetes

We'd like to remove all globals, but our immediate problem is that a shared registry between k8s.io/kubernetes and k8s.io/client-go doesn't work.  Since client-go makes a copy, we can actually keep a global registry with other globals in pkg/api for now.

@kubernetes/sig-api-machinery-misc @lavalamp @smarterclayton @sttts
2017-01-13 12:37:02 -08:00
juanvallejo 95437a941f export list of user resources
This patch exports the list of "userResources" found in
`pkg/kubectl/cmd/util/shortcut_resmapper.go` to allow its use in
external packages and clients.
2017-01-13 14:48:47 -05:00
deads2k f1176d9c5c mechanical repercussions 2017-01-13 08:27:14 -05:00
Xing Zhou 695c27287b Fixed typo.
Fixed variable sequence typo in kubectl create sub-command tests.
2017-01-13 12:54:15 +08:00
Robert Rati 6a3ad93d6c [scheduling] Moved pod affinity and anti-affinity from annotations to api
fields. #25319
2017-01-12 14:54:29 -05:00
Kubernetes Submit Queue 6e5b455b77 Merge pull request #39038 from ncdc/fix-kubectl-get-list
Automatic merge from submit-queue

Fix kubectl get -f <file> -o <nondefault printer> so it prints all items in the file

**What this PR does / why we need it**: Fix kubectl get -f <file> -o <nondefault printer> so it prints all the objects in the file, instead of just the first one. Also add a test for this feature.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
```

cc @AdoHe @deads2k @liggitt @fabianofranz @kubernetes/kubectl @kubernetes/sig-cli-misc
2017-01-11 09:58:38 -08:00
Andy Goldstein 613ada4cd7 Fix kubectl get -f <file> -o <nondefault printer>
Fix kubectl get -f <file> -o <nondefault printer> so it prints all the
objects in the file, instead of just the first one. Also add a test for
this feature.
2017-01-11 10:30:13 -05:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Kubernetes Submit Queue 748e8f6b1c Merge pull request #39540 from pwittrock/kubectldocs
Automatic merge from submit-queue (batch tested with PRs 39673, 39536, 39617, 39540, 39686)

Improve kubectl help with examples.

```release-note
NONE
```
2017-01-10 20:38:19 -08:00
Kubernetes Submit Queue 9ef9630976 Merge pull request #39486 from ncdc/allow-missing-keys-in-templates
Automatic merge from submit-queue (batch tested with PRs 39486, 37288, 39477, 39455, 39542)

Allow missing keys in templates by default

Switch to allowing missing keys in jsonpath templates by default.

Add support for allowing/disallowing missing keys in go templates
(default=allow).

Add --allow-missing-template-keys flag to control this behavior (default=true /
allow missing keys).

Fixes #37991

@kubernetes/sig-cli-misc @kubernetes/api-reviewers @smarterclayton @fabianofranz @liggitt @pwittrock
2017-01-10 14:33:10 -08:00
juanvallejo cade00e646
do not filter kubectl get pods if -o json or yaml
This patch sets the value of --show-all to true if the output format
specified is 'json' or 'yaml'.
2017-01-10 14:42:38 -05:00
Andy Goldstein 80c5cd8b88 Allow missing keys in templates by default
Switch to allowing missing keys in jsonpath templates by default.

Add support for allowing/disallowing missing keys in go templates
(default=allow).

Add --allow-missing-template-keys flag to control this behavior
(default=true / allow missing keys).
2017-01-09 10:35:46 -05:00
Clayton Coleman c5d755dbec
Refactor tests to match new versioned code structure 2017-01-06 23:45:03 -05:00
Clayton Coleman e5019de260
refactor: Move versioned/watch to meta/v1 2017-01-06 23:45:03 -05:00
Phillip Wittrock dc2fffe5d4 Improve kubectl help with examples. 2017-01-06 13:35:43 -08:00
Kubernetes Submit Queue fd3498483b Merge pull request #38835 from p0lyn0mial/shortcutexpander_take_res_from_hardcoded
Automatic merge from submit-queue

ShortcutExpander has been extended in a way that it will examine a ha…

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

ShortcutExpander has been extended in a way that it will examine a hardcoded list of tuples anticipated from the server when searching for an alternative name for the resource.

Note that the list is ordered and the first match will yield the extended resource's name.

One important thing to highlight is that the ShortcutExpander will fall back to PriorityRestMaper to determine the group for the resource.

Also this PR introduces a new shortcut namely sc which will resolve to storageclasses within storage.k8s.io group


**Special notes for your reviewer**: You might want to see https://github.com/kubernetes/kubernetes/pull/38755

**Release note**:

```release-note
```
2017-01-06 10:36:01 -08:00
Jeff Grafton 20d221f75c Enable auto-generating sources rules 2017-01-05 14:14:13 -08:00
Kubernetes Submit Queue acc81d6d96 Merge pull request #39291 from xilabao/fix-set-selector
Automatic merge from submit-queue (batch tested with PRs 38766, 39291)

fix kubectl set selector

fix #39290
2017-01-05 03:36:18 -08:00
Kubernetes Submit Queue 17f8d82fa3 Merge pull request #39359 from tianshapjq/add-top-specification
Automatic merge from submit-queue

add some specifications on the top command

**What this PR does / why we need it**:
the top command is available when heapster works fine on the server, but the specifications doesn't mention about this. So I added some specifications here.
2017-01-04 08:45:54 -08:00
Kubernetes Submit Queue ee03b9b206 Merge pull request #39400 from xilabao/fix-wrong-help-message-for-taint
Automatic merge from submit-queue (batch tested with PRs 39409, 39400)

fix wrong help message for taint

fix #39381
2017-01-04 08:03:10 -08:00
xilabao a8b15492b4 fix wrong help message for taint 2017-01-04 11:14:25 +08:00
xilabao 78a0fb1e5a fix kubectl set selector 2017-01-04 10:34:24 +08:00
tianshapjq 2c2dba67fd modify the specifications 2017-01-04 09:12:24 +08:00
Kubernetes Submit Queue 3951ae4e1d Merge pull request #38112 from juanvallejo/jvallejo/add-output-format-support-kubectl-create
Automatic merge from submit-queue

Add json,yaml output format support to kubectl create, kubectl apply

Fixes: https://github.com/kubernetes/kubernetes/issues/37390

**Release note**:
```release-note
Added support for printing in all supported `--output` formats to `kubectl create ...` and `kubectl apply ...`
```

This patch adds the ability to specify an output format other than
"name" to `kubectl create ...`. It can be used in conjunction with the
`--dry-run` option. Converts unstructured objects into known types in
order to support all `--output` values.

The patch prints `*resource.Info`s returned by the server. If a resource does not yet exist (and the `--dry-run` option is not set), the resource is created and printed in the specified format.

@kubernetes/cli-review @fabianofranz
2017-01-03 14:18:33 -08:00
Kubernetes Submit Queue 2a89179046 Merge pull request #39070 from shiywang/remove_unused_param
Automatic merge from submit-queue (batch tested with PRs 39022, 39331, 39070, 39344)

remove unused parameter
2017-01-03 10:32:22 -08:00
Kubernetes Submit Queue 7a9dddbbfc Merge pull request #39126 from xilabao/update-prompt-in-create-rolebinding/clusterrolebinding
Automatic merge from submit-queue (batch tested with PRs 39092, 39126, 37380, 37093, 39237)

update prompt in create rolebinding/clusterrolebinding
2017-01-03 09:45:20 -08:00
Mike Danese 161c391f44 autogenerated 2016-12-29 13:04:10 -08:00
Kubernetes Submit Queue 897c48e75f Merge pull request #39053 from tanshanshan/fix-help2
Automatic merge from submit-queue (batch tested with PRs 39053, 36446)

fix --no-header help description

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

the current description is
>  --no-headers=false: When using the default or custom-column output format, don't print headers.

but ,

>  kubectl get po

 the header has been printing , so  the default condition is printing headers.

> kubectl get po --no-headers=true

 the header  has been not printing

> kubectl get po --no-headers=false

 the header  has been printing

So , I  fixed the help description

Thanks.

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2016-12-28 19:07:04 -08:00
tianshapjq a153f6f885 add some specifications on the top command 2016-12-29 08:44:45 +08:00
Kubernetes Submit Queue 3a2492f4d6 Merge pull request #39218 from luksa/kubectl_top_short_forms
Automatic merge from submit-queue

Kubectl top now also accepts short forms for "node" and "pod" ("no", "po")

**What this PR does / why we need it**:
People are used to typing `kubectl get po` and will expect `kubectl top po` to also work (without having to type the full resource name).
2016-12-28 15:47:11 -08:00
Kubernetes Submit Queue 9ce8f10a4d Merge pull request #39172 from foxish/fix-help
Automatic merge from submit-queue

Add PDB to kubectl get --help.

**What this PR does / why we need it**: Adds PDB to kubectl get --help

**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/kubernetes/kubernetes/issues/39100

**Release note**:

```release-note
NONE
```

/cc @saad-ali @mwielgus
2016-12-27 13:19:36 -08:00
Kubernetes Submit Queue 1ee7163308 Merge pull request #36802 from brendandburns/i18n
Automatic merge from submit-queue

Begin paths for internationalization in kubectl

This is just the first step, purposely simple so we can get the interface correct.

@kubernetes/sig-cli @deads2k
2016-12-24 13:09:12 -08:00
Marko Luksa 764e8bd6c6 Kubectl top now also accepts short forms for "node" and "pod" ("no" and "po") 2016-12-24 17:25:08 +01:00
Brendan Burns 277306449b Add initial translation support. 2016-12-23 20:45:52 -08:00
Kubernetes Submit Queue b3fb6cb5fb Merge pull request #35191 from SamiHiltunen/commas-in-secrets
Automatic merge from submit-queue

kubectl: commas in --from-literal on secret creation

Closes #35185

``` release-note
Fixes an issue where commas were not accepted in --from-literal flags when creating secrets. Passing multiple values separated by a comma in a single --from-literal flag is no longer supported. Please use multiple --from-literal flags to provide multiple values.
```
2016-12-23 08:04:50 -08:00
Anirudh 7f0bcb3688 Add PDB to kubectl get --help. 2016-12-22 14:47:11 -08:00
p0lyn0mial ad688d7761 ShortcutExpander has been extended in a way that it will examine a hardcoded list of tuples anticipated from the server when
searching for an alternative name for the resource. Note that the list is ordered and the first match will yield the extended resource's name.

One important thing to highlight is that the ShortcutExpander will fall back to PriorityRestMaper to determine the group for
the resource. Also this PR introduces a new shortcut namely sc which will resolve to storageclasses within storage.k8s.io group

In addition the type of kubectl.ShortForms has been changed to ResourceShortcuts struct. It has got a brand new name,
it was also extended and ordered by group.
2016-12-22 17:29:52 +01:00
xilabao 528a8d7d52 update prompt in create rolebinding/clusterrolebinding 2016-12-22 11:33:49 +08:00
tanshanshan 565a53871d fix help 2016-12-22 09:48:24 +08:00
deads2k 8b25c21e79 add create rolebinding 2016-12-21 09:03:27 -05:00
Angus Salkeld 17a711d8fd Add new command "kubectl set selector" 2016-12-21 12:30:56 +01:00
Shiyang Wang 9d037a0ab6 remove unused parameter 2016-12-21 16:09:51 +08:00
Kubernetes Submit Queue 874fca652d Merge pull request #38086 from tianshapjq/reduce-decode-times
Automatic merge from submit-queue

Reduce decode times by changing the kubectl.Filter(runtime.Object, *PrintOptions)'s return values

**What this PR does / why we need it**:
In kubectl/cmd/get.go, we use the function filterFuncs.Filter() to decode data and filter the object. But in the following function printer.PrintObj() decodes the data again.
I made these modifications to reduce the decoding times by changing the filterFuncs.Filter()'s returned values. We can get the decoded object from this function and pass it to the following printer.PrintObj(), so not to waste time to decode again.
2016-12-19 16:23:02 -08:00
Kubernetes Submit Queue d6046aab0e Merge pull request #38903 from deads2k/cli-16-fix-generic-create
Automatic merge from submit-queue (batch tested with PRs 38080, 38903)

prevent negotation on connections that dont' require it

Not all clientconfigs require negotiation.  Before there was a patch (hardcoded to an instance variable) that allowed this.  This updates the code to allow the same as before.

@kubernetes/sig-cli @fabianofranz

@ncdc you'll want to pick
2016-12-19 07:42:45 -08:00
Maciej Szulik 9f064c57ce Remove extensions/v1beta1 Job 2016-12-17 00:07:24 +01:00
deads2k 9b507e8603 prevent negotation on connections that dont' require it 2016-12-16 16:26:55 -05:00
Robert Rati 91931c138e [scheduling] Moved node affinity from annotations to api fields. #35518 2016-12-16 11:42:43 -05:00
Kubernetes Submit Queue e2a9fc1022 Merge pull request #38841 from mikedanese/fix-tests
Automatic merge from submit-queue

bazel: fix some unit tests
2016-12-15 20:19:46 -08:00
Mike Danese 8fdec87d19 bazel: fix some unit tests 2016-12-15 18:36:22 -08:00
tianshapjq 1453cd6264 reduce decoding times by changing kubectl.Filter(runtime.Object, *PrintOptions)'s return value 2016-12-16 09:37:11 +08:00
deads2k 50f6733800 make kubectl factory rings 2016-12-15 15:18:16 -05:00
Derek Carr f1af1e965a Fix typo in drain command 2016-12-14 13:00:25 -05:00
Kubernetes Submit Queue 7b8ecda289 Merge pull request #38743 from caesarxuchao/remove
Automatic merge from submit-queue

Remove accidentally committed files

Accidentally committed in #37534.
2016-12-13 20:44:16 -08:00
Chao Xu 411128f294 remove wrongly committed files 2016-12-13 19:44:51 -08:00
Kubernetes Submit Queue 085f0d74dc Merge pull request #38538 from juanvallejo/jvallejo/dont-report-success-if-obj-not-patched
Automatic merge from submit-queue

Prevent "patched" output on obj not patched

**Release note**:
```release-note
release-note-none
```

This patch compares an original object against a patched object returned
from the server and only announces that the object was successfully
patched if the object returned from the server does not equal the
original object.

@fabianofranz @kubernetes/cli-review
2016-12-13 10:42:26 -08:00
Mike Danese c87de85347 autoupdate BUILD files 2016-12-12 13:30:07 -08:00
juanvallejo cbe479039b Add json,yaml output format support kubectl create
This patch adds the ability to specify an output format other than
"name" to `kubectl create ...`. It can be used in conjunction with the
`--dry-run` option. Converts unstructured objects into known types in
order to support all `--output` values.
2016-12-12 16:09:12 -05:00
Kubernetes Submit Queue 0ac73a823a Merge pull request #34966 from ivan4th/make-top-pod-test-table-driven
Automatic merge from submit-queue (batch tested with PRs 38453, 36672, 38629, 34966, 38630)

Make kubectl top pod test table-driven
2016-12-12 11:41:10 -08:00
Kubernetes Submit Queue 3d29c3d229 Merge pull request #36672 from ymqytw/check_annotation_for_apply
Automatic merge from submit-queue (batch tested with PRs 38453, 36672, 38629, 34966, 38630)

Warn user if they try to apply on an object without the annotation

Give user a warning when using `kubectl apply` on a resource lacking the `LastAppliedConfig` annotation

fixes #36620

Ref: #35134 and #36509.

**Release note**:
```release-note
Issue a warning when using `kubectl apply` on a resource lacking the `LastAppliedConfig` annotation
```
2016-12-12 11:41:06 -08:00
Ivan Shvedunov 9b9c1e6952 Make top pod test table-driven 2016-12-12 20:23:17 +03:00
Clayton Coleman c52d510a24
refactor: generated 2016-12-10 18:05:53 -05:00
Clayton Coleman 42d410fdde
Switch to use pkg/apis/meta/v1/unstructured and the new interfaces
Avoid directly accessing an unstructured type if it is not required.
2016-12-10 18:05:28 -05:00
Kubernetes Submit Queue e732ee70f4 Merge pull request #38406 from liggitt/remove-internal-json-annotations
Automatic merge from submit-queue

Remove json serialization annotations from internal types

fixes #3933

Internal types should never be serialized, and including json serialization tags on them makes it possible to accidentally do that without realizing it.

fixes in this PR:

* types
  * [x] remove json tags from internal types
  * [x] fix references from serialized types to internal ObjectMeta
* generation
  * [x] remove generated json codecs for internal types (they should never be used)
* kubectl
  * [x] fix `apply` to operate on versioned object
  * [x] fix sorting by field to operate on versioned object
  * [x] fix `--record` to build annotation patch using versioned object
* hpa
  * [x] fix unmarshaling to internal CustomMetricTargetList in validation
* thirdpartyresources
  * [x] fix encoding API responses using internal ObjectMeta
* tests
  * [x] fix tests to use versioned objects when checking encoded content
  * [x] fix tests passing internal objects to generic printers

follow ups (will open tracking issues or additional PRs):
- [ ] remove json tags from internal kubeconfig types (`kubectl config set` pathfinding needs to work against external type)
- [ ] HPA should version CustomMetricTargetList serialization in annotations
- [ ] revisit how TPR resthandlers encoding objects
- [ ] audit and add tests for printer use (human-readable printer requires internal versions, generic printers require external versions)
- [ ] add static analysis tests preventing new internal types from adding tags
- [ ] add static analysis tests requiring json tags on external types (and enforcing lower-case first letter)
- [ ] add more tests for `kubectl get` exercising known and unknown types with all output options
2016-12-10 14:00:17 -08:00
ymqytw b6cfa9aa98 warn user if they try to apply on an object without the annotation 2016-12-09 17:29:31 -08:00
juanvallejo 7410acf4ab
Prevent "patched" output on obj not patched
This patch compares an original object against a patched object returned
from the server and only announces that the object was successfully
patched if the object returned from the server does not equal the
original object.
2016-12-09 19:01:27 -05:00
Kubernetes Submit Queue 68b17c2942 Merge pull request #37270 from xilabao/remove-duplicate-get-errs
Automatic merge from submit-queue (batch tested with PRs 37270, 38309, 37568, 34554)

Remove duplicate get errs

old:
```shell
$ kubectl get ns
NAME          STATUS    AGE
default       Active    2m
kube-system   Active    2m

$ kubectl get ns --all-namespaces
NAMESPACE   NAME      STATUS    AGE
error: namespace is not namespaced
error: namespace is not namespaced
```
new:
```shell
$ kubectl get ns --all-namespaces
NAMESPACE   NAME      STATUS    AGE
error: namespace is not namespaced
```
2016-12-09 14:11:14 -08:00
Jordan Liggitt 4536388909
Update bazel 2016-12-09 16:26:06 -05:00
Jordan Liggitt 8b34e0ed53
Make --record compute patch using versioned object 2016-12-09 16:26:05 -05:00
Jordan Liggitt 12806be2bf
Fix tests using internal types for generic printing 2016-12-09 16:26:05 -05:00
Jordan Liggitt cc7a44f545
Fix tests using internal types for serialization 2016-12-09 16:26:05 -05:00
Jordan Liggitt 3654d63766
Compute apply patch using versioned object 2016-12-09 16:26:04 -05:00
Kubernetes Submit Queue b9536688d3 Merge pull request #38429 from duglin/removeDelete
Automatic merge from submit-queue (batch tested with PRs 37860, 38429, 38451, 36050, 38463)

Remove "pod xxx deleted" message from kubectl run --rm

This is a follow-on to https://github.com/kubernetes/kubernetes/issues/28695

Its unnecessary to print the message when the user asked for it.
We should only show a msg (error) when we didn't do what they asked.
Also showing this in a "kubectl run" is bad because it then
gets appended to the user's output and they would then have to strip
it off if they want to use the output in some follow-on processing.

Signed-off-by: Doug Davis <dug@us.ibm.com>

```release-note
kubectl run --rm no longer prints "pod xxx deleted"
```
2016-12-09 13:22:14 -08:00
Kubernetes Submit Queue 35d6d902e8 Merge pull request #38403 from deads2k/fix-local-up-dns
Automatic merge from submit-queue (batch tested with PRs 38284, 38403, 38265)

Fix local up cluster dns with RBAC

The DNS server needs permissions to run using RBAC.  This does it with a big hammer before we sort out tight permissions.

@fabianofranz for the CLI change
@xilabao for the local-up-cluster change
2016-12-09 08:50:21 -08:00
Kubernetes Submit Queue aae1b14592 Merge pull request #33083 from mfojtik/resolve-image
Automatic merge from submit-queue

Add ResolveImage function to CLI factory

This functions helps to integrate third-party mechanism for resolving the image names. For example, this function can be used in OpenShift to add support for resolving the ImageStreamTag and ImageStreamImage.

See: https://github.com/openshift/origin/pull/10995
2016-12-09 05:26:52 -08:00
Michal Fojtik 737b32772e add ResolveImage function to CLI factory 2016-12-09 12:41:38 +01:00
Wojciech Tyczynski e8d1cba875 GetOptions in client calls 2016-12-09 09:42:01 +01:00
Kubernetes Submit Queue 5628cde1bd Merge pull request #37164 from duglin/removeWaiting
Automatic merge from submit-queue (batch tested with PRs 38413, 37164)

Remove chatty "waiting for pod" msg from kubectl run

Attacking #28695 one step at a time

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-12-08 18:08:55 -08:00
Doug Davis 24fbba393e Remove "pod xxx deleted" message from kubectl run --rm
Its unnecessary to print the message when the user asked for it.
We should only show a msg (error) when we didn't do what they asked.
Also showing this in a "kubectl run" is bad because it then
gets appended to the user's output and they would then have to strip
it off if they want to use the output in some follow-on processing.

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-12-08 17:40:08 -08:00
Kubernetes Submit Queue b0b6f3c256 Merge pull request #38401 from liggitt/addressable-deep-copy
Automatic merge from submit-queue (batch tested with PRs 36071, 32752, 37998, 38350, 38401)

Pass addressable values to DeepCopy

Extracted from https://github.com/kubernetes/kubernetes/pull/35728

These are the places we are currently calling DeepCopy incorrectly, and we need to fix, even if we don't pick up the changes to DeepCopy in #35728:
* creating a new cloner means we have no generated functions registered
* passing non-addressable values doesn't pick up generated deep copy functions, and forces us into reflective mode
2016-12-08 16:26:00 -08:00
Kubernetes Submit Queue e3b9546028 Merge pull request #32752 from fraenkel/logs_selector
Automatic merge from submit-queue (batch tested with PRs 36071, 32752, 37998, 38350, 38401)

Allow a selector when retrieving logs

#19873

initial commit to see if I am headed in the right direction.
Its missing all the test cases, but the selector path works.
2016-12-08 16:25:54 -08:00
Kubernetes Submit Queue 76e0b1af54 Merge pull request #36071 from juanvallejo/jvallejo/fix-set-image-local-output
Automatic merge from submit-queue

fix local resource output when `-f` not specified

**Release note**:
```release-note
release-note-none
```

`kubectl set image` does not have a `--dry-run` option. Although it offers a
`--local` flag, it does not support server request, limiting input to that of stdin
or that of a local file.

This patch adds a `--dry-run` option to the `kubectl set image` command,
allowing for resources from the server to be selected, without making any
mutations.

cc @ncdc 

Related PR: https://github.com/kubernetes/kubernetes/pull/36174
2016-12-08 16:20:00 -08:00
juanvallejo 6eaab223f2 add --dry-run opt to `kubectl set image`
This patch adds a `--dry-run` option to `kubectl set image...`
2016-12-08 15:50:52 -05:00
deads2k b18e433590 add serviceaccount option to clusterrrolebinding 2016-12-08 14:18:39 -05:00
Jordan Liggitt 6819706adf
Pass addressable values to DeepCopy 2016-12-08 14:16:01 -05:00
Kubernetes Submit Queue fa5556b92b Merge pull request #32811 from fraenkel/headless_service
Automatic merge from submit-queue (batch tested with PRs 38260, 32811, 28458, 33570, 37096)

Allow no ports when exposing headless service

fixes #32795
2016-12-08 02:11:20 -08:00
Kubernetes Submit Queue f8dd91fb28 Merge pull request #36541 from juanvallejo/jvallejo/remove-duplicate-describer-errs
Automatic merge from submit-queue (batch tested with PRs 36626, 37294, 37463, 37943, 36541)

Remove duplicate describer errs

Downstream issue https://github.com/openshift/origin/issues/11846

**Release note**:
```release-note
release-note-none
```

The `describe` command iterates through a list of infos received from
the server and aggregates a list of errors while attempting to call each
resource's respective describer. When a resource exists, but does not
have a describer set, such as `Event`, the `describe` command outputs
the same error `error: no description has been implemented for "Event"`
for each info.

```
$ kubectl describe events
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
```

@kubernetes/kubectl @fabianofranz
2016-12-08 00:23:16 -08:00
xilabao 0dc166a9fa Remove duplicate get errs 2016-12-08 13:56:56 +08:00
deads2k b658552947 remove validation dependency on version negotiation 2016-12-07 13:23:20 -05:00
Kubernetes Submit Queue ce93c81029 Merge pull request #38092 from xilabao/fix-alias-conflict
Automatic merge from submit-queue (batch tested with PRs 35101, 38215, 38092)

fix alias conflict of clusterrolebinding

create_configmap alias is "cm"
2016-12-07 07:27:17 -08:00
Kubernetes Submit Queue 490151ee50 Merge pull request #38181 from tanshanshan/remove-todo
Automatic merge from submit-queue (batch tested with PRs 38181, 38128, 36711)

Remove redundant conditional statement

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

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

1. remove redundant conditional statement
2. replace  errors.New(fmt.Sprintf with fmt.Errorf 

Thanks.

**Special notes for your reviewer**:

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
```
2016-12-07 03:09:30 -08:00
tanshanshan c76cd49da1 remove redundant condition 2016-12-07 08:39:40 +08:00
Mike Danese e225625a80 add a configuration for kubelet to register as a node with taints
and deprecate register-schedulable
2016-12-06 10:32:54 -08:00
Kubernetes Submit Queue e4abc36d5d Merge pull request #37636 from juanvallejo/jvallejo/bugfix/print-resource-kind-when-single-resource-type
Automatic merge from submit-queue

add resource prefix to multiple items w/ same kind

**Release note**:
```release-note
release-note-none
```

This patch ensures that a resource prefix is added to multiple items of
the same kind, when using `kubectl get all`. Before, a prefix was added only
when a single item was returned on `kubectl get all`, but ignored if only a
single resource kind existed but multiple items for that kind were
returned.

**Example**
```
$ kubectl get all
No resources found.

$ kubectl create service loadbalancer testsvc1 --tcp=8080
$ kubectl get all
NAME               CLUSTER-IP       EXTERNAL-IP                     PORT(S)    AGE
svc/testsvc1       172.30.119.220   172.46.100.155,172.46.100.155   8080/TCP   1h

$ kubectl create service loadbalancer testsvc2 --tcp=8081
$ kubectl get all
NAME               CLUSTER-IP       EXTERNAL-IP                     PORT(S)    AGE
svc/testsvc1       172.30.119.220   172.46.100.155,172.46.100.155   8080/TCP   1h
svc/testsvc2       172.30.241.197   172.46.164.158,172.46.164.158   8081/TCP   1h
```

@fabianofranz
2016-12-06 07:43:07 -08:00
Kubernetes Submit Queue 653fd97ba0 Merge pull request #37966 from p0lyn0mial/unify_restmapping_and_restmappings
Automatic merge from submit-queue (batch tested with PRs 38185, 37966)

decided to extract common logic for RESTMapping and RESTMappings to a…

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

**What this PR does / why we need it**: the changes introduced in this PR extract common logic of RESTMapping and RESTMappings to one common method. 

**Special notes for your reviewer**: this is my first PR - be polite.



The only change in logic to what was before is when calling commonRESTMappings from RESTMapping
we search all defaultGroupVersion as opposed to just one when no mapping was found for provided versions.
2016-12-06 06:49:25 -08:00
tianshapjq 55521ee8be remove the create-external-load-balancer flag in cmd/expose.go 2016-12-06 16:48:32 +08:00
xilabao ff09a68079 fix alias conflict of clusterrolebinding 2016-12-06 09:13:42 +08:00
p0lyn0mial 5f8e774517 extended RESTMappings method by a version parameter.
RESTMapping method can now rely on RESTMappings by passing versions parameter and taking the first match found by RESTMappings method. In addition
a UT that test the new method has been added.

The only change in logic to what was before is when calling RESTMapping
we search all defaultGroupVersion as opposed to just one when no mapping was found for provided versions.
2016-12-05 20:09:36 +01:00
Kubernetes Submit Queue 1552edbf0c Merge pull request #37366 from xilabao/extend-cmd-valid-resources-information
Automatic merge from submit-queue (batch tested with PRs 37366, 36373)

extend cmd valid resources information about roles
2016-12-05 08:13:40 -08:00
Dr. Stefan Schimanski 2dff13f332 Update generated files 2016-12-05 12:42:31 +01:00
Dr. Stefan Schimanski 458d2b2fe4 Add verb support for discovery client 2016-12-05 12:36:05 +01:00
xilabao b95dcfb424 update label filter prompt 2016-12-05 11:03:21 +08:00
Clayton Coleman 3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman 5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
Kubernetes Submit Queue 12801e8bbb Merge pull request #37649 from smarterclayton/top_node
Automatic merge from submit-queue

kubectl top pod|node should handle when Heapster is somewhere else

OpenShift runs Heapster on HTTPS, which means `top node` and `top pod`
are broken because they hardcode 'http' as the scheme. Provide an
options struct allowing users to specify `--heapster-namespace`,
`--heapster-service`, `--heapster-scheme`, and `--heapster-port` to the
commands (leveraging the existing defaults).

@kubernetes/sig-metrics makes top a little more useful in other spots
2016-12-03 15:04:14 -08:00
Kubernetes Submit Queue db323e9885 Merge pull request #36646 from kargakis/create-pdb-subcommand
Automatic merge from submit-queue (batch tested with PRs 38049, 37823, 38000, 36646)

kubectl: add create pdb subcommand

@mwielgus @mml @kubernetes/kubectl

```release-note
Add kubectl create poddisruptionbudget command
```
2016-12-03 14:20:54 -08:00
Kubernetes Submit Queue 39e63e3e53 Merge pull request #37608 from tianshapjq/modify-get-help
Automatic merge from submit-queue (batch tested with PRs 37608, 37103, 37320, 37607, 37678)

add some help info about the 'all' arg

**What this PR does / why we need it**:
There is an arg named "all" in the get command, we can use it like "kubectl get all". But we can get nothing about this arg in the help description. Users may not know how to use it without looking into the source code. So here I'm going to add some description about this arg.

**Which issue this PR fixes** 
We discussed about this in 
In pkg/kubectl/cmd/get.go there is a confused arg named "all" [#37533](https://github.com/kubernetes/kubernetes/issues/37533)
2016-12-02 23:32:44 -08:00
juanvallejo 3484c6f676 add resource prefix to multiple items w/ same kind
This patch ensures that a resource prefix is added to multiple items of
the same kind, when using `oc get all`. Before, a prefix was added only
when a single item was returned on `oc get all`, but ignored if only a
single resource kind existed but multiple items for that kind were
returned.
2016-12-02 15:14:44 -05:00
Michail Kargakis b8fab92600 kubectl: generated changes for new pdb command 2016-12-02 18:42:25 +01:00
Michail Kargakis 065b652961 kubectl: add create pdb subcommand 2016-12-02 18:42:25 +01:00
Kubernetes Submit Queue 74066816b6 Merge pull request #37098 from deads2k/cli-12-create-cbinding
Automatic merge from submit-queue

add create clusterrolebinding command

Adds `kubectl create clusterrolebinding`.

@kubernetes/sig-cli
2016-12-02 08:44:58 -08:00
Kubernetes Submit Queue bbd447f555 Merge pull request #34789 from AdoHe/external_service
Automatic merge from submit-queue

create service add create ExternalName service implementation

@kubernetes/kubectl create service add ExternalName support, refer #34731 for more detail.

```release-note
kubectl create service externalname
```
2016-12-02 07:29:06 -08:00
Doug Davis c5387eebe4 Remove chatty "waiting for pod" msg from kubectl run
Attacking #28695 one step at a time

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-12-01 17:46:04 -08:00
Clayton Coleman 3d237cac2e
kubectl top pod|node should handle when Heapster is somewhere else
OpenShift runs Heapster on HTTPS, which means `top node` and `top pod`
are broken because they hardcode 'http' as the scheme. Provide an
options struct allowing users to specify `--heapster-namespace`,
`--heapster-service`, `--heapster-scheme`, and `--heapster-port` to the
commands (leveraging the existing defaults).
2016-12-01 12:33:32 -05:00
Kubernetes Submit Queue 737edd02a4 Merge pull request #35258 from feiskyer/package-aliase
Automatic merge from submit-queue

Fix package aliases to follow golang convention

Some package aliases are not not align with golang convention https://blog.golang.org/package-names. This PR fixes them. Also adds a verify script and presubmit checks.

Fixes #35070.

cc/ @timstclair @Random-Liu
2016-11-30 16:39:46 -08:00
Kubernetes Submit Queue 9ccc291e8a Merge pull request #37263 from smarterclayton/wait_on_immediate
Automatic merge from submit-queue

When --grace-period=0 is provided, wait for deletion

The grace-period is automatically set to 1 unless --force is provided, and the client waits until the object is deleted.

This preserves backwards compatibility with 1.4 and earlier. It does not handle scenarios where the object is deleted and a new object is created with the same name because we don't have the initial object loaded (and that's a larger change for 1.5).

Fixes #37117 by relaxing the guarantees provided.

```release-note
When deleting an object with `--grace-period=0`, the client will begin a graceful deletion and wait until the resource is fully deleted.  To force deletion, use the `--force` flag.
```
2016-11-30 11:15:17 -08:00
Kubernetes Submit Queue b312b34d53 Merge pull request #37619 from seeekr/patch-2
Automatic merge from submit-queue

fix typo in `kubectl proxy` command line help

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md
2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md
3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes
-->

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

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

**Special notes for your reviewer**: doc only

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
```

(docs only) fixed port from 8011 to 8001 (the default) because in that particular line no specific port is specified and thus the default is going to be used.
2016-11-30 08:03:47 -08:00
Kubernetes Submit Queue 6b46578832 Merge pull request #37604 from ymqytw/fix_issues_with_drain
Automatic merge from submit-queue

make drain retry forever and use a new graceful period

Implemented the 1st approach according to https://github.com/kubernetes/kubernetes/issues/37460#issuecomment-263437516
1) Make drain retry forever if the error is always Too Many Requests (429) generated by Pod Disruption Budget.
2) Use a new graceful period per #37460
3) Update the message printed out when successfully deleting or evicting a pod.

fixes #37460

cc: @davidopp @erictune
2016-11-30 02:04:39 -08:00
Pengfei Ni f584ed4398 Fix package aliases to follow golang convention 2016-11-30 15:40:50 +08:00
ymqytw b358b2df02 make drain retry forever and use new timeout 2016-11-29 14:23:40 -08:00
Kubernetes Submit Queue 63a930f88e Merge pull request #37397 from ymqytw/update_doc_for_kubectl_apply
Automatic merge from submit-queue

Update doc for kubectl apply

Update doc for `kubectl apply`.

@MrHohn @mikedanese Please review the changes related to `--prune`.

We will need to update the doc when flags `--dry-run` and `-o` have been fixed. Ref: https://github.com/kubernetes/kubernetes/pull/34028#issuecomment-262392748

Partially addresses: kubernetes/kubernetes.github.io#1513

cc: @pwittrock @foxish
2016-11-29 07:31:48 -08:00
Kubernetes Submit Queue 93f6736daf Merge pull request #37345 from MrHohn/kubectl-apply-remove-w
Automatic merge from submit-queue

Removes shorthand flag -w from kubectl apply

Fixes #37342.

A shorthand flag `-w` was introduced as flag `--prune-whitelist` for kubectl apply two weeks ago. Turned out it is not what we should do. Removing this shorthand flag before 1.5 release to prevent further issues.

@ymqytw @pwittrock
2016-11-29 07:31:38 -08:00
Denis Andrejew be404a074f fix typo in `kubectl proxy` command line help
fixed port from 8011 to 8001 (the default) because in that particular line no specific port is specified and thus the default is going to be used.
2016-11-29 11:54:48 +00:00
tianshapjq d0ba378177 add some help info about the 'all' arg 2016-11-29 14:45:10 +08:00
Kubernetes Submit Queue 4a3c7aecdb Merge pull request #37321 from ymqytw/update_doc_for_kubectl_drain
Automatic merge from submit-queue

Update kubectl drain help message

Update `kubectl drain` help messages according to kubernetes/kubernetes.github.io#1768

cc: @erictune @pwittrock
2016-11-28 13:26:16 -08:00
ymqytw 2f32b48b25 update doc for kubectl apply 2016-11-28 09:52:39 -08:00
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
Chao Xu bcc783c594 run hack/update-all.sh 2016-11-23 15:53:09 -08:00
Chao Xu 96cd71d8f6 kubectl 2016-11-23 15:53:09 -08:00
Clayton Coleman 7cdb6b169d
When --grace-period=0 is provided, wait for deletion
The grace-period is automatically set to 1 unless --force is provided,
and the client waits until the object is deleted.

This preserves backwards compatibility with 1.4 and earlier. It does not
handle scenarios where the object is deleted and a new object is created
with the same name.
2016-11-23 15:02:43 -06:00
xilabao c526849436 extend cmd valid resources information 2016-11-23 17:49:43 +08:00
Zihong Zheng f57c9c70f9 Removes shorthand flag from kubectl apply 2016-11-22 22:24:50 -08:00
ymqytw 3cc294b1e0 Revert "support patch list of primitives"
This reverts commit 34891ad9f6.
2016-11-22 21:06:36 -08:00
ymqytw d248843b65 Revert "try old patch after new patch fails"
This reverts commit f32696e734.
2016-11-22 21:02:30 -08:00
ymqytw 9b16b435fc Revert "Update apply and edit"
This reverts commit 48d3ca23cf.
2016-11-22 21:02:15 -08:00
ymqytw d178bc76ed Revert "add a unit test"
This reverts commit 11653b11c1.
2016-11-22 21:01:20 -08:00
ymqytw b8fbf68759 update kubectl drain doc 2016-11-22 15:34:58 -08:00
deads2k e300f01a1b add create clusterrolebinding command 2016-11-21 08:50:06 -05:00
Kubernetes Submit Queue b9d2d74a94 Merge pull request #37038 from ymqytw/retry_old_patch_after_new_patch_fail
Automatic merge from submit-queue

Fix kubectl Stratigic Merge Patch compatibility

As @smarterclayton pointed out in [comment1](https://github.com/kubernetes/kubernetes/pull/35647#pullrequestreview-8290820) and [comment2](https://github.com/kubernetes/kubernetes/pull/35647#pullrequestreview-8290847) in PR #35647,
we cannot assume the API servers publish version and they shares the same version.

This PR removes all the calls of GetServerSupportedSMPatchVersion().
Change the behavior of `apply` and `edit` to:
Retrying with the old patch version, if the new version fails.
Default other usage of SMPatch to the new version, since they don't update list of primitives.

fixes #36916

cc: @pwittrock @smarterclayton
2016-11-19 01:02:47 -08:00
ymqytw 11653b11c1 add a unit test 2016-11-18 15:35:50 -08:00
ymqytw 48d3ca23cf Update apply and edit 2016-11-18 09:01:28 -08:00
Kubernetes Submit Queue 15bbd11bbf Merge pull request #35967 from saturnism/patch-2
Automatic merge from submit-queue

Append newline to the "deleted context ... " and "deleted cluster" message

**What this PR does / why we need it**: Append newline to the "deleted context ... " message.

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2016-11-18 08:28:12 -08:00
Kubernetes Submit Queue ddcd9708ec Merge pull request #36898 from deads2k/cli-10-fix-unstructuredtpr
Automatic merge from submit-queue

remove TPR registration, ease validation requirements

Fixes https://github.com/kubernetes/kubernetes/issues/36007 .

This removes the special casing for TPRs inside of the `UnstructuredObject`, which should allow CRUD against skewed kube api server levels.

@kubernetes/kubectl @kubernetes/sig-cli 
@janetkuo
2016-11-18 06:27:17 -08:00
Kubernetes Submit Queue cae6cf2cee Merge pull request #37031 from foxish/add-ss-kubectl
Automatic merge from submit-queue

Adding statefulset to the list of things kubectl says it knows about

**What this PR does / why we need it**: Adding statefulset to the list of things kubectl says it knows about.

**Special notes for your reviewer**: 

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
NONE
```

cc @kubernetes/sig-apps @erictune
2016-11-17 16:49:58 -08:00
ymqytw f32696e734 try old patch after new patch fails 2016-11-17 14:28:09 -08:00
Anirudh 4b53a32e14 Adding statefulset to the kubectl output for valid resources 2016-11-17 13:53:23 -08:00
Ray Tsang 846cd2d66a Append newline to the "deleted context ... " and "deleted cluster ..." message 2016-11-17 12:30:45 -05:00
Kubernetes Submit Queue 424286996a Merge pull request #36764 from ymqytw/make_edit_before_create_iterate
Automatic merge from submit-queue

make kubectl create --edit iterate

`kubectl create --edit` is broken after #36148 merged.
`kubectl create --edit` will fail when a manifest that contains multiple resources.
I guess the root cause is that dynamic typer doesn't support a list of resources currently.

This PR makes `kubectl create --edit` iterate again as `kubectl create`.
2016-11-17 01:25:34 -08:00
deads2k 66e5c38d67 remove TPR registration, ease validation requirements 2016-11-16 14:04:35 -05:00
AdoHe d66bcbfa61 create service add create ExternalName service implementation 2016-11-16 04:47:10 -05:00
Kubernetes Submit Queue fac05d9c81 Merge pull request #36174 from JacobTanenbaum/v2resource_fixes
Automatic merge from submit-queue

V2resource fixes

when using kubectl set resources it resets all resource fields that are not being set.

for example
$ kubectl set resources deployments nginx --limits=cpu=100m

followed by

$ kubectl set resources deployments nginx --limits=memory=256Mi

would result in the nginx deployment only limiting memory at 256Mi with the previous
limit placed on the cpu being wiped out. This behavior is corrected so that each invocation
only modifies fields set in that command and changed the testing so that the desired behavior
is checked.

Also a typo:

you must specify an update to requests or limits or (in the form of --requests/--limits)

corrected to

you must specify an update to requests or limits (in the form of --requests/--limits)

Implemented both the dry run and local flags.

Added test cases to show that both flags are operating as intended.
Removed the print statement "running in local mode" as in PR#35112

The original PR associated with these fixes where reverted due to causing a flake in hack/make-rules/test-cmd.sh, I gave the 'kubectl set resources' tests there own deployment and set the terminationGracePeriodSeconds to 0 and have run test-cmd.sh for hours without hitting the flake
2016-11-15 21:03:06 -08:00
Kubernetes Submit Queue 2bd8bb2699 Merge pull request #34873 from k82cn/k8s_34633
Automatic merge from submit-queue

Set non-zero exit code on failures for kubectl

fixes #34633 

/cc @AdoHe
2016-11-15 03:40:53 -08:00
Kubernetes Submit Queue 79fc0a95a0 Merge pull request #35543 from philips/improve-version
Automatic merge from submit-queue

kubectl: add less verbose version

The kubectl version output is very complex and makes it hard for users
and vendors to give actionable information. For example during the
recent Kubernetes 1.4.3 TLS security scramble I had to write a one-liner
for users to get out the version number to give to figure out if they
are vulnerable:

```
$ kubectl version | grep -i Server | sed  -n 's%.*GitVersion:"\([^"]*\).*%\1%p'
```

Instead this patch outputs simply output by default

```
./kubectl version
Client Version: v1.4.3
Server Version: v1.4.3
```

Adding the `--verbose` flag will output the old format.
2016-11-14 22:39:21 -08:00
ymqytw 189348df2b make kubectl create --edit iterate 2016-11-14 14:12:24 -08:00
Kubernetes Submit Queue 61a5d23e0f Merge pull request #36603 from fabianofranz/fix_lists_in_convert
Automatic merge from submit-queue

Fix handling lists in kubectl convert

Fixes https://github.com/kubernetes/kubernetes/issues/36722

When handling multiple objects in `kubectl convert` (for example in `kubectl convert -f .` with multiple files in current directory) the objects must be managed as a list instead of individually, otherwise `-o yaml|json` will generate invalid format (just multiple json/yaml objects concatenated) which can't be fed to `kubectl create` like in `kubectl convert -f . | kubectl create -f -`.


```release-note
NONE
```
2016-11-14 12:21:16 -08:00
Klaus Ma fec8793b5f Set non-zero exit code on failures for kubectl. 2016-11-12 07:40:54 -05:00
Kubernetes Submit Queue 3e169be887 Merge pull request #35647 from ymqytw/patch_primitive_list
Automatic merge from submit-queue

Fix strategic patch for list of primitive type with merge sementic

Fix strategic patch for list of primitive type when the patch strategy is `merge`.
Before: we cannot replace or delete an item in a list of primitive, e.g. string, when the patch strategy is `merge`. It will always append new items to the list.
This patch will generate a map to update the list of primitive type.
The server with this patch will accept either a new patch or an old patch.
The client will found out the APIserver version before generate the patch.

Fixes #35163, #32398

cc: @pwittrock @fabianofranz 

``` release-note
Fix strategic patch for list of primitive type when patch strategy is `merge` to remove deleted objects.
```
2016-11-11 14:36:44 -08:00
Brandon Philips 9216057589 kubectl: add less verbose version
The kubectl version output is very complex and makes it hard for users
and vendors to give actionable information. For example during the
recent Kubernetes 1.4.3 TLS security scramble I had to write a one-liner
for users to get out the version number to give to figure out if they
are vulnerable:

    $ kubectl version | grep -i Server | sed  -n 's%.*GitVersion:"\([^"]*\).*%\1%p'

Instead this patch outputs simply output with `--short`

    ./kubectl version --short
    Client Version: v1.4.3
    Server Version: v1.4.3
2016-11-10 14:07:42 -08:00
Fabiano Franz 8965fcaf10 Fix handling lists in kubectl convert 2016-11-10 18:19:30 -02:00
Kubernetes Submit Queue 6fcf8e415c Merge pull request #34584 from ymqytw/support_force_apply
Automatic merge from submit-queue

support kubectl apply --force

Support `kubectl apply --force` which is first delete the resource and then re-apply the resource, when the patch fails.

Fixes: #16569
2016-11-09 21:14:25 -08:00
Kubernetes Submit Queue 7bb031da3a Merge pull request #30237 from mikedanese/csr-porcelain
Automatic merge from submit-queue

implement kubectl procelain csr commands

cc @gtank

ref #30163
2016-11-09 16:57:49 -08:00
juanvallejo 11ad2cf2ff
Remove duplicate describer errs
The `describe` command iterates through a list of infos received from
the server and aggregates a list of errors while attempting to call each
resource's respective describer. When a resource exists, but does not
have a describer set, such as `Event`, the `describe` command outputs
the same error `error: no description has been implemented for "Event"`
for each info.

```
$ kubectl describe events
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
no description has been implemented for "Event"
```
2016-11-09 16:28:36 -05:00
ymqytw 34891ad9f6 support patch list of primitives 2016-11-09 11:46:59 -08:00
Kubernetes Submit Queue 4b5667e177 Merge pull request #36211 from brendandburns/cordon
Automatic merge from submit-queue

Add retry to node scheduability marking.

Fixes https://github.com/kubernetes/kubernetes/issues/32391

@justinsb @janetkuo @kubernetes/sig-cli
2016-11-08 16:05:53 -08:00
Kubernetes Submit Queue 3b31c9f019 Merge pull request #36355 from soltysh/deprecate_extensionsjob
Automatic merge from submit-queue

 Deprecate extensions/v1beta1.Jobs related stuff

This PR supersedes https://github.com/kubernetes/kubernetes/pull/33861, it's a pre-req for removing `extensions/v1beta1.Jobs` (#32763) in the next release. 

@kubernetes/kubectl @kubernetes/api-review-team ptal
@bgrant0607 @erictune @janetkuo fyi

```release-note
Deprecate extensions/v1beta1.Jobs
```
2016-11-08 07:18:40 -08:00
Mike Danese 584689f182 implement kubectl procelain csr commands 2016-11-08 06:33:46 -08:00
Kubernetes Submit Queue 13cc43af82 Merge pull request #35483 from ymqytw/use_evict_for_drain
Automatic merge from submit-queue

Fix kubectl drain for statefulset

Support deleting pets for `kubectl drain`. 
Use evict to delete pods.

Fixes: #33727

```release-note
Adds support for StatefulSets in kubectl drain.
Switches to use the eviction sub-resource instead of deletion in kubectl drain, if server supports.
```

@foxish @caesarxuchao
2016-11-07 17:42:08 -08:00
ymqytw b73fae6c55 Fix kubectl drain for statefulset and use eviciton for drain if possible 2016-11-07 16:13:06 -08:00
Maciej Szulik ed6ede3715 Deprecate extensions/v1beta1.Jobs related stuff 2016-11-07 12:44:51 +01:00
Maciej Szulik 0b5ef16008 Support ScheduledJob name 2016-11-07 10:14:12 +01:00
Maciej Szulik 41d88d30dd Rename ScheduledJob to CronJob 2016-11-07 10:14:12 +01:00
Kubernetes Submit Queue f7e0c6c19e Merge pull request #35418 from sttts/sttts-discovery-cache
Automatic merge from submit-queue

Add caching for discovery info with invalidation on cache-miss

TODO:
- [x] write tests for `CachedDiscoveryClient`
- [x] write tests for `DeferredDiscoveryRESTMapper` on cache-miss
- [x] find better way/structure to get rid of `invalidateCh` in c06ba3175b
2016-11-06 20:10:57 -08:00
Brendan Burns 55f031e167 Add retry to node scheduability marking. 2016-11-06 08:28:36 -08:00
Kubernetes Submit Queue 47519962bf Merge pull request #35484 from smarterclayton/delete_warning
Automatic merge from submit-queue

Add --force to kubectl delete and explain force deletion

--force is required for --grace-period=0. --now is == --grace-period=1.
Improve command help to explain what graceful deletion is and warn about
force deletion.

Part of #34160 & #29033

```release-note
In order to bypass graceful deletion of pods (to immediately remove the pod from the API) the user must now provide the `--force` flag in addition to `--grace-period=0`.  This prevents users from accidentally force deleting pods without being aware of the consequences of force deletion.  Force deleting pods for resources like StatefulSets can result in multiple pods with the same name having running processes in the cluster, which may lead to data corruption or data inconsistency when using shared storage or common API endpoints.
```
2016-11-05 11:19:04 -07:00
Kubernetes Submit Queue da56dc1e33 Merge pull request #35206 from juanvallejo/jvallejo/exit-w-errorcode-on-non-existent-cmds
Automatic merge from submit-queue

update default run function for sub-commands

**Release note**:

``` release-note
release-note-none
```

This patch updates parent commands of sub-commands to exit with a usage
error and exit code 1 on an invalid (non-sub-command) argument.

cc @kargakis
2016-11-05 07:33:46 -07:00
ymqytw 750449ba3c support force apply 2016-11-04 20:42:34 -07:00
Dr. Stefan Schimanski c8513c31a1 Update bazel 2016-11-04 21:17:12 +01:00
Dr. Stefan Schimanski 14ce6f6065 Add caching for discovery info 2016-11-04 21:17:12 +01:00
Kubernetes Submit Queue 5a2c473c1c Merge pull request #36085 from deads2k/cli-05-generic-print
Automatic merge from submit-queue

have basic kubectl crud agnostic of registered types

Makes `kubectl get` agnostic to scheme (baked in API types).  This means that it will now work against generic API servers that are "kube shaped".

This is similar to the work done for `kubectl create` last release.  I'll split out the smaller command.  `kubectl get` looks a lot different, but this eliminates all special casing for TPR in those cases.



@fabianofranz
2016-11-04 08:17:02 -07:00
deads2k 61673c4b39 make kubectl get generic with respect to objects 2016-11-04 09:04:57 -04:00
Kubernetes Submit Queue 9531442cd6 Merge pull request #35866 from madhusudancs/federation-kubefed-init-fakeclient
Automatic merge from submit-queue

Make the fake command factory return the clientset with appropriate rest clients for all the API groups.

Please review only the last commit here. This is based on PR #35865 which will be reviewed independently.

Design Doc: PR #34484

cc @kubernetes/sig-cluster-federation @nikhiljindal
2016-11-04 05:46:46 -07:00
deads2k 7fe9bd4c30 make kubectl delete generic 2016-11-04 07:50:31 -04:00
deads2k 9260b992bf make kubectl replace generic 2016-11-04 07:50:31 -04:00
Kubernetes Submit Queue e4edd817af Merge pull request #35220 from MrHohn/kubectl-apply-type
Automatic merge from submit-queue

Implement --prune-whitelist(-w) flag to overwrite default whitelist for --prune

From #34274.

Updates:

As suggested, the new commits implement a default whitelist for `kubectl apply --prune`, which could be overwritten by using `--prune-whitelist`or `-w` flag. The default whitelist and example as below.

Also supports `--dry-run` for `--prune` to fix #35222.

whitelist:

```
type pruneResource struct {
    group      string
    version    string
    kind       string
    namespaced bool
}

*pruneResources = []pruneResource{
    {"", "v1", "ConfigMap", true},
    {"", "v1", "Endpoints", true},
    {"", "v1", "Namespace", false},
    {"", "v1", "PersistentVolumeClaim", true},
    {"", "v1", "PersistentVolume", false},
    {"", "v1", "Pod", true},
    {"", "v1", "ReplicationController", true},
    {"", "v1", "Secret", true},
    {"", "v1", "Service", true},
    {"batch", "v1", "Job", true},
    {"extensions", "v1beta1", "DaemonSet", true},
    {"extensions", "v1beta1", "Deployment", true},
    {"extensions", "v1beta1", "HorizontalPodAutoscaler", true},
    {"extensions", "v1beta1", "Ingress", true},
    {"extensions", "v1beta1", "ReplicaSet", true},
    {"apps", "v1beta1", "StatefulSet", true},
}
```

example:

```
$ kubectl apply -f /path/to/file --prune -l test=true \
      -w core/v1/Pod \
      -w core/v1/Service \
      -w extensions/v1beta1/Deployment 
```

@mikedanese
2016-11-03 18:46:17 -07:00
Kubernetes Submit Queue 6ac5887e8a Merge pull request #36148 from kargakis/edit-list
Automatic merge from submit-queue

kubectl: make edit work with lists again

@kubernetes/kubectl this is fixing https://github.com/kubernetes/kubernetes/issues/20519 and slightly changes the behavior of --recursive when the directory that is being edited has files with errors. Previously since `edit` was working on an object basis, bad objects would be skipped and the editor would load the next object. We want to load multiple objects in the same list and it's impossible to load invalid objects in a list so --recursive will not work if there is any error in the directory. I think this is an acceptable trade-off.

Review here: https://github.com/kubernetes/kubernetes/pull/36148/files?w=1
2016-11-03 17:27:13 -07:00
Jacob Tanenbaum 13afa70c81 Implemented both the dry run and local flags.
Added test cases to show that both flags are operating as intended.
Removed the print statement "running in local mode" as in PR#35112

The previous attempt at the PR (PR#35050) was reverted for causeing a flake.
I believe that setting the deployments terminationGracePeriodSeconds to 0 should
take care of it. I ran hack/make-rules/test-cmd.sh 50 times in a row without encountering
the flake
2016-11-03 12:55:19 -04:00
Jacob Tanenbaum 9d7ae7b80d fixed some issues with kubectl set resources
when using kubectl set resources it resets all resource fields that are not being set.

for example
  # kubectl set resources deployments nginx --limits=cpu=100m

followed by

  # kubectl set resources deployments nginx --limits=memory=256Mi

would result in the nginx deployment only limiting memory at 256Mi with the previous
limit placed on the cpu being wiped out. This behavior is corrected so that each invocation
only modifies fields set in that command and changed the testing so that the desired behavior
is checked.

Also a typo:

 you must specify an update to requests or limits or  (in the form of --requests/--limits)

corrected to

 you must specify an update to requests or limits (in the form of --requests/--limits)

changelog:
 - fixed a typo in hack/make-rules/test-cmd.sh "effecting" to "affecting"
2016-11-03 12:55:19 -04:00
Kubernetes Submit Queue f91cd17821 Merge pull request #35799 from deads2k/client-17-negotiation
Automatic merge from submit-queue

clean up client version negotiation to handle no legacy API

Version negotiation fails if the legacy API endpoint isn't available.

This tightens up the negotiation interface based to more clearly express what each stage is doing and what the constraints on negotiation are.  This is needed to speak to generic API servers.

@kubernetes/kubectl
2016-11-03 07:53:47 -07:00
Michail Kargakis 35f7d2513f kubectl: make edit work with lists again 2016-11-03 13:12:22 +01:00
Clayton Coleman 6e25830378
Add --force to kubectl delete and explain force deletion
--force is required for --grace-period=0. --now is == --grace-period=1.
Improve command help to explain what graceful deletion is and warn about
force deletion.
2016-11-02 17:44:05 -04:00
Madhusudan.C.S 0092cda7ed Need type assertion because RESTClient() is now a method that returns and interface. 2016-11-01 21:59:51 -07:00
Madhusudan.C.S e69475d29e Make the fake command factory return the clientset with appropriate rest clients for all the API groups.
Calling `internalclientset.New()` with a rest client as an argument simply
copies that rest client to all the API group clients irrespective of the
configured GroupVersion or versionedAPIPath in the client. So only one
API group client gets the client configured correctly for that API
group. All the other API group clients get misconfigured rest clients.

On the other hand, `internalclientset.NewForConfigOrDie()` does the right
thing by reconfiguring the passed configs for each API group and
initializes an appropriate rest client for that group.

Now that we are relying on the `NewForConfigOrDie()` method to
initialize the rest clients, we need to swap the underlying http clients
in each of these rest clients with a fake one for testing.
2016-11-01 19:03:04 -07:00
Zihong Zheng af048bdb62 Implements --prune-whitelist(-w) flag to overwrite default whitelist for --prune 2016-11-01 14:02:00 -07:00
Saad Ali 1c51ac4fc1 Revert "fixed some issues with kubectl set resources" 2016-11-01 13:53:17 -07:00
Madhusudan.C.S 1712a190cb [Federation][(Un)join-00] Implement federation/cluster resource generator. 2016-11-01 00:58:54 -07:00
deads2k bae940df5c clean up client version negotiation to handle no legacy API 2016-10-31 16:05:50 -04:00
Kubernetes Submit Queue 24899597b9 Merge pull request #32687 from jouve/resource_type
Automatic merge from submit-queue

update list of vailable resources

Hi,

kubectl get --help produce a list of resource types and aliases :

```
Valid resource types include:
   * clusters (valid only for federation apiservers)
   * componentstatuses (aka 'cs')
   ...
```

``` release-note
Update the list of resources in kubectl get --help
```

The list is currently outdated (for exemple missing networkpolicy).

http://kubernetes.io/docs/user-guide/kubectl-overview/#resource-types has the same data and is also outdated.

The patch updates these 2 lists.
2016-10-31 09:28:29 -07:00
juanvallejo 988e747649 update default run function for sub-commands
This patch updates parent commands of sub-commands to exit with a usage
error and exit code 1 on an invalid (non-sub-command) argument.
2016-10-31 10:08:12 -04:00
Michal Fojtik 0faa27e62d Use PATCH when pausing/resuming objects and CalculatePatches to get the patch 2016-10-31 13:13:59 +01:00
Kubernetes Submit Queue f448f24c73 Merge pull request #34914 from brendandburns/kubectl-cp
Automatic merge from submit-queue

add kubectl cp

Implements `kubectl cp` (https://github.com/kubernetes/kubernetes/issues/13776)

Syntax examples:

```sh
# Copy from pod to local machine
$ kubectl cp [namespace/]pod:/some/file/or/dir ./some/local/file/or/dir

# Copy from local machine to pod
$ kubectl cp /some/local/file/or/dir [namespace/]pod:/some/remote/file/or/dir
```

@deads2k @smarterclayton @kubernetes/sig-cli
2016-10-30 15:12:41 -07:00
Cyril Jouve ffcc2f61b5 update available resource list 2016-10-30 21:47:25 +01:00
Kubernetes Submit Queue 71ba8a90f0 Merge pull request #35732 from fabianofranz/run_cant_dryrun_with_attach
Automatic merge from submit-queue

Better kubectl run validations

Adds more validations to flags that must be mutually exclusive in `kubectl run`. For example, `--dry-run` must not be used with `--attach`, `--stdin` or `--tty`. Adds unit tests for these new validations and some previously existing ones.

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
NONE
```
2016-10-30 13:07:28 -07:00
Kubernetes Submit Queue bc5682bbaa Merge pull request #35050 from JacobTanenbaum/resource_fixes
Automatic merge from submit-queue

fixed some issues with kubectl set resources

when using kubectl set resources it resets all resource fields that are not being set.

for example
  # kubectl set resources deployments nginx --limits=cpu=100m

followed by

  # kubectl set resources deployments nginx --limits=memory=256Mi

would result in the nginx deployment only limiting memory at 256Mi with the previous
limit placed on the cpu being wiped out. This behavior is corrected so that each invocation
only modifies fields set in that command and changed the testing so that the desired behavior
is checked.

Also a typo:

 you must specify an update to requests or limits or  (in the form of --requests/--limits)

corrected to

 you must specify an update to requests or limits (in the form of --requests/--limits)

 Implemented both the dry run and local flags.

Added test cases to show that both flags are operating as intended.
Removed the print statement "running in local mode" as in PR#35112
2016-10-30 06:18:56 -07:00
Kubernetes Submit Queue 1ff0b422a8 Merge pull request #35664 from ymqytw/update_drain_test
Automatic merge from submit-queue

Update drain test

Update how int convert to string in the kubectl drain test.
It is safer to use `strconv.Itoa()` than `string()`.
2016-10-30 04:30:18 -07:00
Kubernetes Submit Queue 5f8dc216d1 Merge pull request #35427 from fabianofranz/issues_35426
Automatic merge from submit-queue

kubectl commands must not use the factory out of Run

Fixes https://github.com/kubernetes/kubernetes/issues/35426

@smarterclayton PTAL
2016-10-30 03:17:59 -07:00
Kubernetes Submit Queue 7778ee2190 Merge pull request #33024 from juanvallejo/jvallejo/add-print-error-w-causes-cmdutil-helper
Automatic merge from submit-queue

Add "PrintErrorWithCauses" cmdutil helper

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

This patch adds a new helper function to `cmd/util/helpers.go` that
handles errors containing collections of causes and prints each cause in
a separate newline.
2016-10-30 01:12:13 -07:00
Brendan Burns d65757fb88 add kubectl cp 2016-10-29 20:24:54 -07:00
Kubernetes Submit Queue a06a08a906 Merge pull request #34489 from caesarxuchao/time-copy.sh
Automatic merge from submit-queue

Verify and update client-go staging area for every PR

We need to keep the staging area up-to-date to prevent PRs from breaking client-go.

It's marked as "WIP" because we need to decide the [versioning strategy](https://github.com/kubernetes/client-go/issues/9) for client-go first. This PR contains breaking changes for client-go.

This is blocking #29934 and potentially #34441

cc @kubernetes/sig-api-machinery
2016-10-29 16:24:07 -07:00
Chao Xu fd2fdfba89 move client/unversioned/fake to client/restclient/fake 2016-10-29 14:22:02 -07:00
Chao Xu 850729bfaf include multiple versions in clientset
update client-gen to use the term "internalversion" rather than "unversioned";
leave internal one unqualified;
cleanup client-gen
2016-10-29 13:30:47 -07:00
Kubernetes Submit Queue 7fc2273cad Merge pull request #35327 from r2d4/kubectl-completion-boilerplate
Automatic merge from submit-queue

Add boilerplate to `kubectl completion bash`

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

Small refactor to make kubectl bash and zsh completion share
boilerplate.  Previously the boilerplate was not included in the bash
script.
2016-10-29 12:27:39 -07:00
Kubernetes Submit Queue 739f78fad2 Merge pull request #33250 from ymqytw/edit_before_create
Automatic merge from submit-queue

support editing before creating resource

Support `kubectl create -f config.yaml --edit`
Support editing before creating resource from files, urls and stdin.
The behavior is similar to `kubectl edit`
It won't create anything when edit make no change.

partial: #18064

Based on: #33686 and #33973

```release-note
Support editing before creating resource from files, urls and stdin, e.g. `kubectl create -f config.yaml --edit`
It won't create anything when edit make no change.
```
2016-10-29 11:45:43 -07:00
Clayton Coleman ca2f1b87ad
Replace negotiation with a new method that can extract info
Alter how runtime.SerializeInfo is represented to simplify negotiation
and reduce the need to allocate during negotiation. Simplify the dynamic
client's logic around negotiating type. Add more tests for media type
handling where necessary.
2016-10-28 11:30:11 -04:00
juanvallejo 643649113f Add "PrintErrorWithCauses" cmdutil helper
This patch adds a new helper function to cmd/util/helpers.go that
handles errors containing collections of causes and prints each cause in
a separate newline.
2016-10-28 10:17:45 -04:00
Janet Kuo 10aee82ae3 Rename PetSet API to StatefulSet 2016-10-27 17:25:10 -07:00
Fabiano Franz bc1a1d7b30 Better kubectl run validations 2016-10-27 20:05:26 -02:00
Jacob Tanenbaum a77cecb957 Implemented both the dry run and local flags.
Added test cases to show that both flags are operating as intended.
Removed the print statement "running in local mode" as in PR#35112
2016-10-27 14:05:46 -04:00
Jacob Tanenbaum fe3bcad128 fixed some issues with kubectl set resources
when using kubectl set resources it resets all resource fields that are not being set.

for example
  # kubectl set resources deployments nginx --limits=cpu=100m

followed by

  # kubectl set resources deployments nginx --limits=memory=256Mi

would result in the nginx deployment only limiting memory at 256Mi with the previous
limit placed on the cpu being wiped out. This behavior is corrected so that each invocation
only modifies fields set in that command and changed the testing so that the desired behavior
is checked.

Also a typo:

 you must specify an update to requests or limits or  (in the form of --requests/--limits)

corrected to

 you must specify an update to requests or limits (in the form of --requests/--limits)

changelog:
 - fixed a typo in hack/make-rules/test-cmd.sh "effecting" to "affecting"
2016-10-27 14:05:46 -04:00
Fabiano Franz 60fc7b87be kubectl commands must not use the factory out of Run 2016-10-27 15:38:22 -02:00
ymqytw 08d4d8dba5 Update drain test 2016-10-26 19:17:05 -07:00
deads2k 81ae13084d handle non-generated client removal 2016-10-26 16:10:41 -04:00
ymqytw c641834bb3 support editing before creating resource 2016-10-24 09:56:37 -07:00
ymqytw 8a2610c6fb fix drain test flake 2016-10-24 09:32:49 -07:00
Mike Danese df713b478c fix tests by declaring testdata 2016-10-21 17:32:32 -07:00
Mike Danese 3b6a067afc autogenerated 2016-10-21 17:32:32 -07:00
Kubernetes Submit Queue a7807eb5a4 Merge pull request #34138 from ingvagabund/create-restclient-interface
Automatic merge from submit-queue

Create restclient interface

Refactoring of code to allow replace *restclient.RESTClient with any RESTClient implementation that implements restclient.RESTClientInterface interface.
2016-10-21 16:02:04 -07:00
Matt Rickard 0497ffb9c6 Add boilerplate to kubectl completion bash
Small refactor to make kubectl bash and zsh completion share
boilerplate.  Previously the boilerplate was not included in the bash
script.
2016-10-21 14:07:38 -07:00
Jan Chaloupka 6079053407 Update clientset generator to use RESTClient interface instead of the RESTClient data type 2016-10-21 10:13:51 +02:00
Kubernetes Submit Queue 68e68052be Merge pull request #35115 from k82cn/k8s_35092
Automatic merge from submit-queue

Did not print 'No resources found.' if error.

fixes #35092 .
2016-10-21 01:01:32 -07:00
Sami Hiltunen 66c8f60f02 kubectl: commas in --from-literal on secret creation
* Fixes an issue where commas were not accepted in --from-literal
  arguments when creating secrets. (closes #35185)
2016-10-20 14:19:40 +02:00
Kubernetes Submit Queue ad9ee6a50c Merge pull request #34778 from ymqytw/safe_kubectl_drain
Automatic merge from submit-queue

wait until the pods are deleted completely

Drain the pods on a node safely by keeping polling until all pods has been deleted.

```release-note
kubectl drain now waits until pods have been delete from the Node before exiting
```

Fixes: #34782
2016-10-20 04:45:45 -07:00
Kubernetes Submit Queue 5482fe0368 Merge pull request #35097 from nhlfr/loadbalancer-service-help
Automatic merge from submit-queue

kubectl: Fix --help output for kubectl create service loadbalancer
2016-10-20 02:10:52 -07:00
ymqytw e8fd8d50a5 address comments 2016-10-19 17:09:11 -07:00
Kubernetes Submit Queue 2de1f5c07e Merge pull request #34407 from brendandburns/kubectl-schema
Automatic merge from submit-queue

Add validation that detects repeated keys in the labels and annotations maps

Fixes #2965  (a nearly 2 year old feature request!)

@kubernetes/kubectl 

@eparis
2016-10-19 14:01:00 -07:00
Kubernetes Submit Queue 5133e1f0df Merge pull request #34683 from asalkeld/cmd/testing/fake
Automatic merge from submit-queue

Move the common test functions from cmd_test.go to cmd/testing/fake.go

**What this PR does / why we need it**:
This is so that we can use NewAPIFactory() from cmd/set/*test.go
Up until now we would get a import loop error.

This commit also adds a basic unit test case for cmd/set/set_image.go

**Which issue this PR fixes**
partial #34592

**Special notes for your reviewer**:
None

**Release note**:
```release-note
NONE
```
2016-10-19 08:03:07 -07:00
Klaus Ma 930cd155ad Did not print 'No resources found.' if error. 2016-10-19 20:40:11 +08:00
Ilya Dmitrichenko 2494462e5f
Get rid of output line that break automated usage of `kubectl set image` (fix #35105) 2016-10-19 13:13:20 +01:00
Michal Rostecki 957776bd9e kubectl: Fix --help output for kubectl create service loadbalancer
Fixes #35086
2016-10-19 09:06:22 +02:00
ymqytw 55c6116d66 address comments and add tests 2016-10-18 22:55:15 -07:00
Kubernetes Submit Queue 20841a5b0e Merge pull request #34537 from AdoHe/get_info
Automatic merge from submit-queue

kubectl get print filter info use verbose

add a quick fix #34469
2016-10-18 19:10:27 -07:00
ymqytw 3bd3c9570f fix test 2016-10-18 16:01:51 -07:00
ymqytw 7922a2a105 wait until the pods are deleted completely 2016-10-18 16:01:51 -07:00
Angus Salkeld d58554a647 Move the common test functions from cmd_test.go to cmd/testing/fake.go
This is so that we can use NewAPIFactory() from cmd/set/*test.go
Up until now we would get a import loop error.

This commit also adds a basic unit test case for cmd/set/set_image.go
2016-10-19 08:53:26 +10:00
Kubernetes Submit Queue 1dfae3633d Merge pull request #34981 from deads2k/cli-03-supress-error
Automatic merge from submit-queue

glog non-fatal, usually unimportant error instead of fmt

Fixes https://github.com/kubernetes/kubernetes/issues/34977

This particular message isn't usually important, so demote it to glog.
2016-10-18 05:59:14 -07:00
deads2k ea1eefa7ff glog non-fatal, usually unimportant error instead of fmt 2016-10-18 07:58:20 -04:00
Fabiano Franz 3f7579cacb Tools for checking CLI conventions 2016-10-17 11:50:02 -02:00
Fabiano Franz 4d641c4911 Use responsive writer in help 2016-10-17 11:50:02 -02:00
Fabiano Franz f6d1ac72a0 Use our own normalizers for cmd examples and descriptions 2016-10-17 11:49:55 -02:00
Fabiano Franz 6f66c0eafa Add normalizers for cmd examples and descriptions 2016-10-17 11:31:38 -02:00
Kubernetes Submit Queue 3f4c438946 Merge pull request #34836 from mikedanese/prune-1
Automatic merge from submit-queue

kubectl: apply prune should fallback to basic delete when a resource has no reaper

Fixes #34790

cc @kubernetes/kubectl @MrHohn
2016-10-15 18:38:20 -07:00
Kubernetes Submit Queue dc6117f233 Merge pull request #34721 from juanvallejo/allow-callers-to-bypass-cmdutil-checkerr-logging
Automatic merge from submit-queue

Allow callers to bypass cmdutil.CheckError() logging

**Release note**:
```release-note
release-note-none
```

This patch is originally from:
https://github.com/kubernetes/kubernetes/pull/25451 (eedb67a30d)

Simplifies code where clients are writing their own errors, and want to
terminate with an exit code.

cc @smarterclayton
2016-10-15 16:34:36 -07:00
Kubernetes Submit Queue db80dd3339 Merge pull request #34854 from deads2k/cli-02-restmaper
Automatic merge from submit-queue

attempt to use discovery RESTMapper and fallback if we can't

Updates `kubectl` to always attempt discovery regardless of server version.  This is needed to extension servers.
2016-10-15 13:46:40 -07:00
Kubernetes Submit Queue c32a05333b Merge pull request #32671 from soltysh/generator_options
Automatic merge from submit-queue

Update run flags to point to generators docs

@janetkuo you've requested that in https://github.com/kubernetes/kubernetes/pull/32484#issuecomment-246840562 I'm opening this PR but like you I don't like the length of the descriptions already. The other problem with this is that there's not clean docs for a user to figure out what the generators are. I've stumbled upon this several times and I always found myself looking into the code :/ How about adding new flag/subcommand that will give you more information about generators and we'd move all those `--restart` and `--generator` information into specific generator info and present at the top level only general information?
2016-10-15 12:17:29 -07:00
Kubernetes Submit Queue d21af56e05 Merge pull request #34802 from ivan4th/remove-duplicated-code-in-kubectl-portforward-test
Automatic merge from submit-queue

Remove duplicated code in kubectl portforward test
2016-10-15 09:31:28 -07:00
Kubernetes Submit Queue a010d3b195 Merge pull request #34028 from juanvallejo/jvallejo/add-dry-run-flag-kubectl-apply
Automatic merge from submit-queue

add --dry-run flag to `kubectl apply, kubectl create`

Partially addresses https://github.com/kubernetes/kubernetes/issues/11488

**Release note**:
```release-note
release-note-none
```

Related StackOverflow:
http://stackoverflow.com/questions/38824409/validate-openshift-objects-defined-in-yaml-before-actually-applying-or-executing

This patch adds a `--dry-run` flag to the `apply` command in order to
allow validation of objects, without patching or creating them. If a
`--dry-run` flag is present and no validation errors are found, the
command will exit before "configuring" or creating any objects.

@ncdc @fabianofranz
2016-10-15 05:30:40 -07:00
Michael Fraenkel acb032fc72 Allow a selector when retrieving logs 2016-10-15 18:28:55 +08:00
Kubernetes Submit Queue c0fea2a1e2 Merge pull request #34862 from ymqytw/fix_edit_panic
Automatic merge from submit-queue

fix error handling

Add missing error handling mentioned in [#33250 Comment](https://github.com/kubernetes/kubernetes/pull/33250#issuecomment-253920315)
@janetkuo
2016-10-14 23:30:15 -07:00