Commit Graph

5368 Commits (750881c0ab62a9f59d53582bc33826caa167aa83)

Author SHA1 Message Date
He Xiaoxi a96a390d92 Refactor scheduler factory test
Use `k8s.io/client-go/kubernetes/fake.Clientset` as the fake k8s client.

Signed-off-by: He Xiaoxi <xxhe@alauda.io>
2018-10-12 14:39:08 +08:00
k8s-ci-robot b1ea6dcfbc
Merge pull request #69449 from apelisse/verify-dry-run-support
kubectl: Verify dry run support
2018-10-11 13:45:12 -07:00
Maciej Szulik e0c9189082
Manual changes to package visibility 2018-10-11 22:01:06 +02:00
Maciej Szulik 61899e1654
Generated changes 2018-10-11 22:01:06 +02:00
Maciej Szulik 21789b85a6
Move pkg/kubectl/cmd/templates -> pkg/kubectl/util/temlpates 2018-10-11 22:01:03 +02:00
Mikalai Radchuk 75a137616e Adds support for `LC_MESSAGES` and `LC_ALL`
Implements the following locale lookup priority order: `LC_MESSAGES`, `LC_ALL`, `LANG`.
2018-10-11 20:06:38 +01:00
Sean Sullivan 5f8f607c27 kubectl: copy pod utils into util/podutils package 2018-10-11 10:49:52 -07:00
k8s-ci-robot 128b8fe4fe
Merge pull request #69477 from m1kola/port-forward_named_port
Adds support of named ports for kubectl port-forward
2018-10-10 16:46:35 -07:00
Antoine Pelisse f2e2a930f9 dry-run: Verify if the object supports dry-run
For each object, first we verify if they have a dryRun parameter in the
openapi for the patch verb. If we can't find the object, we assume that
CRD will behave like "namespace". So we check if namespace supports
dryRun. If it does, then we verify that the resource is a CRD.
2018-10-10 08:56:09 -07:00
Antoine Pelisse a0460a5238 dry-run: Create class to find if a type is a CRD
Finding out if a Group-version-kind is a CRD is useful, since we want to
detect dry-run ability differently for CRDs.
2018-10-10 08:56:09 -07:00
Antoine Pelisse ae735282ad Create a method to check dryRun is supported
We don't want to run dryRun requests against servers that don't support
dry-run, since they might ignore the flag and just persist the unwanted
changes.

This creates a new method that checks in the OpenAPI if the dryRun
parameter can be used.
2018-10-10 08:55:33 -07:00
Davanum Srinivas 65da81f42e
Fix up test cases
Change-Id: Ib9245f78dbfb88f1f37a26ca64bf80d3f78d7497
2018-10-10 10:24:09 -04:00
Sean Sullivan 54a73630f1 kubectl factory client access: Moves remaining internal references into callers 2018-10-09 13:34:30 -07:00
k8s-ci-robot 830e09cc96
Merge pull request #46517 from goblain/cli-port-forward-listen
port-forward listen on address
2018-10-09 12:38:55 -07:00
k8s-ci-robot 137193faaf
Merge pull request #69448 from seans3/env-resolve-fix
kubectl env resolve: copy core fieldpath and resource dependencies into kubectl
2018-10-09 11:25:43 -07:00
k8s-ci-robot 48086eb7d4
Merge pull request #69543 from seans3/rollback-fix
kubectl rollback: remove duplicated code for printing pod template
2018-10-09 10:14:39 -07:00
k8s-ci-robot 637ba154c8
Merge pull request #65189 from juanvallejo/jvallejo/path-fixes-cmd-copy
fix paths w shortcuts when copying from pods
2018-10-09 10:14:28 -07:00
juanvallejo e55a28d169
fix paths w shortcuts when copying from pods
Addresses an issue where copying from a remote location containing path
shortcuts (podName:../../../tmp/foo) causes an index out of range panic.
2018-10-09 10:27:54 -04:00
WanLinghao 5958baa163 improve decription of command 'kubectl create clusterrole' 2018-10-09 15:50:30 +08:00
Sean Sullivan 20a54b312c kubectl rollback: remove duplicated code for printing pod template 2018-10-08 15:39:16 -07:00
Sean Sullivan 50c5b379b7 kubectl env resolve: copy core fieldpath and resource dependencies into kubectl 2018-10-08 14:50:20 -07:00
k8s-ci-robot d4c4871852
Merge pull request #69413 from seans3/rollback-fix
kubectl rollback: remove legacyscheme dependency
2018-10-08 13:02:19 -07:00
Mikalai Radchuk a19e84e001 Allows to use named ports in the kubectl portforward 2018-10-08 20:58:22 +01:00
Radek Pieczonka 4643c6e95e port-forward listen on address
adds an address flag to kubectl port-forward to allow to bind to a different ip then localhost
2018-10-07 22:18:18 +02:00
Maciej Szulik add731dff1
Manual changes to package visibility and test dependencies 2018-10-06 18:44:05 +02:00
Maciej Szulik 1d9617d8e1
Generated changes 2018-10-06 18:44:05 +02:00
Maciej Szulik 55d5df8a36
React to moves 2018-10-06 18:44:05 +02:00
Maciej Szulik 33adf367f9
Move each kubectl command to a separate directory 2018-10-06 18:44:05 +02:00
Guoliang Wang 187e2e01c9 Move scheduler cache interface and implementation to pkg/scheduler/internal/cache 2018-10-06 20:48:59 +08:00
Christoph Blecker 97b2992dc1
Update gofmt for go1.11 2018-10-05 12:59:38 -07:00
k8s-ci-robot fecb5edf8a
Merge pull request #66266 from wking/kubectl-drain-drop-backOff
kubectl: Drop backOff from DrainOptions
2018-10-04 19:34:34 -07:00
k8s-ci-robot 5800937698
Merge pull request #69398 from seans3/run-test-fix
kubectl run test: remove legacyscheme dependency and cleanups
2018-10-04 15:59:29 -07:00
k8s-ci-robot 34e2688835
Merge pull request #69404 from seans3/fake-test-fix
kubectl fake test factory: replace legacyscheme with kubectl scheme
2018-10-04 13:40:20 -07:00
k8s-ci-robot f7df7f8a25
Merge pull request #69335 from seans3/set-tests-fix
kubectl set tests: remove testapi core dependency
2018-10-04 13:40:10 -07:00
Sean Sullivan 95ec1f79b9 kubectl rollback: remove legacyscheme dependency 2018-10-04 13:13:32 -07:00
k8s-ci-robot 686f29fbc4
Merge pull request #66301 from wking/kubectl-drain-drop-typer
kubectl: Drop typer from DrainOptions
2018-10-04 12:28:57 -07:00
k8s-ci-robot 5589c5b3cb
Merge pull request #69401 from seans3/helpers-test-fix
kubectl helpers test: remove core dependencies
2018-10-04 10:09:55 -07:00
k8s-ci-robot 7136a3e4b2
Merge pull request #67880 from chenyb4/kubectl_openapi
Add kubectl openapi doc import comment
2018-10-04 01:05:15 -07:00
k8s-ci-robot 2d1ef05ad1
Merge pull request #69295 from deads2k/kbuectl-13-wait-false
allow condition value to specified for kubectl wait
2018-10-03 21:32:12 -07:00
Sean Sullivan fa727c809e kubectl fake test factory: replace legacyscheme with kubectl scheme 2018-10-03 15:38:28 -07:00
k8s-ci-robot 6cef8d7ce0
Merge pull request #69339 from seans3/apply-test-fix
kubectl apply test: remove core testapi dependency
2018-10-03 15:21:50 -07:00
Sean Sullivan b4d513b1f9 kubectl helpers test: remove core dependencies 2018-10-03 14:15:52 -07:00
Sean Sullivan 443dafd494 kubectl run test: remove legacyscheme dependency and cleanups 2018-10-03 13:35:45 -07:00
k8s-ci-robot af92d13de2
Merge pull request #69361 from seans3/get-test-fix
kubectl get test: remove testapi dependencies and cleanups
2018-10-03 10:38:25 -07:00
k8s-ci-robot 3c20dc71b0
Merge pull request #69345 from seans3/validation-test-fix
kubectl validation test: remove unused testapi dependency
2018-10-03 10:38:06 -07:00
Sean Sullivan d7f44e0eea kubectl apply test: remove core testapi dependency 2018-10-03 10:27:28 -07:00
k8s-ci-robot fe92da4566
Merge pull request #69347 from seans3/rolling-updater-test-fix
kubectl rolling-updater test: remove testapi and core testing dependency
2018-10-03 01:16:50 -07:00
Sean Sullivan 69c0fb74df kubectl set tests: remove testapi core dependency 2018-10-02 22:40:43 -07:00
Sean Sullivan b49a7a3193 kubectl get test: remove testapi dependencies and cleanups 2018-10-02 22:20:26 -07:00
Sean Sullivan c2a1e85a36 kubectl rolling-updater test: remove testapi and core testing dependency 2018-10-02 14:19:13 -07:00
Sean Sullivan 9e2b995b54 kubectl validation test: remove unused testapi dependency 2018-10-02 13:09:29 -07:00
Sean Sullivan fcdc129257 kubectl drain/cmd test: remove testapi dependency 2018-10-02 13:04:29 -07:00
David Eads 122529b97d allow condition value to specified for kubectl wait 2018-10-01 13:43:10 -04:00
Pingan2017 d1a280df44 remove --show-all 2018-09-29 17:09:05 +08:00
k8s-ci-robot 5f7e1b559b
Merge pull request #69181 from seans3/helpers-fix
kubectl remove references to internal version of resources
2018-09-28 14:33:47 -07:00
k8s-ci-robot 23e3ab83b6
Merge pull request #69174 from seans3/config-view-fix
kubectl small fix for config view to replace legacyscheme with kubect…
2018-09-28 14:33:38 -07:00
k8s-ci-robot 821d9fea48
Merge pull request #69182 from seans3/apply-test-fix
kubectl replaced reference to internal version of Deployment with ext…
2018-09-28 11:18:43 -07:00
Sean Sullivan 2a9115211a kubectl remove references to internal version of resources 2018-09-28 10:34:53 -07:00
k8s-ci-robot a71d96b796
Merge pull request #69178 from seans3/polymorphic-helpers-fix
kubectl remove internal version references in polymorphichelpers
2018-09-28 10:08:08 -07:00
k8s-ci-robot 7c024284ef
Merge pull request #69172 from seans3/test-small-fix
kubectl replace legacyscheme with kubectl scheme in two tests
2018-09-28 04:20:48 -07:00
Cao Shufeng e187e6d310 fix kubectl wait with no resource name provided 2018-09-28 12:03:11 +08:00
k8s-ci-robot 8fd28eface
Merge pull request #69167 from apelisse/kubectl-diff
Move `diff` command from alpha sub-command to root cmd
2018-09-27 20:52:11 -07:00
k8s-ci-robot a59474f756
Merge pull request #69132 from seans3/rollout-pause-resume-fix
kubectl remove internal version of resource for rollout pause/resume
2018-09-27 20:52:02 -07:00
Sean Sullivan 75210763bd kubectl replaced reference to internal version of Deployment with external version 2018-09-27 16:00:16 -07:00
k8s-ci-robot e5964b3fcc
Merge pull request #69162 from apelisse/kubectl-dry-run-diff
Use dry-run patch to get the merged version of the object
2018-09-27 14:41:53 -07:00
Sean Sullivan a20ba98b87 kubectl replace legacyscheme with kubectl scheme in two tests 2018-09-27 13:58:31 -07:00
Sean Sullivan 52e25446cb kubectl remove internal version references in polymorphichelpers 2018-09-27 13:51:00 -07:00
Sean Sullivan 6e990b715b kubectl small fix for config view to replace legacyscheme with kubectl scheme 2018-09-27 13:20:10 -07:00
Antoine Pelisse e1eadc5031 Move `diff` command to root rather than alpha
New command is now `kubectl diff` rather than `kubectl alpha diff` since
it's moving out of alpha soon, and will be using dry-run apply to
produce the diff rather than the custom merge logic.
2018-09-27 13:11:43 -07:00
Antoine Pelisse 2d3f7795c8 Use dry-run patch to get the merged version of the object 2018-09-27 13:06:12 -07:00
k8s-ci-robot 34860dafe2
Merge pull request #69150 from soltysh/issue69144
Fix panic in kubectl rollout commands
2018-09-27 11:07:56 -07:00
Sean Sullivan 71e60225a0 kubectl remove internal version of resource for rollout pause/resume 2018-09-27 10:26:35 -07:00
k8s-ci-robot 96965705a1
Merge pull request #69121 from seans3/editoptions-small-fix
Replaces dependency on internal version of resource with external ver…
2018-09-27 09:51:38 -07:00
k8s-ci-robot 63930183e0
Merge pull request #69119 from seans3/diff-small-fix
Replace internal reference of last-applied-config with external refer…
2018-09-27 09:51:29 -07:00
k8s-ci-robot 53fe9e2a30
Merge pull request #69118 from seans3/apply-small-fix
Replace internal dependency on last-applied-configuration with extern…
2018-09-27 09:51:20 -07:00
k8s-ci-robot 2588ad5f36
Merge pull request #69089 from soltysh/kubectl_issue539
Deduplicate list of directories
2018-09-27 09:51:06 -07:00
Maciej Szulik 96d01da215
Fix panic in kubectl rollout commands 2018-09-27 15:10:52 +02:00
k8s-ci-robot 4215774643
Merge pull request #68634 from seans3/remove-internal-version
Replace internal version of resource with external version for tests
2018-09-27 06:06:30 -07:00
Maciej Szulik 8555b53191
Deduplicate list of directories 2018-09-27 13:32:41 +02:00
Pingan2017 8593c02665 fix panic: kubectl rollout undo 2018-09-27 19:16:38 +08:00
k8s-ci-robot f008365bbe
Merge pull request #68806 from seans3/legacy-scheme-update
Move legacyscheme (internal version) to kubectl scheme (external vers…
2018-09-26 19:22:14 -07:00
k8s-ci-robot b637ae6515
Merge pull request #68851 from seans3/rollout-cleanup
Remove unused client in rollout status
2018-09-26 18:11:24 -07:00
k8s-ci-robot 71186a69a6
Merge pull request #67890 from WanLinghao/top_no_headers
add flag `--no-headers` to `kubectl top ...`
2018-09-26 15:53:19 -07:00
Sean Sullivan fe8a261cd6 Replaces dependency on internal version of resource with external version 2018-09-26 14:56:32 -07:00
k8s-ci-robot ea09a3b40c
Merge pull request #68525 from apelisse/kubectl-diff-simplify-interface
kubectl-diff: Simplify interface
2018-09-26 14:42:35 -07:00
Sean Sullivan 7863e7c4ba Replace internal reference of last-applied-config with external reference for diff 2018-09-26 14:33:33 -07:00
Sean Sullivan 947034e7f7 Replace internal dependency on last-applied-configuration with external dependency 2018-09-26 14:19:14 -07:00
Sean Sullivan 4e8e2705b0 Changes to be more consistent about import aliases and group/kind 2018-09-26 13:42:25 -07:00
Sean Sullivan eadb6b18ac More cleanup 2018-09-26 13:12:35 -07:00
Sean Sullivan d73583552c Remove unused client in rollout status 2018-09-26 13:12:35 -07:00
k8s-ci-robot 1886e09041
Merge pull request #67929 from charrywanganthony/label_dryrun
fix the output of dryrun when label the same value as original
2018-09-26 06:08:44 -07:00
k8s-ci-robot f815e3925a
Merge pull request #68698 from seans3/replace-fix
Replace internal version Encoder with external version Encoder
2018-09-25 22:57:44 -07:00
k8s-ci-robot 98748d1a1b
Merge pull request #68697 from seans3/editoptions-fix
Replace internal version Encoder with external version Encoder
2018-09-25 22:57:35 -07:00
k8s-ci-robot 3a933224f9
Merge pull request #68696 from seans3/autoscale-fix
Replace internal version resources with external version resources
2018-09-25 22:57:25 -07:00
k8s-ci-robot b042219432
Merge pull request #68695 from seans3/expose-fix
Replace internal version Encoder with external version Encoder
2018-09-25 21:46:36 -07:00
k8s-ci-robot b442c25325
Merge pull request #68694 from seans3/create-fix
Replace internal version Encoder with external version Encoder
2018-09-25 19:24:18 -07:00
k8s-ci-robot cc04abca19
Merge pull request #68681 from dlespiau/instrument-kubectl
Add go profile instrumentation to kubectl
2018-09-25 19:24:08 -07:00
k8s-ci-robot bcbc4f7337
Merge pull request #68661 from seans3/attachable-fix
Remove unused internal version of Pod resource
2018-09-25 19:23:39 -07:00
k8s-ci-robot 1f08d955cd
Merge pull request #68659 from seans3/drain-test-fix
Replace internal version of resource in drain test with external version
2018-09-25 18:12:54 -07:00
k8s-ci-robot a38ad775f7
Merge pull request #68641 from seans3/kubectl-extract-2
Removes dependency on internal version of resource
2018-09-25 18:12:35 -07:00
k8s-ci-robot 807d942f19
Merge pull request #68637 from seans3/legacy-scheme-fix
Remove legacyscheme by adding ParameterCodec to kubectl scheme
2018-09-25 18:12:26 -07:00
k8s-ci-robot 1987b985e4
Merge pull request #68593 from seans3/condition-fix
Removes dependency on internal version of resource
2018-09-25 18:12:15 -07:00
Chao Wang 013168c668 fix the output of dryrun when label the same value as original 2018-09-25 17:59:26 +08:00
k8s-ci-robot 2970366327
Merge pull request #67860 from m1kola/cleanup_logsForObject
Cleanup: removes support of internal types from logsForObject
2018-09-25 01:27:40 -07:00
W. Trevor King ab993e346c kubectl: Drop backOff from DrainOptions
The property was added in b73fae6c (Fix kubectl drain for statefulset
and use eviciton for drain if possible, 2016-10-20, #35483), but
b358b2df (make drain retry forever and use new timeout,
2016-11-28, #37604) removed the last consumer.
2018-09-24 15:06:01 -07:00
Sean Sullivan 446fbd51e3 More specific import aliases 2018-09-24 11:39:33 -07:00
Sean Sullivan 219246eaad Replace internal version of resource in drain test with external version 2018-09-24 11:35:21 -07:00
Sean Sullivan 49852289de Replace internal version of resource with external version for tests 2018-09-24 11:12:36 -07:00
k8s-ci-robot 170dcc2ea0
Merge pull request #68754 from bradhoekstra/optional-service-env-variables
kubelet: Make service environment variables optional
2018-09-24 10:59:32 -07:00
Brad Hoekstra a596030cb3 Update bazel 2018-09-22 00:10:08 -04:00
Brad Hoekstra 42da186b62 Address review comments 2018-09-21 20:06:32 -04:00
Sean Sullivan 8d67edfc41 Replace internal version Encoder with external version Encoder for autoscale. 2018-09-20 13:51:37 -07:00
Sean Sullivan 4ad673ce41 Replace internal version Encoder with external version encoder for create and create_test. 2018-09-20 13:49:06 -07:00
Sean Sullivan 3ccfb2dc4c Updated PodExecOptions to external version 2018-09-19 13:25:18 -07:00
Sean Sullivan 0ecc544a79 Change service from internal version to external version 2018-09-18 16:05:23 -07:00
Sean Sullivan 7a2a987ee4 Move legacyscheme (internal version) to kubectl scheme (external version) 2018-09-18 14:24:47 -07:00
Damien Lespiau 5d634e7db6 Add go profile instrumentation to kubectl
This commit adds two new global options to kubectl: --profile and
--profile-output, writing out go profiles to disk to debug interesting and
unexpected kubectl behaviour.

As an example, here is how to capture a block file, eg. for how long are we
blocked on I/O and where?

$ kubectl get nodes --profile=mutex -v6
$ go tool pprof -png ./profile.pprof > out.png
$ google-chrome out.png

Fixes: #68679
2018-09-18 18:28:43 +01:00
ravisantoshgudimetla 452615c53f Fix drain for evicting terminal DS pods and pods with local storage 2018-09-17 23:01:48 -04:00
Brad Hoekstra ac8799a80d kubelet: Make service environment variables optional 2018-09-17 16:27:36 -04:00
Sean Sullivan 3fa346e744 Replace internal version Encoder with external version Encoder 2018-09-14 15:34:16 -07:00
Sean Sullivan 731b985184 Replace internal version Encoder with external version Encoder 2018-09-14 15:24:18 -07:00
Sean Sullivan 84ef7a3649 Replace internal version Encoder with external version Encoder 2018-09-14 14:55:00 -07:00
Sean Sullivan 16a4060eb5 Remove unused internal version of Pod resource 2018-09-13 22:38:07 -07:00
Sean Sullivan 86b12106c8 Remove dependency on internal version of resource 2018-09-13 17:32:52 -07:00
Sean Sullivan 8f06514fe7 Removes dependency on internal version of resource 2018-09-13 17:03:54 -07:00
Sean Sullivan ce65602410 Remove legacyscheme by adding ParameterCodec to kubectl scheme 2018-09-13 14:37:30 -07:00
Sean Sullivan 9bacee8878 Small fix to remove dependency on internal version of resource 2018-09-13 14:16:07 -07:00
Antoine Pelisse 0db6249740 kubectl-diff: Simplify interface
The current interface is kind of clunky and not super easy to use, since
you have to specify parameters to specify which versions to diff. Also
the default isn't the most useful setting.

Change the interface by removing all the parameters and force only one
useful use-case, that is: diffing what's currently live against
what would be live if applied.
2018-09-11 15:53:29 -07:00
Kubernetes Submit Queue 92ad24cc4d
Merge pull request #68132 from soltysh/deprecate_run
Automatic merge from submit-queue (batch tested with PRs 63011, 68089, 67944, 68132). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Start deprecating all generators in run except for run-pod/v1

**What this PR does / why we need it**:
This was discussed during SIG-CLI meetings over several past months. The direction is that we want to move away from `kubectl run` because it's over bloated and complicated for both users and developers. We want to mimic `docker run` with `kubectl run` so that it *only* creates a pod, and if you're interested in other resources `kubectl create` is the intended replacement. 

This PR starts with deprecating all of the generator except for the pod one.

/assign @juanvallejo 
/sig cli
/milestone v1.12

**Release note**:
```release-note
Deprecate kubectl run generators, except for run-pod/v1
```
2018-09-04 10:24:47 -07:00
Maciej Szulik 2c4917db86
Start deprecating all generators in run except for run-pod/v1 2018-09-04 11:24:20 +02:00
Tomas Nozicka def9c9eb42 Update Bazel 2018-09-03 15:34:50 +02:00
Tomas Nozicka 7793211669 Switch kubectl rollout status to UntilWithSync to avoid premature
timeouts
2018-09-03 15:34:20 +02:00
Tomas Nozicka f2a6fd394a Generalize kubectl rollout StatusViewer interface 2018-09-03 15:34:20 +02:00
Kubernetes Submit Queue 058b26f38e
Merge pull request #68069 from apelisse/kubectl-apply-dryrun
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Add --server-dry-run flag to `kubectl apply`

- Adds the flag
- changes the helper so that we can pass options for patch,
- Adds a test to make sure it doesn't change the object

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

**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
Add new `--server-dry-run` flag to `kubectl apply` so that the request will be sent to the server with the dry-run flag (alpha), which means that changes won't be persisted.
```
2018-09-02 15:31:05 -07:00
Antoine Pelisse 967280b58e Add --server-dry-run flag to `kubectl apply` 2018-09-02 13:13:46 -07:00
Kubernetes Submit Queue 380931aca7
Merge pull request #65545 from tvieira/kubectl_logs_msg
Automatic merge from submit-queue (batch tested with PRs 67578, 68154, 68162, 65545). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

fix usage string for the kubectl logs command

Even though the use of an inline [CONTAINER] name is still accepted for,
legacy purpose the error message does not match what the documentation
or man page says. This commit aligns the usage string that is displayed
when the `kubectl logs` command is called with more than one container
name (with the use of the -c flag or not).

```release-note
NONE
```
2018-09-01 03:33:07 -07:00
Kubernetes Submit Queue 10b1b83893
Merge pull request #67965 from smarterclayton/slim_output
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Reduce the minwidth of the cli table printer

For a few columns we want to have a smaller width and 10 is excessive. The example is CPU and memory for nodes.
2018-09-01 00:24:59 -07:00
Kubernetes Submit Queue c682496197
Merge pull request #67211 from juanvallejo/jvallejo/prototype-sorter
Automatic merge from submit-queue (batch tested with PRs 68051, 68130, 67211, 68065, 68117). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Update `kubectl get` sorter to deal with server-side printing

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

### Why?

Currently, we default to non-server-side printing when sorting items in `kubectl get`. This means that instead of taking advantage of having the server tell `kubectl` how to display information, `kubectl` falls back to using hardcoded resource types to figure out how to print its output. This does not really work with resources that `kubectl` does not know about, and it goes against our goal of snipping any dependencies that `kubectl` has on the core repo.

This patch adds a sorter capable of dealing with Table objects sent by the server when using "server-side printing".

A few things left to take care of:

- ~~[ ] When printing `all` resources, this implementation does not handle sorting every single Table object, but rather _only_ the rows in each object. As a result, output will contain sorted resources of the same _kind_, but the overall list of mixed resources will _not_ itself be sorted. Example:~~

```bash
$ kubectl get all --sort-by .metadata.name
NAME            READY     STATUS    RESTARTS   AGE
# pods here will be sorted:
pod/bar         0/2       Pending   0          31m
pod/foo         1/1       Running   0          37m

NAME                        DESIRED   CURRENT   READY     AGE
# replication controllers here will be sorted as well:
replicationcontroller/baz   1         1         1         37m
replicationcontroller/buz   1         1         1         37m

# ... but the overall mixed list of rc's and pods will not be sorted
```
This occurs because each Table object received from the server contains all rows for that resource _kind_. We would need a way to build an ambiguous Table object containing all rows for all objects regardless of their type to have a fully sorted mixed-object output.

- [ ] handle sorting by column-names, rather than _only_ with jsonpaths (Tracked in https://github.com/kubernetes/kubernetes/issues/68027)

cc @soltysh @kubernetes/sig-cli-maintainers @seans3 @mengqiy
2018-08-31 15:32:40 -07:00
Clayton Coleman 02099f445b
Reduce the minwidth of the cli table printer
For a few columns we want to have a smaller width and 10 is excessive.
2018-08-31 14:13:48 -04:00
juanvallejo c32d10f3cf
add prototype sorting for table rows 2018-08-30 16:09:05 -04:00
WanLinghao c9b6c92f10 add flag `--no-headers` to `kubectl top ...` 2018-08-30 19:22:06 +08:00
Weibin Lin 7d7df52691 update bazel 2018-08-30 00:27:18 +08:00
Weibin Lin f2eb73846c use CertificatesV1beta1() instead of deprecated Certificates() 2018-08-30 00:27:17 +08:00
Kubernetes Submit Queue 256070adcf
Merge pull request #66719 from hanxiaoshuai/fix0727
Automatic merge from submit-queue (batch tested with PRs 67938, 66719, 67883). 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>.

return err when Unmarshal failed

**What this PR does / why we need it**:
return err when Unmarshal failed
**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-08-28 10:02:05 -07:00
AdamDang 81acfb922c
Fix the returned messaged: statefullsets->statefulsets
Fix the returned messaged: statefullsets->statefulsets
2018-08-28 15:20:21 +08:00
Yuanbin.Chen d6482d6fd0 Add kubectl openapi doc import comment
Signed-off-by: Yuanbin.Chen <cybing4@gmail.com>
2018-08-27 15:20:38 +08:00
Laszlo Janosi a6da2b1472 K8s SCTP support implementation for the first pull request
The requested Service Protocol is checked against the supported protocols of GCE Internal LB. The supported protocols are TCP and UDP.

SCTP is not supported by OpenStack LBaaS. If SCTP is requested in a Service with type=LoadBalancer, the request is rejected. Comment style is also corrected.

SCTP is not allowed for LoadBalancer Service and for HostPort. Kube-proxy can be configured not to start listening on the host port for SCTP: see the new SCTPUserSpaceNode parameter

changed the vendor github.com/nokia/sctp to github.com/ishidawataru/sctp. I.e. from now on we use the upstream version.

netexec.go compilation fixed. Various test cases fixed

SCTP related conformance tests removed. Netexec's pod definition and Dockerfile are updated to expose the new SCTP port(8082)

SCTP related e2e test cases are removed as the e2e test systems do not support SCTP

sctp related firewall config is removed from cluster/gce/util.sh. Variable name sctp_addr is corrected to sctpAddr in pkg/proxy/ipvs/proxier.go

cluster/gce/util.sh is copied from master
2018-08-27 05:56:27 +00:00
Mikalai Radchuk ecbc78993d Removes support of internal types from logsForObject 2018-08-25 13:43:52 +03:00
Kubernetes Submit Queue 47ea5eac71
Merge pull request #66983 from mortent/BetterRolloutStatusMsgForStatefulSet
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>.

Better error message when checking rollout status for StatefulSet wit…

…h OnDelete strategy type



**What this PR does / why we need it**: The error message when checking the rollout status for a StatefulSet with the OnDelete strategy type can be confusing (ref #64500). It gives the impression that something has gone wrong when the issue is simply that there is no rollout status. The error message is updated to use similar language as for DaemonSet in the same situation.

**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**:

**Release note**:

```release-note
Improved error message when checking the rollout status of StatefulSet with OnDelete strategy type
```
2018-08-23 18:05:49 -07:00
Kubernetes Submit Queue 501e3f7e7d
Merge pull request #67707 from apelisse/fix-diff-404
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>.

diff: Fix crash when remote object doesn't exist

Since we're saving nil in an interface rather than the implementation,
we can't compare to nil to check if the remote object exists or
not. Change the struct to save in the implementation.



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

**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-08-23 15:32:14 -07:00
Kubernetes Submit Queue f2328e7b9f
Merge pull request #67548 from neolit123/owners-kubectl
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 labels to kubectl OWNERS files

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

This change makes it possible to automatically add the two labels: `area/kubectl` and `sig/cli` to PRs that touch the paths in question.

this already exists for kubeadm:
https://github.com/kubernetes/kubernetes/blob/master/cmd/kubeadm/OWNERS#L17-L19

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
refs https://github.com/kubernetes/community/issues/1808

**Special notes for your reviewer**:
none

**Release note**:

```release-note
NONE
```
/area kubectl
@kubernetes/sig-cli-pr-reviews 
/cc @cblecker @tpepper
2018-08-23 12:32:40 -07:00
Kubernetes Submit Queue 8fb6939853
Merge pull request #66980 from flimzy/typo
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>.

Correct typos and missing word in help text

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

Corrects a grammatical/readability error in the help output.
2018-08-23 02:44:43 -07:00
Kubernetes Submit Queue 2e82dd2715
Merge pull request #67713 from liggitt/process-substitution
Automatic merge from submit-queue (batch tested with PRs 59230, 66233, 67483, 67713). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Make kubectl create secret tls work with process substitution

Fixes #57909

```release-note
`kubectl create secret tls` can now read certificate and key files from process substitution arguments
```
2018-08-22 23:04:26 -07:00
Kubernetes Submit Queue 20ef0f5db9
Merge pull request #67698 from soltysh/fix_create
Automatic merge from submit-queue (batch tested with PRs 63757, 67698, 67712, 67494, 67700). 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 NameFromCommandArgs when passing command after -- 

**What this PR does / why we need it**:
This fixes `kubectl create deployment name --image=xyz -- mycommand` invocation. Currently the `NameFromCommandArgs` is unnecessarily parsing arguments after `--`. 

**Special notes for your reviewer**:
/assign @juanvallejo 

**Release note**:
```release-note
None
```
2018-08-22 14:17:18 -07:00
Kubernetes Submit Queue 4e19d6820d
Merge pull request #67682 from kevinburke/fix-typo
Automatic merge from submit-queue (batch tested with PRs 66229, 67682, 67585, 67641, 67697). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

pkg/kubectl: fix spelling mistake

**Release note**:
```release-note
NONE
```
2018-08-22 10:04:10 -07:00
Kubernetes Submit Queue 24dc2b4204
Merge pull request #66229 from WanLinghao/indentReove
Automatic merge from submit-queue (batch tested with PRs 66229, 67682, 67585, 67641, 67697). 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>.

clean unused function

**What this PR does / why we need it**:
clean unused function
**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-08-22 10:04:07 -07:00
Jordan Liggitt 24b639afcc
Make kubectl create secret tls work with process substitution 2018-08-22 10:35:07 -04:00
Kubernetes Submit Queue 5fb32e703b
Merge pull request #67615 from rphillips/fixes/attach_func_initializer
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>.

attach: Move the AttachFunc default function to the initializer

Fixes a partially constructed AttachOptions

**What this PR does / why we need it**: NewAttachOptions partially constructs an AttachOptions structure. The defaultAttachFunc should be set automatically, so the caller can potentially override the default behavior.

**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
```

/cc @kubernetes/sig-cli-api-reviews
2018-08-22 07:32:57 -07:00
Jonathan Hall 2a24e37378 Add missing word to help text and remove double spaces 2018-08-22 16:08:40 +02:00
Antoine Pelisse a3417fe62c diff: Fix crash when remote object doesn't exist
Since we're saving nil in an interface rather than the implementation,
we can't compare to nil to check if the remote object exists or
not. Change the struct to save in the implementation.
2018-08-22 06:36:29 -07:00
Maciej Szulik ace8386d13
Get rid of argsLenAtDash in create job 2018-08-22 15:23:15 +02:00
Maciej Szulik 59fc12006b
Fix NameFromCommandArgs when passing command after -- 2018-08-22 15:23:13 +02:00
Kubernetes Submit Queue ce8a6285df
Merge pull request #67635 from nikhita/customresource-subresource-patch-04
Automatic merge from submit-queue (batch tested with PRs 67298, 67518, 67635, 67673). 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 unstructured metadata accessors to respect omitempty semantics

Fixes #67541
Fixes #48211 
Fixes #49075
Follow up of #67562

`ObjectMeta` has fields with `omitempty` json tags. This means that when the fields have zero values, they should not be persisted in the object.

Before this PR, some of the metadata accessors for unstructured objects did not respect these semantics i.e they would persist a field even if it had a zero value.

This PR updates the accessors so that the field is removed from the unstructured object map if it contains a zero value.

/sig api-machinery
/kind bug
/area custom-resources
/cc sttts liggitt yue9944882 roycaihw 
/assign sttts liggitt 

**Release note**:

```release-note
NONE
```
2018-08-21 18:33:07 -07:00
Kubernetes Submit Queue 70bc7f6877
Merge pull request #67298 from sylr/logging-calltrace
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>.

Log real file's name and line

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

Have correct location of emission in the logs

**Release note**:

pkg/kubectl/util/logs & staging/src/k8s.io/apiserver/pkg/util/logs
use `glog.info(...)` but this function is not made to be wrapped because
the underlying mechanism use a fixed call trace length to determine
where the log has been emited.

This results is having `logs.go:49` in the logs which is in the body
of the wrapper function and thus useless.

Instead use `glog.infoDepth(1, ...)` which tells the underlying mechanism
to go back 1 more level in the call trace to determine where the log
has been emitted.
2018-08-21 17:38:46 -07:00
Kevin Burke c6c23daafb
pkg/kubectl: fix spelling mistake 2018-08-21 16:27:32 -07:00
Kubernetes Submit Queue f077d6736b
Merge pull request #67658 from soltysh/staging_cli_runtime
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Create cli-runtime staging repository

**What this PR does / why we need it**:
This PR creates a designated repository for CLI helpers, which are used for:
- kubectl itself
- kubectl plugins
- commands that want to mimic kubectl behavior

/assign @deads2k @juanvallejo 
@seans3 @pwittrock fyi

**Release note**:
```release-note
Create cli-runtime staging repository
```
2018-08-21 16:20:55 -07:00
Lubomir I. Ivanov 21dd03dcbc add labels to kubectl OWNERS files 2018-08-22 00:40:54 +03:00
Davanum Srinivas 9b43d97cd4
Add Labels to various OWNERS files
Will reduce the burden of manually adding labels. Information pulled
from:
https://github.com/kubernetes/community/blob/master/sigs.yaml

Change-Id: I17e661e37719f0bccf63e41347b628269cef7c8b
2018-08-21 13:59:08 -04:00
Maciej Szulik 5b55e1f8ed
Create cli-runtime staging repository 2018-08-21 17:08:30 +02:00
Nikhita Raghunath dabd56f7df Fix tests to support ObjectMeta omitempty semantics 2018-08-21 13:17:25 +05:30
Ryan Phillips 9abe17f0a0 attach: Move the AttachFunc default function to the initializer
Fixes a partially constructed AttachOptions
2018-08-20 14:10:15 -05:00
Kubernetes Submit Queue 1737a43324
Merge pull request #66876 from juanvallejo/jvallejo/prototype-plugins
Automatic merge from submit-queue (batch tested with PRs 67062, 67169, 67539, 67504, 66876). 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 the kubectl plugin mechanism

**Release note**:
```release-note
The plugin mechanism functionality to closely follow the git plugin design
```

Replace the existing plugin mechanism with the design proposed in https://github.com/kubernetes/community/pull/2437.

~~_The full implementation of the plugin mechanism itself is entirely contained within the first commit._~~

## Walkthrough

Under the new design, there is no plugin installation or loading required to use plugins.
A plugin is simply any executable file on a user's PATH whose name begins with `kubectl-`.
- Plugins receive the inherited environment from the `kubectl` binary. All environment variables
accessible by `kubectl` become accessible by the plugin.
- Plugins decide which command path they wish to implement based on their name. For example, a plugin wanting to provide a new command `foo`, would simply be named `kubectl-foo`.

### Creating a plugin

Below is an example plugin, that we will use for this walkthrough. Plugins may be written in any language, and handle arguments and flags in any way, optionally (as a convention) providing a way to retrieve their version via a `version` subcommand.

```bash
#!/bin/bash

# optional argument handling
if [[ "$1" == "version" ]]
then
    echo "1.0.0"
    exit 0
fi

# optional argument handling
if [[ "$1" == "config" ]]
then
    echo $KUBECONFIG
    exit 0
fi

echo "I am a plugin named kubectl-foo"
```

### Using a plugin

To use a plugin, simply make it executable:

```bash
sudo chmod +x ./kubectl-foo
```

and place it anywhere in your PATH:

```bash
sudo mv ./kubectl-foo /usr/local/bin
```

You may now invoke your plugin as a `kubectl` command:

```bash
$ kubectl foo
I am a plugin named kubectl-foo
```

All args and flags are passed as-is to the executable:

```bash
$ kubectl foo version
1.0.0
```

All environment variables are also passed as-is to the executable:

```bash
$ export KUBECONFIG=~/.kube/config
$ kubectl foo config
/home/<user>/.kube/config

$ KUBECONFIG=/etc/kube/config kubectl foo config
/etc/kube/config
```

Additionally, the first argument that is passed to a plugin will always be the full path to the location where it was invoked (`$0` would equal `/usr/local/bin/kubectl-foo` in our example above).

### Plugin discoverability

Seeing as how the `kubectl plugin` command is left as a no-op with this PR (perhaps it could serve as an entrypoint towards additional plugin functionality in the future), a small subcommand has been included that _lists all available plugin executables on a user's PATH_, along with any warnings it finds.

Example usage of this new subcommand is included below:

```bash
$ kubectl plugin list
The following kubectl-compatible plugins are available:

test/fixtures/pkg/kubectl/plugins/kubectl-foo
plugins/kubectl-foo
  - warning: plugins/kubectl-foo is overshadowed by a similarly named plugin: test/fixtures/pkg/kubectl/plugins/kubectl-foo
plugins/kubectl-invalid
  - warning: plugins/kubectl-invalid identified as a kubectl plugin, but it is not executable
plugins/kubectl-bar

error: 2 plugin warnings were found
```

cc @kubernetes/kubectl-maintainers @kubernetes/sig-cli-pr-reviews @soltysh @seans3 @mengqiy
2018-08-17 11:58:22 -07:00
Kubernetes Submit Queue 4fff352371
Merge pull request #67316 from m1kola/67314_fix_regression
Automatic merge from submit-queue (batch tested with PRs 66920, 67316, 67363, 67528, 66963). 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>.

Fixes regression in kubectl logs: the --all-containers=true option didn't work

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

Fixes regression introduced in #66398 and adds unit tests for logging with `--all-containers=true`. See #67314 for more details.

**Which issue(s) this PR fixes**:
Fixes #67314

**Special notes for your reviewer**:

I didn't cover cases with `coreinternal.PodList` and `coreinternal.Pod` in tests, because it doesn't look like we need them: I didn't manage to find any callers of the `logsForObjectWithClient` and `logsForObject` functions, so, probably, we can remove them. I'll double check and try to do that separately once this PR is merged.

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

/sig cli
2018-08-17 10:37:09 -07:00
Kubernetes Submit Queue d3a0bb6a84
Merge pull request #67137 from juanvallejo/jvallejo/usability-fix-kube-get
Automatic merge from submit-queue (batch tested with PRs 67137, 67372, 67505, 67373, 67357). 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>.

prevent "No resources found" output on forbidden error

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

This was originally fixed in https://github.com/kubernetes/kubernetes/pull/35115, but made its way back. Added a small test

cc @soltysh
2018-08-16 10:34:11 -07:00
Kubernetes Submit Queue 4ccee77fad
Merge pull request #67399 from deads2k/cli-04-patch
Automatic merge from submit-queue (batch tested with PRs 67399, 67471, 66815, 67301, 55840). 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 patch to work with --local and avoid extra requests

--local wasn't being respected by the resourcebuilder and then the later refreshes were unnecessary and violated --local in some cases.

@kubernetes/sig-cli-maintainers 
@juanvallejo 

```release-note
kubectl patch now respects --local
```
2018-08-16 09:03:06 -07:00
Morten Torkildsen 8e497274c9 Better error message when checking rollout status for StatefulSet with OnDelete strategy type 2018-08-15 21:39:14 -07:00
juanvallejo 4bdc636380
add updated plugin mechanism 2018-08-15 15:06:29 -04:00
juanvallejo df0077f362
prevent "No resources found" output on forbidden error 2018-08-15 13:54:23 -04:00
Kubernetes Submit Queue a8fbaf95f9
Merge pull request #67385 from nikhita/patch-no-op-msg
Automatic merge from submit-queue (batch tested with PRs 67347, 67307, 67358, 67364, 67385). 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: update message for a no-op patch

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

/cc liggitt juanvallejo soltysh timoreimann 
/sig cli

**Release note**:

```release-note
NONE
```
2018-08-15 04:23:24 -07:00
Kubernetes Submit Queue aad9f0536a
Merge pull request #67276 from seans3/kubectl-extract-2
Automatic merge from submit-queue (batch tested with PRs 67071, 66906, 66722, 67276, 67039). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Move dependency within kubernetes core to staging

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

This PR moves a dependency from with Kubernetes core (k8s.io/kubernetes/pkg/apis/core) to staging

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

Helps Fix: Remove Kubectl dependencies on kubernetes/pkg/api and kubernetes/pkg/apis

https://github.com/kubernetes/kubectl/issues/83

**Release note**:

```release-note
NONE
```
2018-08-14 22:43:25 -07:00
Kubernetes Submit Queue b6f0aed056
Merge pull request #66906 from tnozicka/rename-until
Automatic merge from submit-queue (batch tested with PRs 67071, 66906, 66722, 67276, 67039). 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>.

#50102 Task 1: Move apimachinery/pkg/watch.Until into client-go/tools/watch.UntilWithoutRetry

**What this PR does / why we need it**:
This is a split off from https://github.com/kubernetes/kubernetes/pull/50102 to go in smaller pieces.

Moves `apimachinery/pkg/watch.Until` into `client-go/tools/watch.UntilWithoutRetry` and adds context so it is cancelable.

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

**Dev release note**:
```dev-release-note
`apimachinery/pkg/watch.Until` has been moved to `client-go/tools/watch.UntilWithoutRetry`.
While switching please consider using the new `client-go/tools/watch.UntilWithSync` or `client-go/tools/watch.Until`.
```

/cc @smarterclayton @kubernetes/sig-api-machinery-pr-reviews 
/milestone v1.12
/priority important-soon
/kind bug
(bug after the main PR which is this split from)
2018-08-14 22:43:19 -07:00
David Eads 562209d632 update patch to work with --local and avoid extra requests 2018-08-14 15:53:47 -04:00
Nikhita Raghunath 3d33301332
kubectl: update message for a no-op patch 2018-08-14 18:42:27 +05:30
Mikalai Radchuk 89dd809ee3 Adds tests for --all-containers=true
Fixes regression in kubectl logs --all-containers=true
2018-08-13 08:23:10 +01:00
Sylvain Rabot 7e7b01fa31 Log real file's name and line
pkg/kubectl/util/logs & staging/src/k8s.io/apiserver/pkg/util/logs
use `glog.info(...)` but this function is not made to be wrapped because
the underlying mechanism use a fixed call trace length to determine
where the log has been emited.

This results is having `logs.go:49` in the logs which is in the body
of the wrapper function and thus useless.

Instead use `glog.infoDepth(1, ...)` which tells the underlying mechanism
to go back 1 more level in the call trace to determine where the log
has been emitted.

Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
2018-08-11 14:57:45 +02:00
Kubernetes Submit Queue 1574e0b958
Merge pull request #67274 from seans3/kubectl-extract-1
Automatic merge from submit-queue (batch tested with PRs 67274, 67285). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Move dependency from k/k/pkg/apis/core to staging

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

This PR moves a dependency from with Kubernetes core (k8s.io/kubernetes/pkg/apis/core) to staging

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

Helps Fix: Remove Kubectl dependencies on kubernetes/pkg/api and kubernetes/pkg/apis
https://github.com/kubernetes/kubectl/issues/83

**Release note**:

```release-note
NONE
```
2018-08-10 23:19:03 -07:00
Kubernetes Submit Queue 0e62573d60
Merge pull request #66602 from dixudx/kubectl_apply_force_invalid
Automatic merge from submit-queue (batch tested with PRs 66602, 67178, 67207, 67125, 66332). 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: recreating resources for immutable fields when force is applied

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

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

**Special notes for your reviewer**:
/assign soltysh juanvallejo
/cc @kubernetes/sig-cli-bugs 

**Release note**:

```release-note
kubectl: recreating resources for immutable fields when force is applied
```
2018-08-10 14:13:05 -07:00
Sean Sullivan d4e9233875 moved dependency within kubernetes core to staging 2018-08-10 13:45:17 -07:00
Sean Sullivan 083f0e3d72 Move dependency from k/k/pkg/apis/core to staging 2018-08-10 12:56:03 -07:00
Kubernetes Submit Queue df439192d7
Merge pull request #65420 from jsoref/issue-61739
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Remove --interactive flag from kubectl logs

fixes #61739

```release-note
Remove deprecated --interactive flag from kubectl logs.
```
2018-08-10 11:30:33 -07:00
Kubernetes Submit Queue 8174d841f8
Merge pull request #67219 from seans3/rbac-dependency
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>.

Move validation dependency from pkg/apis/core/validation to staging

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

Moves a dependency in metricsutil from `pkg/apis/core/validation` to the staging dependency.

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

Helps Fix: **Remove Kubectl dependencies on kubernetes/pkg/api and kubernetes/pkg/apis**
https://github.com/kubernetes/kubectl/issues/83

**Special notes for your reviewer**:

```release-note
NONE
```
2018-08-10 10:14:00 -07:00
Tomas Nozicka 4d7747a5a3 Update Bazel 2018-08-10 09:55:41 +02:00
Tomas Nozicka 3d4a02abb5 Rename Until to UntilWithoutRetry and move to using context so it's
cancelable
2018-08-10 09:55:41 +02:00
Sean Sullivan d91c82a30d Move validation dependency from pkg/apis/core/validation to staging 2018-08-09 15:52:59 -07:00
Kubernetes Submit Queue a0e5df4968
Merge pull request #67160 from seans3/rbac-dependency
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>.

Removes dependency on RBAC within kubernetes core

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

Removes an unneeded dependency. Kubectl should depend on repo "k8s.io/api/rbac"; not "k8s.io/kubernetes/pkg/apis/rbac"

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

https://github.com/kubernetes/kubectl/issues/91

```release-note
NONE
```
2018-08-09 15:06:15 -07:00
Kubernetes Submit Queue 31d19098eb
Merge pull request #66652 from charrywanganthony/clusterinfo_dump
Automatic merge from submit-queue (batch tested with PRs 66652, 67034). 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 cluster-info dump error

**Which issue(s) this PR fixes** :
Fixes #65221 

**Release note**:
```release-note
NONE
```
2018-08-09 10:03:06 -07:00
Kubernetes Submit Queue 636fc880da
Merge pull request #67179 from SneakyFish5/print-error
Automatic merge from submit-queue (batch tested with PRs 65297, 67179, 67116, 67011, 66842). 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 print error

**What this PR does / why we need it**:
Fixes a print error in convert.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-08-09 08:39:28 -07:00
Kubernetes Submit Queue 4b2408459e
Merge pull request #65297 from xlgao-zju/improve-kubectl-completion-help
Automatic merge from submit-queue (batch tested with PRs 65297, 67179, 67116, 67011, 66842). 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>.

improve kubectl completion help

**What this PR does / why we need it**:
Add note that 'bash-completion' is required on Linux too.

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

**Special notes for your reviewer**:
cc @neolit123

**Release note**:

```release-note
NONE
```
2018-08-09 08:39:25 -07:00
Di Xu 0af6faed09 kubectl: recreating resources for immutable fields when force is applied 2018-08-09 22:59:02 +08:00
Chao Wang 6ca446c5a0 fix cluster-info dump error 2018-08-09 19:43:55 +08:00
SneakyFish5 1fdb5d9722
Fix print error 2018-08-08 23:35:18 -05:00
Kenjiro Nakayama 9cb24c4680 `kubectl create {clusterrole,role}`'s `--resources` flag support asterisk to specify all resources 2018-08-09 08:40:12 +09:00
Sean Sullivan ff6113dfc8 Removes dependency on RBAC within kubernetes core 2018-08-08 13:58:35 -07:00
juanvallejo 0c4bb64304
expose default LogsForObject consumeRequest func 2018-08-06 16:23:18 -04:00
Kubernetes Submit Queue 554418735a
Merge pull request #66692 from m1kola/66456_waitcmd__error_for_selectors
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>.

Makes kubectl wait exit with status 1 and print an error message, if there is no resources matching selectors

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

It makes the `kubectl wait` command print an error message and exit with exit code 1, if there is no resource matching users's query. This can happen when user specifies selectors. Example:

```
kubectl wait deployment -l app=something-that-does-not-exist --for condition=available --timeout=5s
```

**Which issue(s) this PR fixes**:
Fixes #66456

**Special notes for your reviewer**:

This is my first contribution into the project (except one line change in docs) and don't have much experience with Go. I learned a lot while working on this (about resource finders and the `Visitor` interface and it's implementations), but it is very likely that I'm doing something wrong :)

I'm keen to continue contributing into the project (into the cli part for now), so I will really appreciate detailed feedback, if you have a chance to provide it (point me into a right direction and/or explain why it's not a good idea to do something in a certain way).

Thanks!

**Release note**:
```release-note
kubectl: the wait command now prints an error message and exits with the code 1, if there is no resources matching selectors
```
2018-08-06 10:31:57 -07:00
WanLinghao 5db028612d snip more legacy scheme uses we don't need
ref:https://github.com/kubernetes/kubernetes/pull/66926
2018-08-06 09:44:04 +08:00
David Eads 029b4388fe switching rolling update to external clients 2018-08-03 13:18:14 -04:00
Kubernetes Submit Queue dab04dc6e0
Merge pull request #66967 from deads2k/kubectl-09-naughty
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>.

stop adding internal types to external schemes

at some point someone starting internal types to external schemes in kubectl tests.  This fixes that mistake.

@kubernetes/sig-cli-maintainers 
/assign @soltysh 

```release-note
NONE
```
2018-08-03 10:07:47 -07:00
Kubernetes Submit Queue 8a5e9ecf8f
Merge pull request #66965 from deads2k/kubectl-08-internalfactoryclient
Automatic merge from submit-queue (batch tested with PRs 61389, 66817, 66903, 66675, 66965). 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 internal client factory method

remove final uses of the internal client factory method.  https://github.com/kubernetes/kubernetes/pull/66933 does the rolling updater, so this just snips it off and prevents anyone else from ever relying on it.

@kubernetes/sig-cli-maintainers 
/assign @soltysh 

```release-note
NONE
```
2018-08-03 07:33:21 -07:00
Kubernetes Submit Queue 43a46cc9b7
Merge pull request #66817 from charrywanganthony/version_c
Automatic merge from submit-queue (batch tested with PRs 61389, 66817, 66903, 66675, 66965). 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 deprecated shorthand flag

**Release note**:
```release-note
remove deprecated shorthand flag `-c` from `kubectl version (--client)`
```
2018-08-03 07:33:07 -07:00
David Eads 8a1eae451b stop adding internal types to external schemes 2018-08-03 09:47:04 -04:00
David Eads 8b20ee1d4e remove internal factory client 2018-08-03 07:47:05 -04:00
Kubernetes Submit Queue 6d0a86220f
Merge pull request #66926 from deads2k/kubectl-04-easy-scheme
Automatic merge from submit-queue (batch tested with PRs 62901, 66562, 66938, 66927, 66926). 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>.

 snip legacy scheme uses we don't need

the legacy scheme covers the kubectl scheme. This pull converts many of the "simple" ones we can clear. I also cleared out create entirely.

@kubernetes/sig-cli-maintainers 
/assign @soltysh @juanvallejo 

```release-note
NONE
```
2018-08-02 19:57:22 -07:00
Kubernetes Submit Queue cf986d2bbe
Merge pull request #66927 from deads2k/kubectl-05-client-go
Automatic merge from submit-queue (batch tested with PRs 62901, 66562, 66938, 66927, 66926). 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>.

snip links to internal clients

This is just an example of snipping links to the internal client from k/k.  There are four more direct links to the factory method to create the internal and order of a dozen imports.

@kubernetes/sig-cli-maintainers 
/assign @soltysh @juanvallejo 

```release-note
NONE
```
2018-08-02 19:57:18 -07:00
Kubernetes Submit Queue b904855601
Merge pull request #66870 from apelisse/dry-run-client
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>.

dry-run: Update DynamicClient to pass Create/Update options

Change dynamic client to accept Create and Update options on Create/Update/Patch methods.

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

**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-08-02 17:00:29 -07:00
Tiago M. Vieira 4cdcaa7f79
fix usage string for the kubectl logs command
Even though the use of an inline [CONTAINER] name is still accepted,
this does not match what the documentation or man page says. This commit
aligns the usage string that is displayed when the kubectl logs command
is called with more than one container name (with the use of flag or
not).
2018-08-02 15:18:29 -04:00
David Eads 7923a9fd99 snip links to internal clients 2018-08-02 14:53:22 -04:00
David Eads 937d45a809 remove legacy scheme from create 2018-08-02 14:49:31 -04:00
Kubernetes Submit Queue 03df9aa4af
Merge pull request #66907 from deads2k/kubectl-02-fwd
Automatic merge from submit-queue (batch tested with PRs 66235, 66908, 66907). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

switch kubectl portfoward to external types

switch the guts of portforward to external types.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-08-02 11:30:17 -07:00
Kubernetes Submit Queue ebc6a5d0e7
Merge pull request #66908 from deads2k/kubectl-01-history
Automatic merge from submit-queue (batch tested with PRs 66235, 66908, 66907). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

switch rollout history to external

low hanging fruit.  The underlying history viewer uses a live lookup with external clients already.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-08-02 11:30:13 -07:00
David Eads dd2af1c8a4 snip legacy scheme uses we don't need 2018-08-02 14:17:17 -04:00
Antoine Pelisse 71970d6475 dry-run: Update DynamicClient to pass Create/Update options 2018-08-02 10:38:31 -07:00
David Eads 59d5298314 switch expose to externals 2018-08-02 08:54:29 -04:00
David Eads 608bf0de1f update polymorphichelpers for external types 2018-08-02 08:54:29 -04:00
David Eads 8620b736cd switch kubectl portfoward to external types 2018-08-02 08:10:03 -04:00
David Eads 0661216d9a switch rollout history to external 2018-08-02 07:57:14 -04:00
Kubernetes Submit Queue 9c58985a25
Merge pull request #66519 from juanvallejo/jvallejo/switch-attch-externals
Automatic merge from submit-queue (batch tested with PRs 65730, 66615, 66684, 66519, 66510). 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 attach to use external objs

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

Updates attach command to use external versions.

cc @deads2k @soltysh
2018-08-01 15:52:16 -07:00
Kubernetes Submit Queue e322d1485d
Merge pull request #60316 from soltysh/create_job
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>.

Full blown kubectl create job

**What this PR does / why we need it**:
This is a followup to https://github.com/kubernetes/kubernetes/pull/60084 which adds full blown `create job` command

/assign @deads2k @juanvallejo 

**Release note**:

```release-note
Add kubectl create job command
```
2018-08-01 13:04:18 -07:00
juanvallejo 3a3633a32e
update logs 2018-08-01 10:44:44 -04:00
juanvallejo 9120557466
update attach to use external objs 2018-08-01 10:44:43 -04:00
Maciej Szulik 4ced88b162
Full blown kubectl create job 2018-08-01 15:04:04 +02:00
Kubernetes Submit Queue 007bf90e32
Merge pull request #66725 from juanvallejo/jvallejo/update-patch-return-code-logic
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>.

update exit code to 0 if patch not needed

**Release note**:
```release-note
The `kubectl patch` command no longer exits with exit code 1 when a redundant patch results in a no-op
```

The specific logic in the `patch` command that exited with code 1, was only doing so when there was no diff between an existing object and its patched counterpart. (In case of errors, we just return those, which eventually ends up exiting with code 1 anyway). This patch removes this block, as we should not be treating patch no-ops as errors.

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

cc @soltysh
2018-08-01 03:31:35 -07:00
Chao Wang caa8d7caed remove deprecated shorthand flag of client version 2018-08-01 09:54:54 +08:00
juanvallejo ad11a1b7a6
update exit code to 0 if patch not needed 2018-07-31 14:41:30 -04:00
Mikalai Radchuk d3445d71d0 Return an error if there is no resources matching
This makes `kubectl wait` print useful message when
there is no resources matching a query. Also it will now
exit with the exit status 1.
2018-07-31 18:15:24 +01:00
Kubernetes Submit Queue 2bee858a7b
Merge pull request #66284 from stewart-yu/stewart-sharedtype-move
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>.

Move the` k8s.io/kubernetes/pkg/util/pointer` package to` k8s.io/utils/pointer`

**What this PR does / why we need it**:
Move `k8s.io/kubernetes/pkg/util/pointer` to  `shared utils` directory, so that we can use it  easily.
Close #66010 accidentally, and can't reopen it, so the same as #66010 

**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-30 19:50:36 -07:00
Kubernetes Submit Queue ce227b06de
Merge pull request #66558 from quasoft/depr-pod-flag
Automatic merge from submit-queue (batch tested with PRs 66593, 66727, 66558). 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>.

Mark --pod/-p flag of kubectl exec command as deprecated

**What this PR does / why we need it**:
Marks the `--pod` (`-p` shorthand) flag of kubectl `exec` command as deprecated.
Hides the flag from the help menu, but shows a message when command is executed with this flag.

**Which issue this PR fixes**:
Fixes:  https://github.com/kubernetes/kubectl/issues/104

This is a remake of PR https://github.com/kubernetes/kubernetes/pull/54629.

**Release note**:
```release-note
Flag --pod (-p shorthand) of kubectl exec command marked as deprecated
```
2018-07-27 18:05:06 -07:00
stewart-yu f1343af5d7 auto-generated file 2018-07-28 07:54:17 +08:00
stewart-yu 649b46ff1d fix verify about import error 2018-07-28 07:54:16 +08:00
Kubernetes Submit Queue 1833aabcf2
Merge pull request #66225 from charrywanganthony/edit-o-json
Automatic merge from submit-queue (batch tested with PRs 66225, 66648, 65799, 66630, 66619). 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 error binding of edit output format

**What this PR does / why we need it**:
`kubectl edit xxx/xxx -o json` won't print result in json format
**Release note**:
```release-note
NONE
```
2018-07-27 16:42:05 -07:00
Kubernetes Submit Queue 1dd4f8d82f
Merge pull request #66554 from charrywanganthony/watch_json
Automatic merge from submit-queue (batch tested with PRs 66554, 66616, 66695, 66681). 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 the watch status when -o=yaml|json option is specfied

**Which issue(s) this PR fixes** : 
`kubectl get pods --watch -o json` only putput once and stop, this PR fix this.

**Release note**:
```release-note
NONE
```
2018-07-27 10:09:04 -07:00
Kubernetes Submit Queue 4d5d2664c3
Merge pull request #65542 from juanvallejo/jvallejo/cleanup-convert-cmd
Automatic merge from submit-queue (batch tested with PRs 66333, 65542). 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>.

cleanup / simplify convert command

Cleans up unnecessary pieces from the convert command, simplifyiing
command logic, and readability.

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

cc @soltysh @deads2k
2018-07-27 07:24:05 -07:00
hangaoshuai 6c94d7ae32 return err when Unmarshal failed 2018-07-27 20:52:00 +08:00
stewart-yu 55251c716a update the import file for move util/pointer to k8s.io/utils 2018-07-27 19:47:02 +08:00
QuaSoft 75804c35aa Remove warning for deprecated flag usage as pflag already does that 2018-07-24 15:59:44 +03:00
QuaSoft 888119a47c Mark exec --pod/-p flag as deprecated 2018-07-24 11:59:37 +03:00
Chao Wang e954f9706e fix the watch status when -o=yaml|json option is specfied 2018-07-24 16:37:47 +08:00
juanvallejo 94fbb48dfc
switch logs to use external versions 2018-07-23 14:40:16 -04:00
Kubernetes Submit Queue 35ff6ea207
Merge pull request #66398 from deads2k/cli-04-make-logs-generic-again
Automatic merge from submit-queue (batch tested with PRs 66410, 66398, 66061, 66397, 65558). 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 logs command to be generic for all resources again

--all-containers should not have been allowed as it was because it only worked for pods.  This approach does not make sense for a polymorphic command.  Rather than roll it back, I'll take the time to make it generic.  Because of this and other pods-only options, we now have inconsistencies with the command that should be addressed separately.

@CaoShuFeng 
/assign @juanvallejo @soltysh 
@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-07-20 18:51:05 -07:00
Kubernetes Submit Queue 6c500be080
Merge pull request #66218 from atlassian/handle-errors
Automatic merge from submit-queue (batch tested with PRs 66152, 66406, 66218, 66278, 65660). 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>.

Handle errors

**What this PR does / why we need it**:
This is a followup PR for https://github.com/kubernetes/kubernetes/pull/64664 to handle errors returned from `.AddToScheme()` in places where they are not handled.

**Release note**:
```release-note
NONE
```
/kind cleanup
/sig api-machinery
/cc @sttts
2018-07-20 12:12:15 -07:00
David Eads 5ba07364ee fix logs command to be generic for all resources again 2018-07-20 15:10:44 -04:00
Jordan Liggitt dc5f615152
Send correct headers for pod printing 2018-07-19 20:55:00 -04:00
Chao Wang 71299558c1 update testcase for edit 2018-07-18 15:41:38 +08:00
Mengqi Yu 60630eb38e add tests for polymorphichelpers pkg 2018-07-18 00:37:00 -07:00
W. Trevor King 0d81e838d7 kubectl: Drop typer from DrainOptions
The property was added in c6e9ad06 (Initial node drain implementation
for #3885, 2015-10-30, #16698), but beb5ea64 (remove mapper dependency
- PrintSuccess, 2018-02-01, #59227) removed the only initializer.
2018-07-17 10:10:47 -07:00
Mikhail Mazurskiy 5cab7f9a57
Handle errors 2018-07-17 20:47:14 +10:00
juanvallejo 5e79a25e0c
add support for "success" output for edit command
Adds support for the "success" printer in the "edit" command, while
ensuring outputFormat constraints for the in-editor printer.
2018-07-16 12:06:32 -04:00
WanLinghao 4db1cc03ba clean unused function 2018-07-16 15:16:32 +08:00
Chao Wang a87b82c0ad fix error binding of edit output format 2018-07-16 14:27:20 +08:00
Kubernetes Submit Queue 2a62949899
Merge pull request #64181 from stealthybox/kubecuttle_run_help_typo
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>.

Correct image in `kubectl help run`

**What this PR does / why we need it**:
Simple typo fix -- image for this hazelcast command example was transposed /w nginx

/sig cli
/area kubectl
/kind cleanup
/kind documentation

**Release note**:
```release-note
NONE
```
2018-07-13 17:46:55 -07:00
Kubernetes Submit Queue 43d30a143b
Merge pull request #66140 from liggitt/kubectl-current-context
Automatic merge from submit-queue (batch tested with PRs 66121, 66140, 66045). 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>.

Allow modifying current context with kubectl set-context

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

Enabled setting the namespace (or any other attribute) for the current context, rather than needing to provide a name:
```
kubectl config set-context --current --namespace=some-namespace
kubectl config set-context --current --cluster=some-cluster
kubectl config set-context --current --user=some-user
```

```release-note
`kubectl config set-context` can now set attributes of the current context, like the current namespace, by passing `--current` instead of a specific context name
```
2018-07-12 23:05:05 -07:00
Kubernetes Submit Queue 704b180ce6
Merge pull request #66121 from CaoShuFeng/csr_approve
Automatic merge from submit-queue (batch tested with PRs 66121, 66140, 66045). 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 csr status message for kubectl certificate deny

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

**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-12 23:05:01 -07:00
juanvallejo 4446a29440
cleanup / simplify convert command
Cleans up unnecessary pieces from the convert command, simplifyiing
command logic, and readability.
2018-07-12 18:12:37 -04:00
Jordan Liggitt fe53c618e8
Allow modifying current context with kubectl set-context 2018-07-12 17:19:01 -04:00
David Eads 9fe20cfd46 make delete waits match on UID 2018-07-12 14:48:13 -04:00
Cao Shufeng 259d39fade fix csr status message for kubectl certificate deny 2018-07-12 19:02:45 +08:00
Kubernetes Submit Queue 029213748a
Merge pull request #65908 from juanvallejo/jvallejo/switch-delete-strategy-background
Automatic merge from submit-queue (batch tested with PRs 64695, 65982, 65908). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

switch delete strategy to background deletion

**Release note**:
```release-note
"kubectl delete" no longer waits for dependent objects to be deleted when removing parent resources
```

### Before 1.11.0

- Resources that had client-side reapers in older versions of the client had all of their dependents deleted first. The parent resource itself was deleted *last*. This allowed the command to be re-entrant and was largely an artifact of it **having** to be done that way by a client-side reaper.

### After 1.11.0 (with this PR)

- Resources that previously had client-side reapers are no longer deleted last (after their dependents). They are now instead deleted first. The garbage-collector server-side then deletes any dependents.
- This means that the `delete` command can return, and the parent object can be deleted while child objects still exist.
  - This is okay because the child resources are eventually deleted by the garbage collector server-side. 

cc @liggitt @soltysh
2018-07-10 08:55:15 -07:00
David Eads fabe703756 re-make print flags composeable for sophisticated callers 2018-07-10 08:08:01 -04:00
Kubernetes Submit Queue aab517313c
Merge pull request #63793 from hzxuzhonghu/kubectl-proxy-keepalive
Automatic merge from submit-queue (batch tested with PRs 63793, 65989). 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>.

Enable kubectl proxy to set tcp keepalive

**What this PR does / why we need it**:
Allows setting keepalive period for kubectl proxy.

Fixes #63727

**Special notes for your reviewer**:

/assign @brendandburns

**Release note**:

```release-note
Introduce a new flag `--keepalive` for kubectl proxy to allow setting keep-alive period for long-running request.
```
2018-07-10 02:46:01 -07:00
Kubernetes Submit Queue 24ee75e265
Merge pull request #65880 from juanvallejo/jvallejo/fix-template-printer-rollout-cmds
Automatic merge from submit-queue (batch tested with PRs 64226, 65880). 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>.

wire PrintFlags through rollout commands

Binds PrintFlags to rollout commands.
Adds tests ensuring --template printing is supported by rollout cmds.

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

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

cc @soltysh @deads2k
2018-07-09 12:16:06 -07:00
juanvallejo ebd48f26e5
switch delete strategy to background deletion 2018-07-09 13:34:00 -04:00
Kubernetes Submit Queue e049c458ed
Merge pull request #65836 from grampajoe/extra-character
Automatic merge from submit-queue (batch tested with PRs 64664, 65836, 65917). 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: Remove an extra character from rollout error message

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

Removes an extra character in a `kubectl rollout status` error message.

**Special notes for your reviewer**:

I thought this would be a good first contribution!

**Release note**:

```release-note
NONE
```
2018-07-09 08:07:00 -07:00
juanvallejo 2b0b605c80
wire PrintFlags through rollout commands
Binds PrintFlags to rollout commands.
Adds tests ensuring --template printing is supported by rollout cmds.
2018-07-06 17:32:42 -04:00
Kubernetes Submit Queue b6c52143be
Merge pull request #65838 from WanLinghao/clusterinfo_fix
Automatic merge from submit-queue (batch tested with PRs 65838, 65837). 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 cluster-info bug

**What this PR does / why we need it**:
   When api-server is not avaiable,` kubectl cluster-info `still prints information like: the cluster is running at ...
    This patch fixes this bug

**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: #65817 

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-06 11:03:01 -07:00
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
WanLinghao 9407e2bb43 When api-server is not avaiable, kubectl cluster-info still prints information like: the cluster is running at ...
This patch fixes this bug
2018-07-05 10:45:32 +08: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
Joe Friedl 74eaa3b2bc kubectl: Remove an extra character from rollout error message 2018-07-04 14:24:14 -04: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
xuzhonghu 204d994aca Enable kubectl proxy to set tcp keepalive 2018-06-25 11:03:05 +08:00
Josh Soref e272e273b0 Remove deprecated interactive flag
fixes #61739
2018-06-24 18:44: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
WanLinghao f243663519 fix a log param error 2018-06-21 15:31:19 +08:00
Xianglin Gao 7398219549 improve kubectl completion help
Signed-off-by: Xianglin Gao <xianglin.gxl@alibaba-inc.com>
2018-06-21 14:42:33 +08:00
Kubernetes Submit Queue 7720c40cb9
Merge pull request #64773 from MasayaAoyama/add-port-foward-examples
Automatic merge from submit-queue (batch tested with PRs 58690, 64773, 64880, 64915, 64831). 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 port-forward examples for sevice

add port-forward examples for sevice

```
$  kubectl port-forward --help

........
Examples:
  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in the pod
  kubectl port-forward pod/mypod 5000 6000

  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the
deployment
  kubectl port-forward deployment/mydeployment 5000 6000

  # Listen on ports 5000 and 6000 locally, forwarding data to/from ports 5000 and 6000 in a pod selected by the
service
  kubectl port-forward service/myservice 5000 6000

  # Listen on port 8888 locally, forwarding to 5000 in the pod
  kubectl port-forward pod/mypod 8888:5000

  # Listen on a random port locally, forwarding to 5000 in the pod
  kubectl port-forward pod/mypod :5000
........
```



**What this PR does / why we need it**:
add port-forward examples for sevice

**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
add port-forward examples for sevice
```
2018-06-20 14:21:14 -07:00
Kubernetes Submit Queue debc5387fe
Merge pull request #63747 from wgliang/master.test.kubectl
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>.

use subtest for table units (pkg/kubectl)

**What this PR does / why we need it**:
Go 1.7 added the subtest feature which can make table-driven tests much easier to run and debug. Many table-driven tests in pkg/kubectl are not using this feature.

/kind cleanup
/area kubectl

Further reading: [Using Subtests and Sub-benchmarks](https://blog.golang.org/subtests)


**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-06-20 12:39:21 -07:00
Kubernetes Submit Queue 8a1e83050d
Merge pull request #64389 from yue9944882/top-nodes-print-missing-metrics
Automatic merge from submit-queue (batch tested with PRs 64882, 64692, 64389, 60626, 64840). 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>.

print nodes for those metrics is somehow unreachable

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

When we use `kubectl top nodes`, some nodes will be ignored when their metrics cannot be fetched from metrics serve. It might be misleading for users.

This PR helps print the missing nodes like:

```
NAME                CPU(cores)   CPU%      MEMORY(bytes)   MEMORY%  
missing-nodes       -            -         -               -
```

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Fixes missing nodes lines when kubectl top nodes
```
2018-06-20 10:03:27 -07:00
Kubernetes Submit Queue d9272f8cba
Merge pull request #56358 from liggitt/rbac-alternate-authorizer
Automatic merge from submit-queue (batch tested with PRs 64688, 64451, 64504, 64506, 56358). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Switch RBAC escalation check to use active authorizer

Closes #43409

```release-note
All configured authorizers are now checked to determine if an RBAC role or clusterrole escalation (setting permissions the user does not currently have via RBAC) is allowed.
```
2018-06-20 05:48:23 -07:00
Kubernetes Submit Queue 2fa32e717b
Merge pull request #64504 from wgliang/master.fix-format
Automatic merge from submit-queue (batch tested with PRs 64688, 64451, 64504, 64506, 56358). 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>.

Errorf format %q has arg b.labelSelector of wrong type *string

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

Errorf format %q has arg b.labelSelector of wrong type *string

**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-06-20 05:48:15 -07:00
Kubernetes Submit Queue 5e31112d69
Merge pull request #64541 from mrogers950/additive-flag
Automatic merge from submit-queue (batch tested with PRs 63580, 63744, 64541, 64502, 64100). 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 more kubectl auth reconcile flags

```release-note
The --remove-extra-subjects and --remove-extra-permissions flags have been enabled for kubectl auth reconcile
```
/assign @deads2k 
cc @enj @juanvallejo
2018-06-20 01:27:36 -07:00
Kubernetes Submit Queue e1cc1fce2a
Merge pull request #64378 from wrdls/evict-timeout
Automatic merge from submit-queue (batch tested with PRs 64252, 64307, 64163, 64378, 64179). 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 drain --timeout option when eviction is used

**What this PR does / why we need it**:
Timeout option of kubectl drain command is currently broken when using eviction to delete pods.

A new timer is made on each for loop iteration which means it gets reset each time a pod is evicted.

**Release note**:
```release-note
Fix kubectl drain --timeout option when eviction is used.
```

@kubernetes/sig-cli-pr-reviews
2018-06-19 21:45:17 -07:00
Kubernetes Submit Queue c46a667fac
Merge pull request #63698 from rajatjindal/fix-eviction-errormsg
Automatic merge from submit-queue (batch tested with PRs 65230, 57355, 59174, 63698, 63659). 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 msg when getting toomanyrequest error from evict pod

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

When Pod Disruption Budget prevents eviction of pods, the error msg is not exposed to the user

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

Fixes https://github.com/kubernetes/kops/issues/5066

**Special notes for your reviewer**:

Multiple people reported hung cluster update due to this issue, its confusing for them as the error msg is not exposed. 

**Release note**:

```release-note
NONE
```
2018-06-19 20:19:21 -07:00
Brendan Burns e3d2242388 Detect a missing key error and print a cleaner message. 2018-06-14 21:52:51 -07:00
Kubernetes Submit Queue b05a61e299
Merge pull request #65030 from deads2k/cli-74-experimental
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>.

mark kubectl wait as experimental

Per @smarterclayton comment in https://github.com/kubernetes/kubernetes/pull/64034

/assign @smarterclayton
2018-06-12 16:12:52 -07:00
David Eads 4a180331a9 mark kubectl wait as experimental 2018-06-12 15:51:43 -04:00
Kubernetes Submit Queue 7e41ab4ed3
Merge pull request #64768 from krzysied/scale_retries
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>.

Adding scale error retries

**What this PR does / why we need it**:
ScaleWithRetries will retry all retryable errors, not only conflict error.
ref #63030

**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**:

**Release note**:

```release-note
NONE
```
2018-06-12 09:31:46 -07:00
ruicao 95c232ee07 Typo fix: toto -> to 2018-06-12 23:12:39 +08:00
Krzysztof Siedlecki 8a3c2dcc6d Adding scale error retries 2018-06-12 11:23:16 +02:00
Brendan Burns 84dd19eb23 Remove an old TODO. 2018-06-11 13:04:32 -07:00
Rajat Jindal 08b92fff03 add msg when getting toomanyrequest error from evict pod 2018-06-08 07:01:14 -07:00
Jordan Liggitt 1034efd439
Allow non-RBAC authorizers to participate in role/clusterrole escalation checks 2018-06-06 15:31:05 -04:00
Janet Kuo 710d524b98 Add TODO for removing kubectl DaemonSet deletion hack 2018-06-06 11:11:35 -07:00
Janet Kuo fedd5d6206 Revert "Remove hack in kubectl delete that handles DaemonSet deletion"
This reverts commit 10a12ddb34.
2018-06-06 11:01:35 -07:00
Kubernetes Submit Queue 296bc64924
Merge pull request #64797 from janetkuo/ds-deletion
Automatic merge from submit-queue (batch tested with PRs 64749, 64797). 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>.

Handle deleted DaemonSet properly

**What this PR does / why we need it**:
After kubectl reapers are removed (#63979) and foreground deletion are used, DaemonSet controller may race with garbage collector when it tries to update DaemonSet status of the DaemonSet being deleted. 

Here's what happened:
1. Someone/something performs a foreground deletion on a DaemonSet
1. DaemonSet finalizer and DeletionTimestamp are both set
1. DaemonSet history objects (ControllerRevisions) and pods are being deleted by garbage collector; meanwhile, DaemonSet controller tries to update DaemonSet status. 
    * Updating DaemonSet status requires constructing DaemonSet history objects, to figure out current revision and which pods do/don't belong to current revision
1. When updating DaemonSet status, DaemonSet controller tries to create a DaemonSet history object that matches current DaemonSet spec
1. Garbage collector then tries to delete that DaemonSet history object. And repeat. 

Because we can't make DaemonSet pods be deleted before DaemonSet history objects (DaemonSet history objects don't own DaemonSet pods!), we cannot reliably calculate DaemonSet status without history objects anyways. Therefore, we don't update DaemonSet status for DaemonSet being deleted. 

Note that the reason why the kubectl delete hack works is because it forces DaemonSet pods to be removed before history objects. 

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-06 10:08:16 -07:00