Commit Graph

4787 Commits (e1ed79c80416a5c37afa223e909ee89ba41edb27)

Author SHA1 Message Date
David Eads a31d2c44f4 flatten nested lists for flatten in visitor 2018-07-05 07:57:53 -04:00
Kubernetes Submit Queue 63c33f3812
Merge pull request #65543 from juanvallejo/jvallejo/improve-help-wait-cmd
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>.

add help description and examples to wait

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

Adds --help description and examples to the `wait` command.

cc @soltysh
2018-07-05 04:31:48 -07:00
Kubernetes Submit Queue 9899d37b59
Merge pull request #65686 from WanLinghao/priorityclass_fix
Automatic merge from submit-queue (batch tested with PRs 64593, 65117, 65629, 65827, 65686). 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 `kubectl create priorityclass` failure bug

**What this PR does / why we need it**:
update` kubectl create priorityclass` command's api version.
**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 #65685 

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-04 18:52:22 -07:00
Kubernetes Submit Queue df1826c9d7
Merge pull request #65786 from juanvallejo/jvallejo/update-template-printer-check
Automatic merge from submit-queue (batch tested with PRs 65715, 65786). 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 --template printer defaulting

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

Depends on https://github.com/kubernetes/kubernetes/pull/65711
The relevant commit for this PR is the last one (`
fix go-template defaulting for commands w default output format`)

cc @deads2k @soltysh
2018-07-04 06:18:08 -07:00
Kubernetes Submit Queue 5a7bdd3eec
Merge pull request #65715 from deads2k/cli-82-rbac-fail
Automatic merge from submit-queue (batch tested with PRs 65715, 65786). 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>.

fail on rbac resources of non-v1 versions in reconcile

Reconcile only supports rbac/v1 and other resources are skipped.  This is good, except that only RBAC resources should really fail.  This makes it fail.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-07-04 06:18:05 -07:00
Kubernetes Submit Queue e3fa9133af
Merge pull request #64896 from rphillips/fixes/kubectl_eviction
Automatic merge from submit-queue (batch tested with PRs 65776, 64896). 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: wait for all errors and successes on podEviction

**What this PR does / why we need it**: This fixes `kubectl drain` to wait until all errors and successes are processed, instead of returning the first error. It also tweaks the behavior of the cleanup to check to see if the pod is already terminating, and if it is to not reissue the pod terminate which leads to an error getting thrown. This fix will allow `kubectl drain` to complete successfully when a node is draining.

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

**Special notes for your reviewer**:
/cc @sjenning 

**Release note**:
```release-note
NONE
```
#### Reproduction steps
### sleep.yml
```yaml
apiVersion: v1
kind: Pod
metadata:
  name: bash
spec: 
  containers:
  - name: bash
    image: bash
    resources:
      limits:
        cpu: 500m
        memory: 500Mi
    command:
    - bash
    - -c
    - "nothing() { sleep 1; } ; trap nothing 15 ; while true; do echo \"hello\"; sleep 10; done"
  terminationGracePeriodSeconds: 3000
  restartPolicy: Never
```

```
$ kubectl create ns testing
$ kubectl create -f sleep.yml
$ kubectl delete ns testing
$ kubectl drain 127.0.0.1 --force
```
2018-07-03 18:06:10 -07:00
Kubernetes Submit Queue 82eb501782
Merge pull request #65711 from deads2k/cli-81-template-generic
Automatic merge from submit-queue (batch tested with PRs 65677, 65711, 65150, 65726). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

make template printers a recommended printer

WIP because it needs tests.  Apparently there weren't any before.

@juanvallejo open a pull to this branch adding tests for commands that need `--template` support and I'll squash them in.

@liggitt since you think it's widespread, here's an option to make it "normal"

@kubernetes/sig-cli-maintainers
2018-07-03 16:35:09 -07:00
juanvallejo 122e748e18
fix go-template defaulting for commands w default output format
Fixes defaulting done for commands that default to a specific output
format (such as yaml, json) when a --template flag is provided and no
explicit --output value is given.

Under the above case, these commands will now properly default to
honoring the --template argument given, and default their --output
format to "go-template".
2018-07-03 17:50:33 -04:00
Ryan Phillips 5b4770e083 kubectl: wait for all errors and successes on podEviction 2018-07-03 16:11:16 -05:00
Kubernetes Submit Queue 0c698a4766
Merge pull request #65482 from wgliang/master.handle-args
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>.

Fix 'kubectl cp' with no arguments causes a panic

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

"kubectl cp" with no arguments causes a panic

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Fix 'kubectl cp' with no arguments causes a panic
```
2018-07-03 11:30:48 -07:00
juanvallejo 25a4932653 add --template tests for commands
Adds --template printing test-cmd tests for the following commands:
kubectl annotate, kubectl apply, kubectl autoscale, kubectl
convert, kubectl create, kubectl expose, kubectl get, kubectl label,
kubectl patch.
2018-07-03 13:53:06 -04:00
David Eads 70417ca150 make template printers a recommended printer 2018-07-03 07:47:17 -04:00
David Eads 52d45cfd4f move template printers to genericclioptions 2018-07-03 07:46:51 -04:00
Kubernetes Submit Queue 20453a7a4f
Merge pull request #65700 from soltysh/output_format
Automatic merge from submit-queue (batch tested with PRs 65648, 65700, 64976, 65692, 65667). 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 output format so that it matches actual accepted values

/assign @juanvallejo 

**Release note**:

```release-note
NONE
```
2018-07-02 19:46:12 -07:00
Kubernetes Submit Queue 7dcac9d2a5
Merge pull request #65648 from sttts/sttts-k8s-metrics-codegen
Automatic merge from submit-queue (batch tested with PRs 65648, 65700, 64976, 65692, 65667). 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>.

k8s.io/metrics: normalize and fix codegen script

~~Builds on https://github.com/kubernetes/kubernetes/pull/65645. Will rebase when that one merges.~~ merged
2018-07-02 19:46:09 -07:00
Guoliang Wang 254b02bcc6 fix 'kubectl cp' with no arguments causes a panic 2018-07-03 10:09:27 +08:00
Kubernetes Submit Queue 38abda6d87
Merge pull request #65688 from WanLinghao/priorityclass_description_fix
Automatic merge from submit-queue (batch tested with PRs 65348, 65599, 65635, 65688, 65691). 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 a typo error in description

**What this PR does / why we need it**:
fix a typo error in description
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-02 16:52:15 -07:00
Kubernetes Submit Queue 1b758107fc
Merge pull request #65329 from deads2k/cli-76-builder-defer
Automatic merge from submit-queue (batch tested with PRs 65299, 65524, 65154, 65329, 65536). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

make builder tolerant of restmapper failures when it doesn't need answer

@kubernetes/sig-cli-maintainers 

The restmapper, category expander, and client are not required for local lookups.  Make them late binding functions instead of building and gathering errors early.

/assign @soltysh @juanvallejo 

```release-note
NONE
```
2018-07-02 11:06:19 -07:00
Kubernetes Submit Queue a3b479af26
Merge pull request #65524 from interma/log_message_kubectl_helpers
Automatic merge from submit-queue (batch tested with PRs 65299, 65524, 65154, 65329, 65536). 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>.

Unify log messages in pkg/kubectl/cmd/util/helpers.go

**What this PR does / why we need it**:
Unify a flag fatal message from "err accessing ..." to "**error** accessing ...", follow the word of other messages in _pkg/kubectl/cmd/util/helpers.go_. 

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

**Special notes for your reviewer**:
Very glad to open my first PR for kubernetes, thanks.

**Release note**:

```release-note
NONE
```
2018-07-02 11:06:11 -07:00
Kubernetes Submit Queue a9be7b0233
Merge pull request #65299 from WanLinghao/get_log_fix
Automatic merge from submit-queue (batch tested with PRs 65299, 65524, 65154, 65329, 65536). 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 a log param error

**What this PR does / why we need it**:
As the patch shows, it fix a small log param error in pkg/kubectl/cmd/get/get.go
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-02 11:06:07 -07:00
David Eads 58136ee568 fail on rbac resources of non-v1 versions in reconcile 2018-07-02 13:07:16 -04:00
Kubernetes Submit Queue 7786bd8c9a
Merge pull request #64654 from atlassian/missing-error-handling
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>.

Add missing error handling in schema-related code

**What this PR does / why we need it**:
Adds missing error handling to a few places.

**Which issue(s) this PR fixes**
Updates #51457. Still more work to do to fix the issue - client generation code needs to be updated (addressed in https://github.com/kubernetes/kubernetes/pull/64664).

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

/kind bug
/sig api-machinery
2018-07-02 07:14:34 -07:00
Maciej Szulik 972f1444c5
Update output format so that it matches actual accepted values 2018-07-02 13:35:31 +02:00
Dr. Stefan Schimanski d79cf25497 Update external k8s.io/metrics imports 2018-07-02 10:44:18 +02:00
WanLinghao 2664470343 fix `kubectl create priorityclass` failure bug 2018-07-02 15:03:22 +08:00
WanLinghao 33e2b8a699 fix a typo error 2018-07-02 14:55:49 +08:00
Kubernetes Submit Queue 1c2b2de690
Merge pull request #65380 from janetkuo/delete-ds-12
Automatic merge from submit-queue (batch tested with PRs 65518, 65624, 65380, 65390, 65586). 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 kubectl delete hack that handles DaemonSet deletion

**What this PR does / why we need it**: follow up #64847

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


**Special notes for your reviewer**: 
/cc @liggitt @soltysh 

**Release note**:

```release-note
NONE
```
2018-06-29 18:30:12 -07:00
David Eads bc10b25465 make builder tolerant of restmapper failures when it doesn't need the answer 2018-06-29 11:07:36 -04:00
Jordan Liggitt 5cea147cd3
deprecate openapi printing in kubectl in favor of server-side printing 2018-06-28 19:41:05 -04:00
Jordan Liggitt 613b302b98
Fix bug printing openapi columns 2018-06-28 19:33:22 -04:00
Kubernetes Submit Queue 9255bf50f1
Merge pull request #65434 from yue9944882/bugfix-show-kind-for-crd
Automatic merge from submit-queue (batch tested with PRs 64575, 65120, 65463, 65434, 65522). 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>.

Set flag show-kind when getting multiple types

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

Set "--show-kind" flag if requesting multiple resource types.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-28 02:20:23 -07:00
yue9944882 c5c88006ef show kind for multiple resource types
review: simplify and trim codes

refactor ToPrinter and pass show kind flag

remove tests together with removed function
2018-06-28 11:22:09 +08:00
juanvallejo 54ddddaa2d
add help description and examples to wait 2018-06-27 14:53:07 -04:00
interma 7a130caa33 unify log messages 2018-06-27 15:46:35 +08:00
Janet Kuo 538ed3b847 Remove kubectl delete hack that handles DaemonSet deletion 2018-06-26 18:16:55 -07:00
David Eads aee798bbf3 kubectl convert should not double wrap output in nested lists 2018-06-26 11:50:37 -04:00
Mikhail Mazurskiy bfe313d5f3
Add missing error handling in schema-related code 2018-06-23 21:06:32 +10:00
Jeff Grafton 23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Jeff Grafton a725660640 Update to gazelle 0.12.0 and run hack/update-bazel.sh 2018-06-22 16:22:18 -07:00
Kubernetes Submit Queue a3fd45281a
Merge pull request #65370 from deads2k/cli-78-delete-verb
Automatic merge from submit-queue (batch tested with PRs 65377, 63837, 65370, 65294, 65376). 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>.

delete should tolerate a failed wait because of missing verbs

The power and ability to delete does not imply the power and ability to watch.  We correctly handled missing power (authz), but failed to account for ability (method not supported)

@kubernetes/sig-cli-maintainers 
@soltysh 

```release-note
Tolerate missing watch permission when deleting a resource
```
2018-06-22 16:16:11 -07:00
Kubernetes Submit Queue c3046182ec
Merge pull request #65377 from juanvallejo/jvallejo/restore-old-get-template-behavior
Automatic merge from submit-queue (batch tested with PRs 65377, 63837, 65370, 65294, 65376). 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>.

restore pre-1.11 behavior of `kubectl get --template=...`

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

Restores old behavior to the `--template` flag in `get.go`.
In old releases, providing a `--template` flag value and no `--output` value implicitly assigned a default value ("go-template") to `--output`, printing using the provided template argument.

Example:

```bash
# this should print using GoTemplate printer, but currently does not
$ kubectl get pod foo --template="{{ .metadata.name }}"
```

cc @deads2k @soltysh
2018-06-22 16:16:04 -07:00
juanvallejo 508145e529
special-case template printing in get.go 2018-06-22 14:58:27 -04:00
Kubernetes Submit Queue eb5a26f801
Merge pull request #65367 from deads2k/cli-77-delete
Automatic merge from submit-queue (batch tested with PRs 65339, 65343, 65324, 65335, 65367). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

make sure delete waiting doesn't re-evaluate the resource lists

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

```release-note
Prevents a `kubectl delete` hang when deleting controller managed lists
```

@kubernetes/sig-cli-maintainers
2018-06-22 10:31:24 -07:00
David Eads 2c514b5b1d delete should tolerate a failed wait because of missing verbs 2018-06-22 09:08:51 -04:00
David Eads 0e3f921457 make sure delete waiting doesn't re-evaluate the resource lists 2018-06-22 08:54:00 -04:00
Kubernetes Submit Queue 3a7c3d387c
Merge pull request #65326 from deads2k/cli-75-fix-printer-check
Automatic merge from submit-queue (batch tested with PRs 65290, 65326, 65289, 65334, 64860). 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 printer check to tolerate vendoring

After you've vendored code, the package includes a vendor dir.  This updates the code to tolerate that.

/assign @soltysh @juanvallejo 


```release-note
NONE
```
2018-06-22 04:43:06 -07:00
Kubernetes Submit Queue 570760dbe2
Merge pull request #65128 from brendandburns/kubectl
Automatic merge from submit-queue (batch tested with PRs 65116, 61718, 65140, 65128, 65099). 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>.

Detect a missing key error and print a cleaner message.

Closes https://github.com/kubernetes/kubernetes/issues/63247

@kubernetes/sig-cli-bugs
2018-06-21 13:59:15 -07:00
Kubernetes Submit Queue 02dba36128
Merge pull request #65019 from mirake/fix-typo-toto
Automatic merge from submit-queue (batch tested with PRs 65265, 64822, 65026, 65019, 65077). 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>.

Typo fix: toto -> to
2018-06-21 11:25:16 -07:00
David Eads 6dd9d1fff7 fix printer check to tolerate vendoring 2018-06-21 13:33:59 -04:00
Kubernetes Submit Queue 1cbb61f8a2
Merge pull request #64938 from brendandburns/todo2
Automatic merge from submit-queue (batch tested with PRs 64895, 64938, 63700, 65050, 64957). 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 an old TODO.

The ImagePullPolicy is immediately overwritten by the call to `updatePodSpec` below the initialization, so it's not needed where it is.
2018-06-21 04:15:08 -07:00