Commit Graph

3159 Commits (284e8182a402cfd545fc000fedaea071fed873b0)

Author SHA1 Message Date
Di Xu a08cb5b531 include file name in the error when visiting files 2018-03-09 10:19:20 +08:00
fisherxu b49ef6531c regenerated all files and remove all YEAR fields 2018-03-08 17:52:48 +08:00
Di Xu 9555debc82 flag value bindings for kubectl apply commands 2018-03-08 10:32:59 +08:00
Kubernetes Submit Queue 3511f708cb
Merge pull request #60630 from CaoShuFeng/scale_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>.

remove "scale job" from help info

Remove "scale job" from help info since it's deprecated



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

/assign @deads2k @soltysh
2018-03-06 07:35:44 -08:00
Kubernetes Submit Queue 6608a47c84
Merge pull request #60572 from charrywanganthony/show-all_descr
Automatic merge from submit-queue (batch tested with PRs 60362, 60629, 60572). 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 get description

ref: #60210

/assign @deads2k 

**Release note**:

```release-note
NONE
```
2018-03-01 07:42:54 -08:00
Cao Shufeng 8be9d275b6 remove "scale job" from help info
Remove "scale job" from help info since it's deprecated
2018-03-01 17:00:05 +08:00
Cao Shufeng f0cd1ad04e fix warning info format
Before this change:
```
$ kubectl exec -p nginx-aaaaaaaaaaaaa-67b58bf687-r68b9 ls
-p POD_NAME is DEPRECATED and will be removed in a future version. Use exec POD_NAME instead.bin
boot
dev
...

$ kubectl scale --replicas=2 job/pi
kubectl scale job is DEPRECATED and will be removed in a future version.job.batch "pi" scaled
```

After this change:
```
$ kubectl exec -p nginx-aaaaaaaaaaaaa-67b58bf687-r68b9 ls
-p POD_NAME is DEPRECATED and will be removed in a future version. Use exec POD_NAME instead.
bin
boot
dev
...

$ kubectl scale --replicas=2 job/pi
kubectl scale job is DEPRECATED and will be removed in a future version.
job.batch "pi" scaled
```
2018-03-01 16:39:31 +08:00
WanLinghao 7489189c2a supplement for the fix of issue:
https://github.com/kubernetes/kubernetes/issues/60366

	modified:   pkg/kubectl/cmd/describe.go
2018-03-01 16:10:04 +08:00
Chao Wang d6328da987 improve get description 2018-03-01 09:16:24 +08:00
Ben Drucker aa139f1654 remove docker-email from required args for "create secret docker-registry" 2018-02-28 17:03:35 -08:00
Kubernetes Submit Queue 98eb5cbd04
Merge pull request #56075 from shyamjvs/move-rc-scaling-to-polling
Automatic merge from submit-queue (batch tested with PRs 60470, 59149, 56075, 60280, 60504). 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 Scale() for RC poll-based until #31345 is fixed

Fixes https://github.com/kubernetes/kubernetes/issues/56064
,in the short-term until issue #31345 is fixed.
We should eventually move RS, job, deployment, etc all to watch-based (https://github.com/kubernetes/kubernetes/issues/56071)

/cc @wojtek-t - SGTY?

```release-note
NONE
```
2018-02-28 04:54:32 -08:00
Di Xu abb602b279 flag value bindings for kubectl attach/convert/delete/drain/edit/exec commands 2018-02-28 15:21:39 +08:00
Kubernetes Submit Queue d9da83a022
Merge pull request #60355 from CaoShuFeng/cli_example
Automatic merge from submit-queue (batch tested with PRs 60430, 60115, 58052, 60355, 60116). 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 cli example

ref: https://github.com/kubernetes/kubernetes/pull/60210

/assign @deads2k 

**Release note**:

```release-note
NONE
```
2018-02-27 09:38:47 -08:00
Shyam Jeedigunta fd2ea3ff31 Make Scale() for RC poll-based until #31345 is fixed 2018-02-27 13:10:38 +01:00
Kubernetes Submit Queue 1eb1c00c44
Merge pull request #59674 from jennybuckley/codegen
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>.

code-gen: output golint compliant 'Generated by' comment

New PR instead of reopening #58115 because /reopen did not work.
This won't be ready to merge until the upstream https://github.com/kubernetes/gengo/pull/94 merges. Once that merges, the second commit will be changed to godep-save.sh and update-staging-godeps.sh, and the last commit will be changed to update-all.sh

The failing test is due to the upstream changes not being merged yet

```devel-release-note
Go code generated by the code generators will now have a comment which allows them to be easily identified by golint
```

Fixes #56489
2018-02-27 02:47:05 -08:00
Kubernetes Submit Queue 56ce616e5b
Merge pull request #60364 from dixudx/kubectl_common_flags_bind
Automatic merge from submit-queue (batch tested with PRs 60427, 60361, 60364, 58625, 60187). 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: flag value bindings for common utils

**What this PR does / why we need it**:
/kind cleanup
/sig cli

xxxOptions did not get bound as default value for some flags.
This PR cleans those flag bindings in common utils library.

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

**Special notes for your reviewer**:
/assign @deads2k 
**Release note**:

```release-note
None
```
2018-02-27 01:34:26 -08:00
Kubernetes Submit Queue 38b61e2914
Merge pull request #60361 from dixudx/kubectl_l2v_flags_bind
Automatic merge from submit-queue (batch tested with PRs 60427, 60361, 60364, 58625, 60187). 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>.

flag value bindings for kubectl label/patch/taint/top commands

**What this PR does / why we need it**:
/kind cleanup
/sig cli

xxxOptions did not get bound as default value for some flags.
This PR cleans those flag bindings for `kubectl label/patch/taint/top` commands.

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

**Special notes for your reviewer**:
/assign @deads2k
**Release note**:

```release-note
None
```
2018-02-27 01:34:22 -08:00
Di Xu 33b3fb9bed flag value bindings for kubectl create/get/set commands 2018-02-27 11:00:55 +08:00
jennybuckley c8dacd8e63 Run hack/update-all.sh 2018-02-26 17:16:14 -08:00
Manuel de Brito Fontes 02370e529b
Remove cassandra example 2018-02-26 20:39:07 -03:00
David Hao b112d19b70 Do not log unchanged message if a format other than 'name' is specified 2018-02-26 18:34:40 -05:00
David Eads f9a884d3f5 adjust filtered object test to reflect old weird behavior 2018-02-26 08:08:47 -05:00
Di Xu d1725fc683 kubectl: flag value bindings for common utils 2018-02-24 17:31:02 +08:00
Di Xu cda7f95d46 flag value bindings for kubectl label/patch/taint/top commands 2018-02-24 16:37:19 +08:00
Cao Shufeng 085e8bf6c4 fix cli example 2018-02-24 14:52:49 +08:00
WanLinghao 6eee5dd421 clean testprinter after commit:
https://github.com/kubernetes/kubernetes/pull/60117

	modified:   pkg/kubectl/cmd/cmd_test.go
	modified:   pkg/kubectl/cmd/resource/get_test.go
2018-02-24 13:41:42 +08:00
Kubernetes Submit Queue f7c65005a4
Merge pull request #59042 from soltysh/issue25442
Automatic merge from submit-queue (batch tested with PRs 60302, 57921, 59042, 60126, 59561). 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 pkg/client/unversioned

**What this PR does / why we need it**:
This is removing unused package, and moves the used bits into appropriate placeholders. 

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

**Special notes for your reviewer**:

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

/assign @deads2k 
/assign @sttts
2018-02-23 14:01:44 -08:00
David Eads a0cb7a7940 Revert "Allow env to be updated via specific key in resource"
This reverts commit 905a0698fa.
2018-02-23 13:31:42 -05:00
Kubernetes Submit Queue 890bd2174c
Merge pull request #60210 from deads2k/cli-12-showall
Automatic merge from submit-queue (batch tested with PRs 55637, 57461, 60268, 60290, 60210). 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>.

deprecate --show-all

`--show-all` is a pod-only filter that only affects human-readable printing of pods and only from `kubectl get`.  It hides pods which are in a terminal state.  Even at the beginning this was questionable, since you often (usually?) want to see the pods that have failed: all happy pods are alike, but every unhappy pod is unhappy in its own way.  In addition, it only worked on human-readable printers.  Doing a `-o name` or `-o yaml` showed a different set of results!

Per the mailing list discussion here: https://groups.google.com/forum/#!topic/kubernetes-sig-cli/0SxgDxObxD0

```release-note
`--show-all` (which only affected pods and only for human readable/non-API printers) is now defaulted to true and deprecated.  It will be inert in 1.11 and removed in a future release.
```

/assign @adohe 
/assign @pwittrock 
/assign @soltysh 

@kubernetes/sig-cli-maintainers
2018-02-23 09:49:48 -08:00
juanvallejo 9946374f82
handle Table response in client
This patch adds support for the "server-side GET operation"
introduced by pull/40848 and proposed by kubernetes/community#363.
2018-02-23 10:41:04 -05:00
David Eads 6047ead2e5 simplify kubectl testing factory 2018-02-23 08:02:53 -05:00
Kubernetes Submit Queue d4acd6b997
Merge pull request #58283 from nikhita/kubectl-scale-unstructured
Automatic merge from submit-queue (batch tested with PRs 59463, 59719, 60181, 58283, 59966). 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 scale: support Unstructured objects

Support `Unstructured` objects with kubectl scale.

So that we can use the scale subresource for custom resources (possible after https://github.com/kubernetes/kubernetes/pull/55168 is merged):

```
➜ cluster/kubectl.sh scale --replicas=5 crontabs/my-new-cron-object
crontab "my-new-cron-object" scaled
```

**Release note**:

```release-note
NONE
```

/cc sttts deads2k p0lyn0mial
2018-02-23 00:34:30 -08:00
Kubernetes Submit Queue 32fbec0ca4
Merge pull request #60084 from soltysh/create_job
Automatic merge from submit-queue (batch tested with PRs 60208, 60084, 60183, 59713, 60096). 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 create job

**What this PR does / why we need it**:
This add `kubectl create job` command, and is a followup to #60039. 

**Special notes for your reviewer**:

**Release note**:
```release-note
Add kubectl create job command
```
2018-02-22 23:17:32 -08:00
Kubernetes Submit Queue 4f083dee54
Merge pull request #60208 from soltysh/remove_factory_metricsclient_method
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 factory metricsclient method

**What this PR does / why we need it**:
Alternative approach to https://github.com/kubernetes/kubernetes/pull/60142 which fixed the `NewCmdTopPod` return arguments

/assign @deads2k 

**Release note**:
```release-note
None
```
2018-02-22 22:45:58 -08:00
Kubernetes Submit Queue bd5b46a4f2
Merge pull request #60204 from soltysh/remove_factory_client_methods
Automatic merge from submit-queue (batch tested with PRs 60214, 58762, 59898, 59897, 60204). 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 ClientSetForVersion & ClientConfigForVersion from factory

**What this PR does / why we need it**:
This is further cleaning the factory.

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

**Release note**:
```release-note
NONE
```
2018-02-22 22:02:43 -08:00
Maciej Szulik 999273fbd7
Remove ClientSetForVersion & ClientConfigForVersion from factory 2018-02-22 15:50:27 +01:00
Kubernetes Submit Queue c85ede510b
Merge pull request #60040 from PhilipGough/keys-from-cm
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>.

Allow env to be updated via specific key in resource

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

This change allows users of the `oc` client to specify a list of comma-separated keys when running `oc set env` which should be imported from a resource i.e configmap or secret

This can be useful when a number of applications want to share a configuration object but don't want to pollute a resource with unused environment 



**Release note**:

```release-note
Allow kubectl env to specify which keys to import from a config map
```
2018-02-22 06:08:55 -08:00
Maciej Szulik 4d7d153a12
Remove unnecessary return parameter from NewCmdTopPod 2018-02-22 14:33:14 +01:00
Maciej Szulik 8bf4cfcf60
Add kubectl create job --from=cronjob/<name> 2018-02-22 14:30:37 +01:00
Edmund Rhudy 5b57c2db00
Fixes #47538: Add functionality for manually creating a Job instance from a CronJob
This changeset adds the command `kubectl create job` with the flag `--from-cronjob`, which allows a user to create a Job from a CronJob via the CLI.
2018-02-22 14:30:37 +01:00
David Eads c9cb705816 deprecate --show-all 2018-02-22 08:19:12 -05:00
David Eads f084311326 remove metrics client factory method 2018-02-22 07:45:04 -05:00
PhilipGough 905a0698fa
Allow env to be updated via specific key in resource 2018-02-22 11:00:55 +00:00
Kubernetes Submit Queue 39c7e9242b
Merge pull request #60139 from soltysh/deprecate_scale_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>.

Deprecate kubectl scale job

**What this PR does / why we need it**:
With the generic scaler (https://github.com/kubernetes/kubernetes/pull/58298) the only problem is job and as discussed in https://github.com/kubernetes/kubernetes/pull/58468#issuecomment-360794229 and during SIG CLI we've agreed that scaling jobs was a mistake we need to revert. 
This PR deprecates scale command for jobs, only. 

/assign @deads2k @pwittrock 

**Release note**:
```release-note
Deprecate kubectl scale jobs (only jobs). 
```
2018-02-22 01:29:30 -08:00
Kubernetes Submit Queue 7d64d30177
Merge pull request #60094 from juanvallejo/jvallejo/remove-printobjectspecificmessage
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 f.PrintObjectSpecificMessage

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

Mailing list discussion: https://groups.google.com/forum/#!topic/kubernetes-sig-cli/gZWg8Ulo3Ao

Removes the `PrintObjectSpecificMessage` helper in an effort to reduce printing stack complexity, and avoid special-casing resources.
2018-02-22 00:35:21 -08:00
juanvallejo e3d81517ae remove f.PrintObjectSpecificMessage 2018-02-21 21:06:49 -05:00
Maciej Szulik 2935fd69e9
Change printDeprecationWarning to use fmt.Fprintf instead of glog 2018-02-21 22:38:39 +01:00
Maciej Szulik 0bf2561898
Deprecate kubectl scale job 2018-02-21 22:31:15 +01:00
David Eads d8a5420b7c remove unneeded factory codec methods 2018-02-21 15:20:20 -05:00
David Eads be04e7c1b1 collapse printing paths 2018-02-21 08:15:22 -05:00
Maciej Szulik 5d721bff81
Remove pkg/client/unversioned 2018-02-21 13:08:11 +01:00
Kubernetes Submit Queue 370540f90d
Merge pull request #60057 from deads2k/cli-07-printer
Automatic merge from submit-queue (batch tested with PRs 59391, 58097, 60057, 60090). 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 printers some more

This cleans up some more dead printer flags and unnecessary arguments for various methods.  We're getting closer.  Still need to clean up some ugly around `PrintSuccess` and then its time to start trimming layers.

@kubernetes/sig-cli-maintainers 

```release-note
NONE
```
2018-02-20 13:51:35 -08:00
David Eads dd6405681f cleanup printers some more 2018-02-20 12:59:40 -05:00
Jeff Grafton ef56a8d6bb Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
Kubernetes Submit Queue 01ec7a9eb8
Merge pull request #59809 from phsiao/59733_port_forward_with_target_port
Automatic merge from submit-queue (batch tested with PRs 59809, 59955). 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 port-forward should resolve service port to target port

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

Continues on the work in #59705, this PR adds additional support for looking up targetPort for a service, as well as enable using svc/name to select a pod.

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

**Special notes for your reviewer**:

I decided to create pkg/kubectl/util/service_port.go to contain two functions that might be re-usable.

**Release note**:
```release-note
`kubectl port-forward` now supports specifying a service to port forward to: `kubectl port-forward svc/myservice 8443:443`
```
2018-02-15 22:42:30 -08:00
Kubernetes Submit Queue bb500a73b6
Merge pull request #59353 from juanvallejo/jvallejo/update-name-printer-output
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 name printer output to kind.group/name

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

Followup to https://github.com/kubernetes/kubernetes/pull/59227

Updates output via `-o name` to be pipeable.

cc @deads2k
2018-02-15 10:37:19 -08:00
juanvallejo 765f9ec68b
update -o name format to kind.group/name 2018-02-15 10:33:06 -05:00
Shawn Hsiao 4a0bbf2363 kubectl port-forward support resolving service port to target port, and support Service as resource type 2018-02-14 12:02:57 -05:00
Shawn Hsiao 139c62c3e9 kubectl port-forward allows using resource name to select a matching pod 2018-02-13 12:10:02 -05:00
Kubernetes Submit Queue 198a098d9d
Merge pull request #59506 from juanvallejo/jvallejo/handle-watch-multiple-reqs
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 --watch on multiple requests

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

`kubectl get <resource> --watch` only supports watching a single resource kind at a time.
This check fails if more than one resource `Info` is returned.

When dealing with large quantities of a single resource kind, or an amount that exceeds the value of `--chunk-size`, more than one request is made to the server causing a resource `Info` to be created for each of the requests, ultimately causing the above check to fail even though we are dealing with the same type of resource.

This patch modifies that check to take into account the GVKs of all infos returned, and only fail if at least one differs.

cc @deads2k
2018-02-12 02:25:45 -08:00
Kubernetes Submit Queue 317853c90c
Merge pull request #59464 from dixudx/fix_all_typos
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 all the typos across the project

**What this PR does / why we need it**:
There are lots of typos across the project. We should avoid small PRs on fixing those annoying typos, which is time-consuming and low efficient.

This PR does fix all the typos across the project currently. And with #59463, typos could be avoided when a new PR gets merged.

**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**:
/sig testing
/area test-infra
/sig release
/cc @ixdy 
/assign @fejta 

**Release note**:

```release-note
None
```
2018-02-10 22:12:45 -08:00
Di Xu 48388fec7e fix all the typos across the project 2018-02-11 11:04:14 +08:00
juanvallejo aea8deee03
fix --watch on multiple requests 2018-02-09 15:17:02 -05:00
zhengjiajin 6dfe3cb04f add more error logs in kubectl run 2018-02-08 19:37:47 +08:00
Kubernetes Submit Queue 1f6251444b
Merge pull request #51042 from soltysh/request_timeout
Automatic merge from submit-queue (batch tested with PRs 59276, 51042, 58973, 59377, 59472). 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 passing request-timeout from NewRequest all the way down

**What this PR does / why we need it**:
Currently if you pass `--request-timeout` it's not passed all the way down to the actual request object. There's a separate field on the `Request` object that allows setting that timeout, but it's not taken from that flag. 

@smarterclayton @deads2k ptal, this is coming from https://github.com/openshift/origin/pull/13701
2018-02-07 12:00:44 -08:00
Kubernetes Submit Queue 15dbd4e2ae
Merge pull request #59227 from juanvallejo/jvallejo/remove-mapper-dep-printer
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 mapper dependency for cmdutil.Factory#PrintSuccess

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

Part of a series of patches removing printing stack dependency on mappings the rest mapper

**Before**
```
$ kubectl label pod/my-pod label=label
pod "my-pod" labeled
```

**After**
```
$ kubectl label pod/my-pod label=label
pods "my-pod" labeled
```

cc @deads2k
2018-02-07 08:39:15 -08:00
juanvallejo beb5ea641a
remove mapper dependency - PrintSuccess 2018-02-07 10:10:45 -05:00
Maciej Szulik 7da1002091 Allow passing request-timeout from NewRequest all the way down to actual request 2018-02-07 16:02:26 +01:00
bin liu f679fc1827 Remove duplicated comment 2018-02-07 16:48:22 +08:00
Kubernetes Submit Queue 313f443015
Merge pull request #58991 from juanvallejo/jvallejo/fix-apply-force
Automatic merge from submit-queue (batch tested with PRs 51323, 59306, 58991, 59050). 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 apply --force w/ invalid resource

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

- First commit: Fixes cases where `--force` is provided with `kubectl apply`, with an object that is BOTH invalid and will cause a conflict error
- Second commit: Fixes cases where `--force` is provided with `kubectl apply`, with an invalid object 

Justification for the first commit here: https://bugzilla.redhat.com/show_bug.cgi?id=1539529#c3

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

cc @ironcladlou
2018-02-06 10:40:37 -08:00
Kubernetes Submit Queue 989e4f868b
Merge pull request #51323 from dixudx/conflict_flags
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>.

kubectl should return an error if "-l" and "--all" are both specified

**What this PR does / why we need it**:
Per discussion in [#50497](https://github.com/kubernetes/kubernetes/pull/50497#discussion_r134881507)

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

**Special notes for your reviewer**:
/assign @caesarxuchao @mengqiy 

**Release note**:

```release-note
kubectl should return an error if "-l" and "--all" are both specified
```
2018-02-06 10:00:47 -08:00
juanvallejo ef0e40d39c
fix apply --force w/ invalid AND conflicting resource 2018-02-06 11:29:00 -05:00
Di Xu e45117856e kubectl: cannot set --all and --selector at the same time 2018-02-06 23:55:36 +08:00
Kubernetes Submit Queue 3021aa224c
Merge pull request #55516 from zjj2wry/config-unset
Automatic merge from submit-queue (batch tested with PRs 59158, 38320, 59059, 55516, 59357). 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 example for kubectl config unset, this will help user use

**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-02-05 12:40:40 -08:00
Kubernetes Submit Queue 5320cdeedd
Merge pull request #58533 from juanvallejo/jvallejo/usability-add-kubectl-describe-suggestion
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>.

suggest using describe cmd to list pod containers

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

Usability: suggest using `kubectl describe` to obtain available pod containers when running `kubectl attach ...`

cc @soltysh
2018-02-05 07:27:43 -08:00
zhengjiajin 46f760e8d0 add example for kubectl config unset, this will help user use 2018-02-05 20:33:49 +08:00
juanvallejo 6a79239944
suggest using describe cmd to list pod containers 2018-02-01 15:33:51 -05:00
Juan Vallejo 4026356b1c
Revert "fail earlier on discovery failures" 2018-02-01 13:02:10 -05:00
Kubernetes Submit Queue 8e666feac2
Merge pull request #57322 from niuzhenguo/dry-run-flag-cleanup
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Use GetDryRunFlag to keep consistent

**What this PR does / why we need it**:
There's a cmd util GetDryRunFlag, but we still get 'dry-run' directly somewhere. This PR makes them consistent.

**Release note**:

```release-note
NONE
```
2018-01-29 20:04:54 -08:00
Kubernetes Submit Queue 235714e7f3
Merge pull request #58298 from p0lyn0mial/generic_scaler_scalerfor_continued
Automatic merge from submit-queue (batch tested with PRs 58955, 58968, 58971, 58963, 58298). 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 the remainder from ScalerFor method

**What this PR does / why we need it**:
this PR removes existing scalers from `ScalerFor` method

**Release note**:

```release-note
NONE
```
2018-01-29 13:48:51 -08:00
p0lyn0mial 71eb1ff3b1 removes the remainder from ScalerFor method
all remaining scalers were replaced by GenericScaler exept JobScaler.
It is not clear whether JobScaler could use generic scaler or not.
For more details see the pull request.
2018-01-29 20:02:27 +01:00
Kubernetes Submit Queue f2ac9671f0
Merge pull request #57229 from niuzhenguo/cleanup_validargs
Automatic merge from submit-queue (batch tested with PRs 57229, 58907). 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>.

Abstract cmd valid args get behind the factory

**What this PR does / why we need it**:
This abstract retrieving the list of handled resources for valid args as a function to follow more conventions.

**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-01-27 00:31:30 -08:00
Kubernetes Submit Queue 3009ec94f7
Merge pull request #58861 from liggitt/prefer-resources-to-shortnames
Automatic merge from submit-queue (batch tested with PRs 58760, 58861). 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>.

Prefer exact resource name matches to shortname expansions

Prevents a shortname of "pod" or "pods" from taking precedence over an exact resource name match

```release-note
NONE
```
2018-01-26 14:46:29 -08:00
Kubernetes Submit Queue d352fc6f3f
Merge pull request #56829 from niuzhenguo/create-run
Automatic merge from submit-queue (batch tested with PRs 58518, 58771, 58101, 56829). 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 RunCreate to follow more conventions

**What this PR does / why we need it**:
Make RunCreate with options like other commands, and abstract raw() into separated func.

**Release note**:

```release-note
NONE
```
2018-01-26 01:03:41 -08:00
Jordan Liggitt e1e1be74da
Prefer exact resource name matches to shortname expansions 2018-01-26 01:45:38 -05:00
Kubernetes Submit Queue 617c87ba06
Merge pull request #58741 from dixudx/fix_kubectl_alias_group
Automatic merge from submit-queue (batch tested with PRs 58302, 58782, 58555, 58741). 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 containing API group when resolving shortname from discovery

**What this PR does / why we need it**:
kubectl does not use containing API group when resolving shortname from discovery 

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

**Special notes for your reviewer**:
/assign @liggitt 
/cc @nikhita @zjj2wry 
**Release note**:

```release-note
use containing API group when resolving shortname from discovery
```
2018-01-25 11:43:57 -08:00
Maciej Szulik c7efab40b6 Fix kubectl explain for cronjobs 2018-01-25 16:10:31 +01:00
Di Xu 97ec47ba55 use containing API group when resolving shortname from discovery 2018-01-25 09:38:34 +08:00
Kubernetes Submit Queue 3cbb62b6bb
Merge pull request #56206 from brancz/top-metrics-s
Automatic merge from submit-queue (batch tested with PRs 56206, 58525). 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: Use metrics-server for kubectl top commands

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

This PR implements support for the kubectl top commands to use the metrics-server as an aggregated API, instead of requesting the metrics from heapster directly. If the `metrics.k8s.io` API is not served by the apiserver, then this still falls back to the previous 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 #55489

**Special notes for your reviewer**:

As utilizing heapster as well as the v1alpha1 version of the metrics API is discouraged, I intentionally implemented the support very separated, so that once it is decided, that support is entirely removed, this will make it easy.

**Release note**:

```release-note
Support metrics API in `kubectl top` commands.
```

/cc @kubernetes/sig-instrumentation-pr-reviews @DirectXMan12 @fgrzadkowski @piosz
2018-01-23 13:17:31 -08:00
Kubernetes Submit Queue 2a04c09027
Merge pull request #58144 from tomerf/kubectl_cp_prefix
Automatic merge from submit-queue (batch tested with PRs 58144, 57149). 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>.

Fixed crash in kubectl cp when path has multiple leading slashes

**What this PR does / why we need it**: Fixed crash in kubectl cp when path has multiple leading slashes
For example:
```
$ kubectl cp pod://path/to/somewhere localfile
tar: Removing leading `//' from member names
panic: runtime error: slice bounds out of range

goroutine 1 [running]:
k8s.io/kubernetes/pkg/kubectl/cmd.untarAll(0x363e840, 0xc420198120, 0x7fff5fbffc13, 0x1, 0x7fff5fbffbfa, 0x18, 0x0, 0x0)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubectl/cmd/cp.go:329 +0x7b4
k8s.io/kubernetes/pkg/kubectl/cmd.copyFromPod(0x3671940, 0xc420261dd0, 0xc4202f9200, 0x3644480, 0xc42000c020, 0x0, 0x0, 0x7fff5fbffbed, 0xb, 0x7fff5fbffbf9, ...)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubectl/cmd/cp.go:237 +0x375
k8s.io/kubernetes/pkg/kubectl/cmd.runCopy(0x3671940, 0xc420261dd0, 0xc4202f9200, 0x3644480, 0xc42000c018, 0x3644480, 0xc42000c020, 0xc4203490a0, 0x2, 0x2, ...)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubectl/cmd/cp.go:134 +0x35b
k8s.io/kubernetes/pkg/kubectl/cmd.NewCmdCp.func1(0xc4202f9200, 0xc4203490a0, 0x2, 0x2)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/pkg/kubectl/cmd/cp.go:72 +0x89
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).execute(0xc4202f9200, 0xc420348ee0, 0x2, 0x2, 0xc4202f9200, 0xc420348ee0)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/github.com/spf13/cobra/command.go:603 +0x234
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc42038d440, 0x8000104, 0x0, 0xffffffffffffffff)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/github.com/spf13/cobra/command.go:689 +0x2fe
k8s.io/kubernetes/vendor/github.com/spf13/cobra.(*Command).Execute(0xc42038d440, 0xc420261dd0, 0x3644440)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/vendor/github.com/spf13/cobra/command.go:648 +0x2b
k8s.io/kubernetes/cmd/kubectl/app.Run(0x0, 0x0)
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubectl/app/kubectl.go:41 +0xd5
main.main()
	/go/src/k8s.io/kubernetes/_output/dockerized/go/src/k8s.io/kubernetes/cmd/kubectl/kubectl.go:27 +0x26
```

**Which issue(s) this PR fixes** None

**Special notes for your reviewer**: None

**Release note**:
```release-note
Fixed crash in kubectl cp when path has multiple leading slashes
```
2018-01-22 19:02:27 -08:00
Frederic Branczyk b1448adb59
kubectl: Use metrics-server for kubectl top commands 2018-01-22 21:45:06 +01:00
juanvallejo 13add66f1e
tolerate more than one gvklist item
Some third-party resources could be part of more than one api group.
Allow this to be the case when adding openapi models to openapi data.
2018-01-19 14:24:03 -05:00
Louis Taylor b0f8a541fa
kubectl: make error with resource list prettier
Previously, running commands like `kubectl get` with no further
arguments would print a list of valid resource types with an error
messages formatted like so:

    <snip>
      * serviceaccounts (aka 'sa')
      * services (aka 'svc')
      * statefulsets (aka 'sts')
      * storageclasses (aka 'sc')error: Required resource not specified.
    Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
    See 'kubectl get -h' for help and examples.

This commit adds extra spacing so it now looks pretty:

    <snip>
      * serviceaccounts (aka 'sa')
      * services (aka 'svc')
      * statefulsets (aka 'sts')
      * storageclasses (aka 'sc')

    error: Required resource not specified.
    Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
    See 'kubectl get -h' for help and examples.
2018-01-18 22:19:44 +00:00
Kubernetes Submit Queue 44d0ba29d3
Merge pull request #56960 from islinwb/remove_unused_code_ut_pkg
Automatic merge from submit-queue (batch tested with PRs 53631, 56960). 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 unused code in UT files in pkg/

**What this PR does / why we need it**:
Remove unused code in UT files in pkg/ .

**Release note**:

```release-note
NONE
```
2018-01-18 02:41:29 -08:00
Kubernetes Submit Queue 048757b8a5
Merge pull request #53631 from dixudx/enforce_cobra_required_flags
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 vendor spf13/cobra to enforce required flags

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

spf13/cobra#502 has enforced checking flags that marked as required, an error will be raised if unset.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*:fixes #54855
xref #48400
fixes kubernetes/kubectl#121 

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

**Release note**:

```release-note
kubectl now enforces required flags at a more fundamental level
```
2018-01-18 02:00:27 -08:00
David Eads d7ddcca231 low hanging fruit for using cobra commands 2018-01-17 13:43:43 -05:00
David Eads 49f12fa70f fail earlier on discovery failures 2018-01-16 16:02:13 -05:00
Kubernetes Submit Queue b04c28e80e
Merge pull request #57381 from niuzhenguo/get-raw-cleanup
Automatic merge from submit-queue (batch tested with PRs 52912, 57381). 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 validators when run kubectl get with --raw

**What this PR does / why we need it**:
1. Make --raw and --output mutually exclusive for kubectl get cmd
2. Add url/ParseRequestURI check for the specified raw URI

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-01-15 22:13:33 -08:00
Kubernetes Submit Queue 1a341f6b88
Merge pull request #52912 from zjj2wry/rollout-status
Automatic merge from submit-queue (batch tested with PRs 52912, 57381). 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>.

bug(cli):fix kubectl rollout status not recoginze resource namespace

**What this PR does / why we need it**:
Fixes #42364

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

**Special notes for your reviewer**:
cc @kubernetes/sig-cli-pr-reviews

**Release note**:

```release-note
NONE
```
2018-01-15 22:13:30 -08:00
Kubernetes Submit Queue f008f147f8
Merge pull request #52321 from Mashimiao/factory-tfix
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>.

small tfix in cmd factory comment

Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>

**What this PR does / why we need it**:
tfix in cmd factory comment

**Release note**:
```release-note
NONE
```
2018-01-15 11:34:48 -08:00
Nikhita Raghunath 5cdd4dcbd5 kubectl scale: support Unstructured objects 2018-01-15 17:01:45 +05:30
linweibin fa8afc1d39 Remove unused code in UT files in pkg/ 2018-01-15 16:02:35 +08:00
Kubernetes Submit Queue 52a2256b1a
Merge pull request #57843 from p0lyn0mial/wire_generic_scaler
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>.

wires the generic scaler to kubectl

**What this PR does / why we need it**:
the changes introduced in this commit plumbs in the generic scaler to kubectl.
note that we don't change the behaviour of kubectl.
For example it won't scale new resources. That's the end goal.
The first step is to retrofit existing code to use the generic scaler.

**Release note**:

```release-note
NONE
```
2018-01-13 01:26:24 -08:00
Kubernetes Submit Queue 4bc93609ea
Merge pull request #56713 from juanvallejo/jvallejo/handle-ds-pod-drain-local-storage
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>.

Allow kubectl drain to continue w ds-managed pods with local storage

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

Prevents oadm drain from failing if it encounters DaemonSet-managed pods
that have local storage, when the option to ignore DaemonSet-managed
pods has been specified.

Will add a test

cc @kubernetes/sig-cli-misc @deads2k @fabianofranz @dustymabe
2018-01-12 23:05:46 -08:00
p0lyn0mial dd9de90b0a the changes introduced in this commit plumbs in the generic scaler into kubectl.
note that we don't change the behaviour of kubectl.
For example it won't scale new resources. That's the end goal.
The first step is to retrofit existing code to use the generic scaler.
2018-01-12 09:21:18 +01:00
Kubernetes Submit Queue 4a77bd53e8
Merge pull request #57259 from ericchiang/client-go-no-cache-import
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>.

client-go: remove import of github.com/gregjones/httpcache

Moves NewCacheRoundTripper from `k8s.io/client-go/transport` to its own package. This prevents Kubernetes clients from requiring its dependencies.

This change removes the following transitive imports from `k8s.io/client-go/kubernetes`

```
github.com/google/btree
github.com/gregjones/httpcache
github.com/gregjones/httpcache/diskcache
github.com/peterbourgon/diskv
```


```release-note
NONE
```
2018-01-11 01:25:50 -08:00
Tomer Froumin 52f02c42e6 Fixed crash when path has multiple leading slashes 2018-01-11 10:46:22 +02:00
Kubernetes Submit Queue ba57ff9875
Merge pull request #57112 from aramase/kubectl-fixes
Automatic merge from submit-queue (batch tested with PRs 58025, 57112, 57879, 57571, 58062). 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 typos in kubectl pkg

**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-01-10 11:46:43 -08:00
Kubernetes Submit Queue 91884464d2
Merge pull request #56919 from dixudx/refactor_get_uninitialized
Automatic merge from submit-queue (batch tested with PRs 49874, 56919, 57246). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

refactor getting uninitialized in kubectl get

**What this PR does / why we need it**:
remove leftover TODO to refactor getting uninitialized in kubectl get

**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**:
/assign @smarterclayton 

**Release note**:

```release-note
None
```
2018-01-10 08:15:44 -08:00
Ahmet Alp Balkan ee0351320e
cmd/kubectl: fix broken error formatting for run
This patch adds missing value to a format string (%s) in --restart flag
validation for "kubectl run".

"kubectl run --restart=foo" was giving error:

    error: invalid restart policy: %!s(MISSING)

Now it says:

    error: invalid restart policy: foo

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2018-01-09 17:00:35 -08:00
Kubernetes Submit Queue b2ffdb73ac
Merge pull request #57511 from niuzhenguo/show-kind
Automatic merge from submit-queue (batch tested with PRs 57511, 57978). 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>.

Small improvement of showKind get

**What this PR does / why we need it**:
Given the complexity of determining whether to show resource with kind, this PR will be a small improvement when with `--show-kind=true`. There's no need to waste time to run the complex logic if we already decided to show resource with kind.

**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-01-09 15:19:30 -08:00
Zhenguo Niu 3d75e990c3 [Kubectl] Update RunCreate to follow more conventions 2018-01-09 15:45:26 +08:00
Zhenguo Niu c3d77eea54 Abstract cmd valid args get behind the factory 2018-01-09 09:58:07 +08:00
Eric Chiang ea085e0a32 client-go: remove import of github.com/gregjones/httpcache 2018-01-08 09:54:12 -08:00
juanvallejo d4e17cb7b4
Allow oadm drain to continue w ds-managed pods w local storage 2018-01-08 11:51:15 -05:00
Kubernetes Submit Queue a2bce0d74e
Merge pull request #56769 from dixudx/forbid_unnamed_context
Automatic merge from submit-queue (batch tested with PRs 57521, 56769). 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>.

forbid unnamed context

**What this PR does / why we need it**:
forbid unnamed contexts with validation

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

**Special notes for your reviewer**:
/assign @sttts @fabianofranz 

**Release note**:

```release-note
forbid unnamed context
```
2018-01-07 11:19:45 -08:00
Di Xu 792a229936 forbid unnamed context 2018-01-07 10:52:03 +08:00
Anish Ramasekar c322f1d065
fix typos in kubectl pkg 2018-01-05 21:04:44 -06:00
Zhenguo Niu 93b11ad12d Small improvement of showKind get 2018-01-05 18:36:14 +08:00
Kubernetes Submit Queue f875756902
Merge pull request #57021 from lcfang/delkuctl
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>.

delete the unused function in kubectl

**What this PR does / why we need it**:
delete some unused code in `kubctl`
2018-01-04 14:11:54 -08:00
Maciej Szulik 2f9532f047 Allow kubectl set image/env on a cronjob 2018-01-04 10:27:37 +01:00
lcfang 44e2e7a906 delete the unused function in kubectl 2018-01-04 12:00:38 +08:00
Kubernetes Submit Queue b3cf1bd102
Merge pull request #56779 from Lion-Wei/kubectl-2
Automatic merge from submit-queue (batch tested with PRs 57651, 56411, 56779, 57523, 57624). 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>.

Error out if kubectl create with extra argument

**What this PR does / why we need it**:
When using `kubectl create` command with extra args, kubectl will accept the first one and ignore the others. 
This pr give a warnning in this case

**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 kubernetes/kubectl#148

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2018-01-02 14:09:45 -08:00
Christoph Blecker 80e344644e
Regenerate all generated code 2018-01-02 00:21:07 -08:00
Di Xu 1c715d51c4 some code change
fix wrong required flags

disable the addition of [flags] to the usage, use customized useline

fix function rename
2017-12-25 16:23:38 +08:00
Jeff Grafton efee0704c6 Autogenerate BUILD files 2017-12-23 13:12:11 -08:00
Kubernetes Submit Queue 56acf19e6d
Merge pull request #57303 from niuzhenguo/url-check
Automatic merge from submit-queue (batch tested with PRs 57400, 57403, 57303). 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>.

Restrict url conditions when run kubectl create with --raw

**What this PR does / why we need it**:
Currently when run kubectl create with --raw, it will raise "--raw cannot read from a url " if the filename has prefix "http", which is not proper as we may have filenames like "httptest" or similar.

This PR restrict the URL check conditions.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-12-19 11:27:37 -08:00
Zhenguo Niu 8a7f8bc046 Move output and url checks under raw flag condition 2017-12-19 17:51:30 +08:00
Zhenguo Niu a0a69a3583 Add more validate conditions when run kubectl get with --raw 2017-12-19 15:37:21 +08:00
Kubernetes Submit Queue 3ef674188d
Merge pull request #56864 from juanvallejo/jvallejo/add-selector-kubectl-drain
Automatic merge from submit-queue (batch tested with PRs 55751, 57337, 56406, 56864, 57347). 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 pod-selector kubectl drain

**Release note**:
```release-note
Added the ability to select pods in a chosen node to be drained, based on given pod label-selector
```

This patch adds the ability to select pods in a chosen node to be drained, based on given pod label-selector. Related downstream issue: https://github.com/openshift/origin/issues/17554

Further, it removes explicit, specific, pod-controller check. The `drain` command currently fails if a pod has a controller of a `kind` [not explicitly handled in the command itself](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/drain.go#L331). This causes `drain` to be unusable if a node contains pods managed by third-party, or "unknown" controllers.

Based on [this comment](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/drain.go#L353), the expectation was to fail if a pod's controller was not found for whatever reason. I believe that the `drain` command should not care about the existence of a pod controller. It should only care whether a pod has one, and act according to that controller kind. This solves a downstream bug: https://github.com/openshift/origin/issues/17563

cc @fabianofranz @deads2k @kubernetes/sig-cli-misc
2017-12-18 18:50:45 -08:00
Kubernetes Submit Queue 5c17bec909
Merge pull request #57140 from niuzhenguo/noheaders-linebreak
Automatic merge from submit-queue (batch tested with PRs 56947, 56349, 57140, 53686, 57314). 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: Move no-headers flag get out of for loop

**What this PR does / why we need it**:
This makes no-headers flag get before the for loop happen, there's no need to get the flag multiple times.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-12-18 12:24:41 -08:00
juanvallejo 2f1108451f
Remove hard-coded pod-controller check
This allows pods with third-party, or unknown controllers to be drained
successfully.
2017-12-18 13:09:13 -05:00
Kubernetes Submit Queue 90acdba062
Merge pull request #57150 from deads2k/rebase-03-convert
Automatic merge from submit-queue (batch tested with PRs 57324, 56931, 57000, 57150, 56965). 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 convert to default on a per object basis

`kubetl convert` needs to distinguish between cases where a user specifies a version (use this at all cost) and cases where it doesn't (for each object, find the best version to convert to).  This allows that to happen.
2017-12-18 08:46:49 -08:00
juanvallejo 151398e961
add --pod-selector opt kubectl drain 2017-12-18 10:15:06 -05:00
Zhenguo Niu 86cc625a55 Use GetDryRunFlag to keep consistent 2017-12-18 19:28:55 +08:00
Zhenguo Niu 9b549bd5f4 Restrict url check conditions when creating with --raw 2017-12-18 13:42:58 +08:00
Kubernetes Submit Queue 5f92042610
Merge pull request #56483 from dixudx/fix_cli_attach_format
Automatic merge from submit-queue (batch tested with PRs 57127, 57011, 56754, 56601, 56483). 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 bad output format for attaching pods

**What this PR does / why we need it**:
If the user wants to attach stdin, wants a TTY, and `o.In` is a terminal, `t.Raw` is set to true, which is causing bad format like #56450.

We should avoid print extra logs in `SafeFunc`. Move it outer.

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

**Special notes for your reviewer**:
/assign @thockin @kubernetes/sig-cli-bugs  

**Release note**:

```release-note
None
```
2017-12-17 06:26:01 -08:00
Kubernetes Submit Queue 6236cddab7
Merge pull request #54881 from juanvallejo/jvallejo/use-printer-for-cmd-through-factory
Automatic merge from submit-queue (batch tested with PRs 56676, 57050, 54881, 56822, 57113). 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>.

ensure PrinterForCommand is consumed through cmdutil.Factory

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

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

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

@fabianofranz @mengqiy @shiywang
2017-12-16 19:19:44 -08:00
Kubernetes Submit Queue b9eee8fd6b
Merge pull request #54902 from YuxiJin-tobeyjin/addunitforlogs
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>.

Supplement unit test for kubectl logs

**What this PR does / why we need it**:
Supplement unit test for kubectl logs

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE

```
2017-12-16 09:15:26 -08:00
Kubernetes Submit Queue 6541b1ae06
Merge pull request #56673 from niuzhenguo/fix-diff-cmd-typo
Automatic merge from submit-queue (batch tested with PRs 56639, 56746, 56715, 56673, 56726). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Fix a typo in kubectl/diff cmd long description.

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

Correct a typo in kubelet alpha diff cmd long description.

**Release note**:
```release-note
NONE
```
2017-12-16 06:39:47 -08:00
Kubernetes Submit Queue 12402f3a94
Merge pull request #56512 from tpepper/docs
Automatic merge from submit-queue (batch tested with PRs 56579, 55236, 56512, 56549, 56538). 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: point info url to user guide overview

The kubectl command output suggests a user find more information at the
github source repo, eg:

	$ kubectl --help
	kubectl controls the Kubernetes cluster manager.

	Find more information at https://github.com/kubernetes/kubernetes.

But there is curated user documentation available at, eg:

	https://kubernetes.io/docs/reference/kubectl/overview/

which upon referencing yields a much better experience for a user than the
top of the source repo.

Fixes #56511

Signed-off-by: Tim Pepper <tpepper@vmware.com>

```release-note
NONE
```
2017-12-15 21:19:40 -08:00
Kubernetes Submit Queue 6b66131034
Merge pull request #56413 from supereagle/policy-client-with-version
Automatic merge from submit-queue (batch tested with PRs 56413, 56322, 56490, 56460, 56487). 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 policy client with explicit version

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

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

**Special notes for your reviewer**:
/cc @caesarxuchao @sttts

**Release note**:
```release-note
NONE
```
2017-12-15 16:43:47 -08:00
Kubernetes Submit Queue 761fdeacaa
Merge pull request #55689 from luksa/kubectl_explain_kind_version
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Make kubectl explain print the Kind and APIVersion of the resource

**What this PR does / why we need it**:
Kubectl explain currently doesn't print out the Kind and APIversion of the resource being explained. When running `kubectl explain hpa.spec`, for example, there is no way of knowing whether you're looking at the `autoscaling/v1` or the `autoscaling/v2beta1` version. 
Also, `kubectl explain` is often used as a reference when writing YAML/JSON object manifests. It allows you to look up everything except the API version. Currently, you either need to know the API Version of a resource by heart or look it up in the online API docs. 
This PR fixes both problems by having `kubectl explain` print out the full Kind and APIVersion of the resource it is explaining.

Here are a few examples of the new output:
```
$ kubectl explain deploy
KIND:     Deployment
VERSION:  extensions/v1beta1

DESCRIPTION:
...


$ kubectl explain hpa.spec
KIND:     HorizontalPodAutoscaler
VERSION:  autoscaling/v1

RESOURCE: spec <Object>

DESCRIPTION:
...


$ kubectl explain hpa.spec.maxReplicas
KIND:     HorizontalPodAutoscaler
VERSION:  autoscaling/v1

FIELD:    maxReplicas <integer>

DESCRIPTION:
...


$ kubectl explain hpa.spec --recursive
KIND:     HorizontalPodAutoscaler
VERSION:  autoscaling/v1

RESOURCE: spec <Object>

DESCRIPTION:
     behaviour of autoscaler. More info:
     https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.

     specification of a horizontal pod autoscaler.

FIELDS:
   maxReplicas	<integer>
   minReplicas	<integer>
   scaleTargetRef	<Object>
      apiVersion	<string>
      kind	<string>
      name	<string>
   targetCPUUtilizationPercentage	<integer>
```

**Release note**:

```release-note
Kubectl explain now prints out the Kind and API version of the resource being explained
```
2017-12-15 08:12:28 -08:00
Kubernetes Submit Queue 778c60a6c0
Merge pull request #56263 from supereagle/batch-client-with-version
Automatic merge from submit-queue (batch tested with PRs 56217, 56268, 56263, 56328, 56200). 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 batch client with explicit version

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

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

**Special notes for your reviewer**:
/cc @caesarxuchao @sttts

**Release note**:
```release-note
NONE
```
2017-12-14 23:37:46 -08:00
Kubernetes Submit Queue 126aafb287
Merge pull request #55604 from zjj2wry/kubectl_api_dep
Automatic merge from submit-queue (batch tested with PRs 55557, 55504, 56269, 55604, 56202). 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 version api from kubectl

**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**:
/cc @liggitt  
**Release note**:

```release-note
NONE
```
2017-12-14 13:54:46 -08:00
Kubernetes Submit Queue 8e161212f6
Merge pull request #55913 from wackxu/refauto
Automatic merge from submit-queue (batch tested with PRs 55900, 55995, 55913, 55467, 55376). 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 structured generator for kubectl autoscale

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

Use structured generator for kubectl autoscale

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

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

**Release note**:

```release-note
Use structured generator for kubectl autoscale 
```
2017-12-14 00:45:18 -08:00
Kubernetes Submit Queue baf93c060e
Merge pull request #55995 from supereagle/extensions-client-with-version
Automatic merge from submit-queue (batch tested with PRs 55900, 55995, 55913, 55467, 55376). 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 extensions client with explicit version

**What this PR does / why we need it**:
Extensions client without explicit version has been deprecated, change them to the one with explicit version.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-12-14 00:45:15 -08:00
Kubernetes Submit Queue 876259435a
Merge pull request #55991 from supereagle/core-client-with-version
Automatic merge from submit-queue (batch tested with PRs 54604, 55781, 55806, 55935, 55991). 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 core client with explicit version

**What this PR does / why we need it**:
Core client without explicit version has been deprecated, change them to the one with explicit version.

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

**Special notes for your reviewer**:
/cc @kubernetes/sig-api-machinery-pr-reviews
/cc @caesarxuchao @k82cn @sttts @kevin-wangzefeng 

**Release note**:
```release-note
NONE
```
2017-12-13 22:26:01 -08:00
Tim Pepper bd4e89cf5d kubectl: point info url to user guide overview
The kubectl command output suggests a user find more information at the
github source repo, eg:

	$ kubectl --help
	kubectl controls the Kubernetes cluster manager.

	Find more information at https://github.com/kubernetes/kubernetes.

But there is curated user documentation available at, eg:

	https://kubernetes.io/docs/reference/kubectl/overview/

which upon referencing yields a much better experience for a user than the
top of the source repo.

Fixes #56511

Signed-off-by: Tim Pepper <tpepper@vmware.com>
2017-12-13 17:01:50 -08:00
David Eads 2f7793df7d allow convert to default on a per object basis 2017-12-13 08:48:14 -05:00
Zhenguo Niu 7cccb94edb Kubectl: Move no-headers flag get out of for loop 2017-12-13 17:43:16 +08:00
Di Xu d66d8f053d refactor getting uninitialized in kubectl get 2017-12-07 13:30:20 +08:00
juanvallejo 8c9c2ee2d8
update type-check to use printers.PritnHandler 2017-12-05 13:39:55 -05:00
juanvallejo c53120e6b9
ensure PrinterForCommand is consumed through cmdutil.Factory 2017-12-05 13:39:29 -05:00
Lion-Wei d51fbd35ce warn if kubectl create with extra argument 2017-12-05 09:42:16 +08:00
ymqytw ed0dcb7498 build patch from openapi only for registered types 2017-12-01 13:44:11 -08:00
Zhenguo Niu 2522b3601b Fix a typo in kubectl/diff cmd long description. 2017-12-01 14:31:12 +08:00
Di Xu 6dddafe73b fix bad output format for attaching pods 2017-11-28 18:15:51 +08:00
supereagle 79352bafaa use policy client with explicit version 2017-11-27 22:42:00 +08:00
supereagle 032416c75d use core client with explicit version
fix more usage of deprecated core client
2017-11-25 08:14:10 +08:00
supereagle 1fe05ac29a Use batch client with explicit version 2017-11-23 09:32:13 +08:00
Kubernetes Submit Queue e412ad5393
Merge pull request #51321 from mengqiy/kubectl_apply_openapi
Automatic merge from submit-queue (batch tested with PRs 51321, 55969, 55039, 56183, 55976). 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 apply and strategic merge patch using openapi

- [x] support openapi in strategic merge patch
- [x] test openapi in strategic merge patch
- [x] kubectl apply use openapi to calculate diff be default. It will fall back to use baked-in types when openapi is not available.
- [x] test openapi in kubectl apply

Fixes: kubernetes/kubectl#55

```release-note
kubectl apply use openapi to calculate diff be default. It will fall back to use baked-in types when openapi is not available.
```

/assign @apelisse
2017-11-22 11:59:49 -08:00
supereagle 9c02d7e38c use extensions client with explicit version 2017-11-22 21:18:14 +08:00
Kubernetes Submit Queue 9a0bbd0aa9
Merge pull request #53765 from tanshanshan/fix-bug1
Automatic merge from submit-queue (batch tested with PRs 54529, 53765). 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  #53735, check whether  interface conversion is ok

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

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

fix #53735

avoid interface conversion error 

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-11-21 21:38:59 -08:00
ymqytw 0b0004e0c0 support openapi in apply 2017-11-21 10:22:43 -08:00
juanvallejo f5ab356043
pass printOpts by pointer 2017-11-20 14:49:23 -05:00
juanvallejo d3773b4b06
consolidate printer OutputOpts w PrintOpts
This patch removes the use of printers.OutputOptions in favor of only
having a single struct for setting / passing printer options set by user
flags.
2017-11-20 14:49:23 -05:00
wackxu 87054639a2 refactor kubectl autoscale to use the new generator 2017-11-20 14:12:20 +08:00
Clayton Coleman 09b64d36d2
rollingupdate should use explicit casting
It needs both internal and versioned - use the new helpers to detect
that
2017-11-19 20:41:02 -05:00
Clayton Coleman 8f4b6c8771
All commands must declare Unstructured or Internal
Callers must take a dependency on one or the other set of conversions
and default client behavior. Future changes may add a Versioned() type,
but this is an accurate reflection of current code state.
2017-11-19 20:41:02 -05:00
Clayton Coleman 04ab96d2bd
Unify Object and UnstructuredObject
The unified RESTMapper and Typer follow the new rules, but on error will
fallback to the legacy path (while still supporting Unstructured
objects). This allows callers to handle the appropriate distinction
themselves if necessary.

Add a LocalParam() method to the resource.Builder that DRYs up a large
chunk of complicated code in set commands.
2017-11-19 19:16:50 -05:00
Clayton Coleman 7563a0c4d8
Remove unstructured error checking from affected code
Also remove error messages that depended on ObjectKinds() - future
changes will potentially remove this interface and the replacements here
are equivalent.
2017-11-19 19:16:50 -05:00
Clayton Coleman e298aa39c3
Add a lazy discovery interface for Unstructured
Delays the error until the first call and then preserves it for others.
More closely matches the intent of the Object() calls. Loaders are now
lazy and don't need to return errors directly.

Sets the stage for collapsing unstructured and structured builders
together.
2017-11-19 19:16:50 -05:00
Clayton Coleman 287a3ed1e1
Apply set last applied should not need to fetch latest
Latest always refreshes from the server, and the server will return the
updated object. In this case, we want to only access the local file.
2017-11-19 19:16:49 -05:00
Clayton Coleman 5038eb2a3f
Remove use of VersionedObject and simplify builder in generic methods
Reduce all uses of Unstructured to the simpler form, and avoid asking
for mapper or typer unless it is required. Use Typed() for places that
previously used VersionedObject, and remove paths for versioned objects
from code that is now using unstructured.
2017-11-19 19:16:49 -05:00
Clayton Coleman 64f56764d5
Builder should allow moving between unstructured / versioned easily
Demonstrate its use with get.go by removing the need to call decode with
a hardcoded scheme. Add tests to get_test.go to restore proving that
unstructured conversion is possible.
2017-11-19 19:16:49 -05:00
Clayton Coleman 0229fd4bd1
Unify unstructured and versioned object in resource.Builder
resource.Builder should be aware of both paths, and the caller is
responsible for determining the different path via use.
2017-11-19 19:02:25 -05:00
Clayton Coleman 98e0c69907 Revert "refactor builder in kubectl factory"
This reverts commit 06c5be9802.
2017-11-19 19:02:21 -05:00
Kubernetes Submit Queue fa3047880d
Merge pull request #54867 from juanvallejo/jvallejo/move-print-success-cmdutil-factory
Automatic merge from submit-queue (batch tested with PRs 55233, 55927, 55903, 54867, 55940). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

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

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

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

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

@fabianofranz @mengqiy @shiywang @seans3
2017-11-18 12:26:15 -08:00
Kubernetes Submit Queue 153b5f50f2
Merge pull request #53483 from apelisse/openapi-columns
Automatic merge from submit-queue (batch tested with PRs 50457, 55558, 53483, 55731, 52842). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Show openapi custom columns in `kubectl get`

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

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

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

**Special notes for your reviewer**:

Closes kubernetes/kubectl#143

**Release note**:
```release-note
`kubectl get` will now use OpenAPI schema extensions by default to select columns for custom types.
```
2017-11-18 11:36:19 -08:00
Kubernetes Submit Queue a67abac765
Merge pull request #55650 from smarterclayton/make_unstructured_conversion
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 unstructured conversion into pkg/runtime

Scheme conversion should support unstructured conversion natively to
allow going from unstructured to typed and back. It is not a higher
level responsibility to do that conversion because the scheme is the
only one who knows what types it supports.

@liggitt @kubernetes/sig-cli-api-reviews I am going to make Scheme support unstructured in ConvertToVersion and Convert, which means resource.Builder and the CLI can get simpler for all existing use cases where versioned and unstructured need to coexist.
2017-11-18 08:47:10 -08:00
Kubernetes Submit Queue 56e62b684e
Merge pull request #54053 from WanLinghao/cmd_test_unused_function
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 unused function in cmd_test.go

PR removed unused defaultClientConfigForVersion() functions from cmd_test.go.



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

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

**Special notes for your reviewer**:

**Release note**:

```
NONE
```
2017-11-17 08:28:26 -08:00
Clayton Coleman f8cc69cafe
kubectl apply edit-last-applied should fail when version is missing
If a user edits last-applied-configuration and it doesn't have an
apiVersion or kind, the command should error out. Now that we check for
kind and version on the unstructured object typer, the previously
passing test now correctly fails. Add a new explicit failure test and
make the existing test pass.
2017-11-16 18:02:41 -05:00
Clayton Coleman 5519a7c5e9
Make edit test use subtests to identify flake 2017-11-16 15:45:59 -05:00
Sergey Lanzman 3474747465 Move regexp.MustCompile to global variable 2017-11-16 22:03:12 +02:00
Kubernetes Submit Queue 2f2d49442f
Merge pull request #55371 from charrywanganthony/showlabel
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>.

Using --show-labels with incompatible ‘kubectl get’ arguments should …

…error out

**What this PR does / why we need it**:
According to @ahmetb 's [issue](https://github.com/kubernetes/kubernetes/issues/55290)  
Under specific circumstances, current behavior is that the `--show-labels` simply doesn’t make a difference since it’s not applicable.  

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

**Release note**:

```release-note
NONE
```
2017-11-16 08:03:18 -08:00
Kubernetes Submit Queue cc62445844
Merge pull request #55647 from smarterclayton/move_category
Automatic merge from submit-queue (batch tested with PRs 55697, 55631, 51905, 55647, 55826). 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 category expander out of kubectl/resource

Removes coupling with unstructured.  Part of refactoring get.go and simplifying the builder.
2017-11-16 03:57:35 -08:00
Kubernetes Submit Queue c7f8c208c9
Merge pull request #55131 from stewart-yu/addnamespaces
Automatic merge from submit-queue (batch tested with PRs 55682, 55444, 55456, 55717, 55131). 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>.

hint command missing namespace parameters

**What this PR does / why we need it**:
hint command miss namespace parameters.
before change,  the hint is:
```shell
Use 'kubectl describe pod/<podname>' to see all of the containers in this pod.
```
after change, the hint is:
```shell
Use 'kubectl describe pod/<podname> -n <podnamespace>' to see all of the containers in this pod.
```

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-11-15 23:06:22 -08:00
Antoine Pelisse 1d99b763df Show openapi custom columns in `kubectl get`
Change the name of the flag to something slightly more user-friendly,
while making it default true. The flag is kept so that someone can
revert it temporarly if things go wrong.
2017-11-15 14:02:27 -08:00
Antoine Pelisse 9778b1a9ba openapi: Add EmptyResource/CreateOpenAPISchemaFunc test utils
Add a new EmptyResource class that implements openapi.Resources, but
just doesn't have any resources. That is useful for tests that expect
the OpenAPISchema to be working, but don't expect any actual result.

Also implement CreateOpenAPISchemaFunc to simply plug in the TestFactory
code when you want to use an actual APISchema.
2017-11-15 14:02:13 -08:00
Kubernetes Submit Queue 884f256027
Merge pull request #55274 from venezia/enhance_label_taint_docs
Automatic merge from submit-queue (batch tested with PRs 55648, 55274, 54982, 51955, 55639). 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>.

Enhance label and taint documentation in kubectl

**What this PR does / why we need it**:
This adds some language around how taint and label keys can have a domain + '/' in front of them.  From the current documentation, it would seem like these are not allowed even though [well known labels](https://kubernetes.io/docs/reference/labels-annotations-taints/) have them.

Also, it seemed unclear (to me) that both the label's key and value can be 63 characters long.  I wanted to clarify this.

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

**Special notes for your reviewer**:
Phrasing of "_DNS subdomain prefix and '/'_" was copied from [a validator's message](https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go#L57) ... I'm unsure if its the best wording, but wanted to be consistent with the validator.

**Release note**:
```release-note
NONE
```
2017-11-15 12:03:33 -08:00
juanvallejo 701d6536a2
move cmd/util/printing.go#PrintSuccess to factory_builder.go 2017-11-15 10:46:39 -05:00
Clayton Coleman b366afa00a
Move category expander out of kubectl/resource 2017-11-14 17:38:16 -05:00
Kubernetes Submit Queue e725361722
Merge pull request #54877 from juanvallejo/jvallejo/move-PrintResourceInfoRorCommand-cmdutil-factory
Automatic merge from submit-queue (batch tested with PRs 54602, 54877, 55243, 55509, 55128). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

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

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

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

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

@fabianofranz @mengqiy @shiywang @seans3
2017-11-14 03:03:23 -08:00
Marko Luksa c77d5d0f90 Kubectl explain now also prints the Kind and APIVersion of the resource 2017-11-14 11:05:19 +01:00
zhengjiajin 0fab7c1bec bug(cli):fix kubectl rollout status not recoginze resource namespace 2017-11-14 11:45:14 +08:00
zhengjiajin 3fe0d59607 remove internal version api from kubectl label command 2017-11-13 17:30:09 +08:00
zhengjiajin aabee865cd remove internal version api from kubectl annotate command 2017-11-13 17:29:40 +08:00
zhengjiajin 1fa1e8dac1 use versionedObject replace internal in kubectl set selector 2017-11-13 14:27:59 +08:00
Chao Wang 6a34285e84 Using --show-labels with incompatible ‘kubectl get’ arguments should error out 2017-11-13 09:33:58 +08:00