Commit Graph

2650 Commits (546b28ac5f1cba93be2260ca7121f98f355bae74)

Author SHA1 Message Date
ymqytw 3dfc8bf7f3 update import 2017-07-20 11:03:49 -07:00
Kubernetes Submit Queue 6d534b38e8 Merge pull request #48253 from CaoShuFeng/serviceaccount
Automatic merge from submit-queue (batch tested with PRs 49218, 48253, 48967, 48460, 49230)

allow impersonate serviceaccount in cli

We can impersonate four kinds of resources according to the code:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go#L83

**Release note**:

```
allow impersonate serviceaccount in cli
```
Fixes: https://github.com/kubernetes/kubernetes/issues/48260
2017-07-19 20:05:32 -07:00
ravisantoshgudimetla b01a1c3881 Build files generated 2017-07-19 18:36:12 -04:00
ravisantoshgudimetla 9dbf1a5644 Refactoring taints to reduce sprawl 2017-07-19 18:36:07 -04:00
Kubernetes Submit Queue 575cbdf7d4 Merge pull request #45012 from xiangpengzhao/fix-delete-svc
Automatic merge from submit-queue

Remove service on termination when exec 'kubectl run' command with flags "--rm" and "--expose"

**What this PR does / why we need it**:
As the title says and issue #40504 mentioned.
cc @tanapoln

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

**Special notes for your reviewer**:
Related to: #44915

**Release note**:

```release-note
NONE
```
2017-07-19 07:59:34 -07:00
Kubernetes Submit Queue d74ac3785e Merge pull request #48950 from alexandercampbell/kubectl-deduplicate-deployment-generators
Automatic merge from submit-queue (batch tested with PRs 49120, 46755, 49157, 49165, 48950)

kubectl: deduplicate deployment generators

**What this PR does / why we need it**: See the description on https://github.com/kubernetes/kubectl/issues/44

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

**Special notes for your reviewer**: Yes, the lines added and removed are about the same. This is because I added 20+ lines of docstrings. Check the diff. You'll see I deleted a lot of duplicated logic :)

**Release note**:

```release-note
NONE
```
2017-07-19 00:06:29 -07:00
Kubernetes Submit Queue 882f838a0d Merge pull request #49134 from deads2k/cli-14-tolerate-missing-template
Automatic merge from submit-queue (batch tested with PRs 49055, 49128, 49132, 49134, 49110)

make sure that the template param is the right type before using it

The CLI should attempt to make sure that the flags it uses conform to expectations instead of unconditionally killing a process.  This allows for possible re-use of the printing stack.
2017-07-18 21:54:23 -07:00
Kubernetes Submit Queue 7bd44a21be Merge pull request #48481 from fabianofranz/apply_protect_against_nil_panic
Automatic merge from submit-queue (batch tested with PRs 48481, 48256)

Protect against nil panic in apply

**What this PR does / why we need it**: `kubectl apply` has a potential panic (actually verified in OpenShift in https://github.com/openshift/origin/issues/15017) where a `patcher` calls the `runDelete` function with a nil `resource.RESTClient`, but under some conditions the client is required by that function.

**Release note**:

```release-note
NONE
```

@pwittrock @kubernetes/sig-cli-bugs
2017-07-18 18:19:17 -07:00
Alexander Campbell a7c79711d5 kubectl/deployment: add BaseDeploymentGenerator to reduce duplication
BaseDeploymentGenerator performs the functionality that was common to
both of the "create deployment" generators.
2017-07-18 13:17:45 -07:00
Fabiano Franz 71cbad7cbb Flag support in kubectl plugins 2017-07-18 15:35:40 -03:00
deads2k a67255c170 make sure that the template param is the right type before using it 2017-07-18 13:48:29 -04:00
Fabiano Franz 183ff5237d Protect against nil panic in apply 2017-07-18 12:55:34 -03:00
xiangpengzhao 396c596e07
Add customresourcedefinition and its shortcut in "kubectl get" 2017-07-18 15:31:56 +08:00
Dr. Stefan Schimanski 8dd0989b39 Update generated code 2017-07-18 09:28:49 +02:00
Dr. Stefan Schimanski 39d95b9b06 deepcopy: add interface deepcopy funcs
- add DeepCopyObject() to runtime.Object interface
- add DeepCopyObject() via deepcopy-gen
- add DeepCopyObject() manually
- add DeepCopySelector() to selector interfaces
- add custom DeepCopy func for TableRow.Cells
2017-07-18 09:28:47 +02:00
xiangpengzhao a6be3b64f8 Make "kubectl version" json output more readable. 2017-07-18 11:21:35 +08:00
Shiyang Wang f1afc3d09d fix sort-by output problem 2017-07-17 10:26:34 +08:00
Kubernetes Submit Queue 4b4e91977d Merge pull request #48274 from superbrothers/fix-to-override-kubectl-flags
Automatic merge from submit-queue (batch tested with PRs 48381, 48274)

Fix completions for --namespace to override kubectl flags

**What this PR does / why we need it**:
This PR fixes completions for --namespace to override kubectl flags. Due to not using __kubectl_parse_get, __kubectl_get_namespaces doesn't support to override kubectl flags.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-07-16 19:03:36 -07:00
Kubernetes Submit Queue 0049dd0717 Merge pull request #48381 from superbrothers/completion-kubectl-config-delete-cluster
Automatic merge from submit-queue

Support completion for kubectl config delete-cluster

**What this PR does / why we need it**:
This PR supports completion for kubectl config delete-cluster.
```
$ kubectl config delete-cluster <tab>
cluster01  minikube
```

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Support completion for kubectl config delete-cluster
```
2017-07-16 18:50:08 -07:00
Kubernetes Submit Queue 8ce6378512 Merge pull request #46091 from xilabao/new-output-in-edit
Automatic merge from submit-queue (batch tested with PRs 46091, 48280)

allow output patch string in edit command

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

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

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

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Could get the patch from kubectl edit command
```
2017-07-16 18:04:42 -07:00
Jordan Liggitt e8f2879bfd
Allow setting service account with kubectl run 2017-07-15 12:37:10 -04:00
Kubernetes Submit Queue fdb3b2af70 Merge pull request #48578 from fabianofranz/run_output_message_on_container_error
Automatic merge from submit-queue (batch tested with PRs 48578, 48895, 48958)

run must output message on container error

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

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

**Release note**:

```release-note
NONE
```
2017-07-14 13:45:51 -07:00
Kubernetes Submit Queue 2610b9cf52 Merge pull request #48894 from juanvallejo/jvallejo/remove-hardcoded-kubectl-in-apply-warn-msg
Automatic merge from submit-queue (batch tested with PRs 47066, 48892, 48933, 48854, 48894)

replace hardcoded use of "kubectl" in apply warning msg

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

Removes use of hardcoded "kubectl" in the `kubectl apply ...` warning message that is printed when the `last-applied-configuration` annotation is missing on a resource. This is useful for downstream wrappers around the `apply` command.

cc @stevekuznetsov @fabianofranz
2017-07-14 12:50:57 -07:00
Kubernetes Submit Queue fd619b04b2 Merge pull request #48572 from alexandercampbell/kubectl-follow-options-pattern-in-version
Automatic merge from submit-queue

cmd/version: refactor to use the -Options pattern

Refactor `kubectl version` to use the prescribed pattern in [kubectl-conventions.md](49d65710b3/contributors/devel/kubectl-conventions.md (command-implementation-conventions)).

```release-note
NONE
```

/assign @mengqiy
2017-07-14 10:49:11 -07:00
Kubernetes Submit Queue d58d29d99d Merge pull request #48082 from ravisantoshgudimetla/kubectl_drain_node_conversion
Automatic merge from submit-queue (batch tested with PRs 48082, 48815, 48901, 48824)

Changes for typecasting node in drain

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

**Special notes for your reviewer**:
Precursor to #44944

**Release note**:

```release-note
kubectl drain now uses PATCH instead of PUT to update the node. The node object is now of type v1 instead of using internal api.
```
2017-07-13 22:43:54 -07:00
Kubernetes Submit Queue 6d69f18f5b Merge pull request #46845 from zhangxiaoyu-zidif/change-fatalf
Automatic merge from submit-queue

Use t.Fatalf instead

**What this PR does / why we need it**:
we can use t.Fatalf to take place of t.Errorf + t.FailNow()


**Release note**:

```release-note
NONE
```
2017-07-13 21:26:07 -07:00
juanvallejo f28ffdb5e9
replace hardcoded use of "kubectl" in apply warning msg 2017-07-13 16:19:19 -04:00
ravisantoshgudimetla db120eb8ca Changes for converting node to v1 in drain 2017-07-12 21:36:29 -04:00
Kubernetes Submit Queue 77b6b126cb Merge pull request #48641 from smarterclayton/refactor_exec
Automatic merge from submit-queue (batch tested with PRs 48594, 47042, 48801, 48641, 48243)

Prepare to introduce websockets for exec and portforward

Refactor the code in remotecommand to better represent the structure of
what is common between portforward and exec.

Ref #48633
2017-07-12 14:08:10 -07:00
Alexander Campbell 43c83d47d8 cmd/version: refactor to use the -Options pattern
This pattern is described in
49d65710b3/contributors/devel/kubectl-conventions.md (command-implementation-conventions)
2017-07-12 08:37:01 -07:00
Kubernetes Submit Queue b07581e60f Merge pull request #47719 from xilabao/fix-set-selector-1
Automatic merge from submit-queue (batch tested with PRs 48196, 42783, 48507, 47719, 46138)

fix parse resource in setting selector

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

**Which issue this PR fixes**: fixes #47718

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-07-11 23:09:13 -07:00
Kubernetes Submit Queue cd3f8c3963 Merge pull request #47460 from mengqiy/fix_env
Automatic merge from submit-queue (batch tested with PRs 48402, 47203, 47460, 48335, 48322)

fix kubectl run --env flag

fixes: kubernetes/kubectl#19

cc: @ddcprg

```release-note
`kubectl run --env` no longer supports CSV parsing. To provide multiple env vars, use the `--env` flag multiple times instead of having env vars separated by commas. E.g. `--env ONE=1 --env TWO=2` instead of `--env ONE=1,TWO=2`.
```
2017-07-11 21:01:35 -07:00
Clayton Coleman cf026a3314
Move SPDY specific code into its own package 2017-07-09 16:11:05 -04:00
Kubernetes Submit Queue a2e463f6d0 Merge pull request #48546 from deads2k/tpr-19-ripples
Automatic merge from submit-queue (batch tested with PRs 48497, 48604, 48599, 48560, 48546)

remove dead code

This removes the dead code cruft since we stopped serving TPRs.

ref #48152
2017-07-08 07:09:38 -07:00
Clayton Coleman 12c7874c0d
Prepare to introduce websockets for exec and portforward
Refactor the code in remotecommand to better represent the structure of
what is common between portforward and exec.
2017-07-07 18:22:51 -04:00
deads2k 0801ded425 remove dead code 2017-07-07 09:12:29 -04:00
Fabiano Franz f623b9b42f run must output message on container error 2017-07-07 00:33:48 -03:00
xilabao 0ba41e7285 fix parse resource in setting selector 2017-07-07 10:36:29 +08:00
ymqytw b336691ca3 eliminate kubectl dependency on kubelet 2017-07-05 20:23:30 -07:00
Kubernetes Submit Queue bce32b66cd Merge pull request #47217 from CaoShuFeng/trival_fix
Automatic merge from submit-queue

[trivial]fix function name in comment

**Release note**:

```
NONE
```
2017-07-05 03:21:30 -07:00
Kazuki Suda 4eee8ea119 Support completion for kubectl config delete-cluster 2017-07-01 22:01:43 +09:00
Kubernetes Submit Queue 73a94eac9e Merge pull request #48299 from mengqiy/kubectl_term
Automatic merge from submit-queue (batch tested with PRs 47918, 47964, 48151, 47881, 48299)

move term to kubectl/util

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

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

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

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

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

OpenAPI downloads protobuf rather than Json

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

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

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

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

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-06-30 16:28:48 -07:00
ymqytw f0ce897277 move term to kubectl/util 2017-06-30 15:00:24 -07:00
ymqytw 2510a47374 move crlf to kubectl/util 2017-06-29 15:48:41 -07:00
Kazuki Suda 4cdc5247fc Rename function to follow other similar functions 2017-06-29 23:32:22 +09:00
Kazuki Suda fe598e0401 Fix completions for --namespace to override flags
Due to not using __kubectl_parse_get, __kubectl_get_namespaces doesn't
support to override kubectl flags.
2017-06-29 23:25:12 +09:00
Cao Shufeng a59f3490c9 allow impersonate serviceaccount in cli
We can impersonate four kinds of resources according to the code:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apiserver/pkg/endpoints/filters/impersonation.go#L83
2017-06-29 14:56:46 +08:00
Kubernetes Submit Queue 7c656ab4d2 Merge pull request #45611 from atombender/issue-45608
Automatic merge from submit-queue (batch tested with PRs 48183, 45611, 48065)

kubectl: 'apply view-last-applied' must not use printf() semantics

**What this PR does / why we need it**:
This fixes `kubectl apply view-last-applied` to not use `fmt.Fprintf()`, as this will cause format codes in the YAML/JSON to be interpreted. For example, if a resource manifest contains `%r`, this would cause `view-last-applied` so print `%!r(MISSING)`.

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

**Special notes for your reviewer**:

**Release note**:

```release-note
Fixes an edge case where "kubectl apply view-last-applied" would emit garbage if the data contained Go format codes.
```
2017-06-28 12:55:21 -07:00
Alexander Campbell 6fd36c10ad kubectl/cmd: many small refactors
* Rename variables and functions to match Go convention.
   For example, UsageError --> UsageErrorf.
 * Remove redundant or unreachable code.
 * Simplify some utility functions (no functionality changes).
 * Fix hanging 'if { return } else { return }' constructs.
 * Fix several incorrect printf verbs.
2017-06-27 16:25:20 -07:00
Kubernetes Submit Queue 850a75fe13 Merge pull request #47675 from alexandercampbell/refactor-long-kubectl-function
Automatic merge from submit-queue (batch tested with PRs 47675, 48001)

cmd/create_deployment: refactor long function

Refactor the `createDeployment` function under `pkg/kubectl/cmd`.

- [x] Behavior has been extracted to two helper functions.
- [x] Behavior remains identical.
- [x] Logic has been made explicit through function naming and comments.

This is essentially the pattern I've been following in my larger branches (the ones that are pending the merge of #46468). Want to get some design feedback before I get too far away from `master`.

Thanks!

cc @apelisse @mengqiy @droot 

**Release note**:

```release-note
NONE
```
2017-06-27 16:11:03 -07:00
Alexander Campbell 14fc8782f5 cmd/run: use util function to deduplicate logic 2017-06-26 11:17:56 -07:00
Alexander Campbell b693c910f5 cmd/create_deployment: refactor & test long function 2017-06-26 11:17:53 -07:00
Clayton Coleman bdd3116c09
Move more printers to TablePrinter 2017-06-26 11:38:36 -04:00
Kubernetes Submit Queue d9ba19c751 Merge pull request #46468 from alexandercampbell/cleanup-in-kubectl
Automatic merge from submit-queue

Cleanup pkg/kubectl

I was reading through `pkg/kubectl` in preparation for completing https://github.com/kubernetes/kubectl/issues/11 and noticed several opportunities for improvement. This should be easy to review since it's mostly mechanical changes. The only complicated changes are in `addFromEnvFile`, which I refactored into two functions and wrote tests for.

**Release note**:

```release-note
NONE
```
2017-06-24 08:32:09 -07:00
Kubernetes Submit Queue a82c9ac2f2 Merge pull request #48016 from liggitt/api-versions-cache
Automatic merge from submit-queue (batch tested with PRs 47869, 48013, 48016, 48005)

Fix kubectl api-versions caching

xref https://github.com/kubernetes/kubectl/issues/41

The point of the `api-versions` and `version` commands is to ask the server for its API groups or versions, so we don't want to use cached data
2017-06-24 06:13:44 -07:00
Kubernetes Submit Queue ff108258bb Merge pull request #46220 from superbrothers/add-statefulset
Automatic merge from submit-queue (batch tested with PRs 47776, 46220, 46878, 47942, 47947)

Add statefulset to the completion candidates of kubectl scale

**What this PR does / why we need it**: This commit adds `statefulset` to the completion candidates of kubectl scale.
```
$ kubectl scale <tab>
deployment             job                    --replicas             replicaset             replicationcontroller  statefulset
```

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-06-24 04:15:50 -07:00
Jordan Liggitt fe8b5e9263
Fix kubectl api-versions caching 2017-06-24 01:14:31 -04:00
Kubernetes Submit Queue ed3c50a755 Merge pull request #47845 from liggitt/remove-redirect
Automatic merge from submit-queue (batch tested with PRs 47993, 47892, 47591, 47469, 47845)

Remove redirect verb parsing

The redirect verb was removed pre-1.0 in https://github.com/kubernetes/kubernetes/pull/9826 so the request parsing logic is dead code

Diff best viewed without whitespace:
https://github.com/kubernetes/kubernetes/pull/47845/files?w=1
2017-06-23 18:05:52 -07:00
Antoine Pelisse 224dba9a13 openapi: Fetch protobuf rather than Json
This is much faster.
2017-06-23 13:50:50 -07:00
Kubernetes Submit Queue 830c1b06b1 Merge pull request #43062 from mkumatag/genfed
Automatic merge from submit-queue

Enhance message in cluster-info dump

**What this PR does / why we need it**:
This PR fixes the information message prints in the end after the cluster-info dump command.
- Added newline in the end
- Enhanced the message for dumping information to standard out

**Which issue this PR fixes** *

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-06-23 12:30:25 -07:00
Alexander Campbell ac793982b0 kubectl: fix inaccurate usage messages for --windows-line-endings
Part of the problem is that these are duplicated between the different
commands. I'm planning to consolidate these further.
2017-06-23 09:49:30 -07:00
Alexander Campbell ef9ae61240 kubectl: simplify code with help of linter 2017-06-23 09:49:30 -07:00
Alexander Campbell 01ae6edc6c cmd: refactor common err expr into helper function
The same redundant fmt.Sprintf() and string literal was duplicated
throughout many of the files in kubectl/cmd. Replace with a helper
function.
2017-06-23 09:49:30 -07:00
Alexander Campbell 066dbb7206 cmd: make createDeployment a private function 2017-06-23 09:49:30 -07:00
Alexander Campbell f9913c4948 kubectl: rewrite docstrings in several files
Fixing inaccuracies and clarifying in the case of ambiguities.
2017-06-23 09:49:30 -07:00
Alexander Campbell d29560d89a kubectl: rename Run() -> RunRun() to clarify purpose
Run() is too overloaded in the codebase already. The other commands have
a pattern of RunExpose, RunScale, and so on. Since the command name is
"run", the associated function should be called RunRun.
2017-06-23 09:49:30 -07:00
Kubernetes Submit Queue ae9ca46927 Merge pull request #47694 from FengyunPan/display-service-type
Automatic merge from submit-queue (batch tested with PRs 47694, 47772, 47783, 47803, 47673)

Output TYPE for getting service

**What this PR does / why we need it**:
Now service already supported 4 ServiceTypes, ServiceTypes is
friendly to distinguish services, so outputing service type better
when running 'kubectl get service'.

**Release note**:
```release-note
  NONE
```
2017-06-23 08:29:23 -07:00
Kubernetes Submit Queue 60126b0ceb Merge pull request #47471 from crimsonfaith91/drain
Automatic merge from submit-queue (batch tested with PRs 46151, 47602, 47507, 46203, 47471)

deprecate created-by annotation for pod drain

**What this PR does / why we need it**: This PR deprecates created-by annotation for pod drain. This is required as we now have ControllerRef.

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

**Special notes for your reviewer**: This is the second PR for deprecating created-by annotation. Other PRs can be found here: https://github.com/kubernetes/kubernetes/pull/47469 , #47475 

**Release note**:

```release-note
```
2017-06-23 05:08:30 -07:00
Kubernetes Submit Queue 1864a2403c Merge pull request #46151 from verb/kubectl-featuregate
Automatic merge from submit-queue

Add alpha command to kubectl

Also allow new commands to disable themselves by returning a nil value. This can be used to disable commands based on feature gates.

**What this PR does / why we need it**: Method of enabling alpha functionality in kubectl

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

**Special notes for your reviewer**: Part of a discussion in #45922 with @pwittrock

**Release note**:

```release-note
NONE
```
2017-06-23 05:00:35 -07:00
Kubernetes Submit Queue 475f175e68 Merge pull request #46495 from zjj2wry/pdb
Automatic merge from submit-queue

add test for kubectl create pdb

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-06-23 01:00:17 -07:00
Kubernetes Submit Queue 625a980941 Merge pull request #46696 from xiangpengzhao/mark-deprecated-command
Automatic merge from submit-queue (batch tested with PRs 47227, 47119, 46280, 47414, 46696)

Mark deprecated info in short description of deprecated commands.

**What this PR does / why we need it**:
Mark deprecated commands in 'kubectl help'. See https://github.com/kubernetes/kubectl/issues/20

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-06-22 23:59:28 -07:00
xiangpengzhao aef9f38baf Remove service on termination when exec 'kubectl run' command with flags "--rm" and "--expose" 2017-06-23 11:36:40 +08:00
Chao Xu 60604f8818 run hack/update-all 2017-06-22 11:31:03 -07:00
Chao Xu 239613b521 manually fix kubectl openapi unit test 2017-06-22 11:31:02 -07:00
Chao Xu f2d3220a11 run root-rewrite-import-client-go-api-types 2017-06-22 11:30:59 -07:00
Chao Xu cde4772928 run ./root-rewrite-all-other-apis.sh, then run make all, pkg/... compiles 2017-06-22 11:30:52 -07:00
Chao Xu f4989a45a5 run root-rewrite-v1-..., compile 2017-06-22 10:25:57 -07:00
Jordan Liggitt e8b24679dc
Remove redirect verb parsing 2017-06-21 11:17:24 -04:00
FengyunPan f01f9a9035 Output TYPE for getting service
Now service already supported 4 ServiceTypes, ServiceTypes is
friendly to distinguish services, so outputing service type better
when running 'kubectl get service'.
2017-06-18 12:19:57 +08:00
Kubernetes Submit Queue 48d263d3bf Merge pull request #44282 from derekwaynecarr/fix-kubectl-logs
Automatic merge from submit-queue (batch tested with PRs 38751, 44282, 46382, 47603, 47606)

kubectl logs with label selector supports specifying a container name

**What this PR does / why we need it**:
Allows `kubectl logs` to take both a label selector and container name.  This allows me to fetch logs from pods by selector whose pods have multiple containers with a common name.  This is a common action when debugging components like the service-catalog that ship more than one container in their pod.  With this change, the following command lets me get logs for service-catalog.

```
$ kubectl logs -l app=sc-catalog-apiserver --namespace=service-catalog --container=apiserver
```
2017-06-16 18:05:48 -07:00
Jun Xiang Tee d76b08d154 deprecate created-by annotation for pod drain 2017-06-16 13:33:26 -07:00
Kubernetes Submit Queue c31893978b Merge pull request #45918 from juanvallejo/jvallejo/fix-kubectl-set-resources-local
Automatic merge from submit-queue

fix --local flag for kubectl commands

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

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

Fixes the `--local` flag for `kubectl set ...` sub-commands.
**As of the 1.7 release**, `PrinterForCommand` was updated to [use a mapper and typer for unstructured objects](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/util/factory_builder.go#L52), which further prevented the use of `--local` when there was no connection to an api server.


**before** (with no connection to a server)
```
$ kubectl set resources -f pod.json --limits=cpu=200m,memory=512Mi --local
error: unable to connect to a server to handle "pods": Get https://10.13.137.149:8443/api: dial tcp 10.13.137.149:8443: getsockopt: connection refused
```

**after** (with no connection to a server)
```
$ kubectl set resources -f pod.json --limits=cpu=200m,memory=512Mi --local
NAME              READY     STATUS    RESTARTS   AGE
mypod   0/1                 0          <unknown>
```

cc @smarterclayton @fabianofranz
2017-06-16 08:19:13 -07:00
Lee Verberne 01c7d129fb Create a kubectl alpha subcommand
Alpha commands can be added under `kubectl alpha` and are always
accessible (regardless of feature gates). If no alpha commands have been
defined then `alpha` is not displayed in `help`.
2017-06-16 07:09:21 +00:00
Kubernetes Submit Queue a36d9df224 Merge pull request #47450 from kargakis/fix-drain
Automatic merge from submit-queue (batch tested with PRs 47523, 47438, 47550, 47450, 47612)

Ignore 404s on evict

One of our upgrades failed with 
```
error: error when evicting pod \"boo-2-deploy\": pods \"boo-2-deploy\" not found"
```

@derekwaynecarr since you already fixed half of it 

cc: @kubernetes/sig-cli-bugs 

I failed terribly at adding a unit test mostly because draining involves discovery for the eviction API and the fake client stuff for discovery are far from functional - will spawn a separate issue about it.

fyi @jupierce

related: https://github.com/kubernetes/kubectl/issues/28
2017-06-15 18:54:06 -07:00
Kubernetes Submit Queue ef20034a04 Merge pull request #47204 from janetkuo/kubectl-apply-change-cause
Automatic merge from submit-queue (batch tested with PRs 47204, 46808, 47432, 47400, 47099)

Make kubectl apply add change-cause before patching

**What this PR does / why we need it**: We shouldn't patch the project with applied change, and then patch again with the change cause. Otherwise, DaemonSet change cause wouldn't be copied to its history (after the first patch, history will be created with the old change cause). 

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

**Special notes for your reviewer**: 
/assign @mengqiy 
@kubernetes/sig-apps-bugs @kubernetes/sig-cli-maintainers 

**Release note**:

```release-note
NONE
```
2017-06-14 17:13:54 -07:00
Kubernetes Submit Queue d067836030 Merge pull request #46852 from tnozicka/lookup-no-headers-safely
Automatic merge from submit-queue (batch tested with PRs 47470, 47260, 47411, 46852, 46135)

Lookup --no-headers flag safely in PrinterForCommand function

If this was invoked by a command that did not call AddPrinterFlags first, it ended up with fatal error on `GetFlagBool(cmd, "no-headers")`. This is causing a bug in OpenShift's command reusing this code and not actually having a flag `--no-headers`.
2017-06-14 12:52:24 -07:00
ymqytw b99e57149d fix env flag 2017-06-13 14:53:09 -07:00
Michail Kargakis 26d3eadb46
Ignore 404s on evict 2017-06-13 20:21:26 +02:00
juanvallejo d036686185
fix --local flag for `kubectl set` commands 2017-06-13 12:57:05 -04:00
Janet Kuo 03af5233bd Make kubectl apply add change-cause before patching 2017-06-12 23:49:42 -07:00
Tomas Nozicka eb139f4572 Lookup --no-headers flag safely in PrinterForCommand function 2017-06-12 17:30:26 +02:00
Kazuki Suda 11230907b3 Fix missing __kubectl_parse_config 2017-06-11 07:12:23 +09:00
Derek Carr 1dc4d77942 kubectl drain errors if pod is already deleted 2017-06-09 17:05:43 -04:00
Cao Shufeng a70ec5ba40 [trivial]fix function name in comment 2017-06-09 11:26:06 +08:00
Kubernetes Submit Queue 49866b864c Merge pull request #47013 from smarterclayton/fix_printer
Automatic merge from submit-queue (batch tested with PRs 47024, 47050, 47086, 47081, 47013)

Wrap HumanReadablePrinter in tab output unless explicitly asked not to

`kubectl get` was not properly aligning its output due to #40848 

Fixes an accidental regression. In general, we should not accept an incoming tabwriter and instead manage at a higher level. Fix the bug and add a comment re: future refactoring.
2017-06-07 16:53:47 -07:00
Sunil Arora f768a63fb0 Get cmd uses print-column extn from Openapi schema
Get command now uses metadata x-kubernetes-print-columns, if present, in Openapi schema
to format output for a resource. This functionality is guarded by a boolean
flag 'use-openapi-print-columns'.
2017-06-06 13:30:24 -07:00
Kubernetes Submit Queue 60e038054b Merge pull request #46727 from janetkuo/kubectl-valid-resources
Automatic merge from submit-queue (batch tested with PRs 46112, 46764, 46727, 46974, 46968)

Add controllerrevisions as valid resource in kubectl help

**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**: controllerrevisions is a new resource added in 1.7 @kubernetes/sig-cli-maintainers 

**Release note**:

```release-note
```
2017-06-06 03:17:43 -07:00
zhengjiajin 0d80fb52ba Fix comments 2017-06-06 18:01:23 +08:00
Clayton Coleman b1abedbc64
Wrap HumanReadablePrinter in tab output unless explicitly asked not to
Fixes an accidental regression. In general, we should not accept an
incoming tabwriter and instead manage at a higher level. Fix the bug and
add a comment re: future refactoring.
2017-06-05 22:06:38 -04:00
Kubernetes Submit Queue bdf9dc1620 Merge pull request #46144 from janetkuo/kubectl-rollout-ds
Automatic merge from submit-queue (batch tested with PRs 45871, 46498, 46729, 46144, 46804)

Implement kubectl rollout undo and history for DaemonSet

~Depends on #45924, only the 2nd commit needs review~ (merged)

Ref https://github.com/kubernetes/community/pull/527/

TODOs:
- [x] kubectl rollout history
  - [x] sort controller history, print overview (with revision number and change cause)
  - [x] print detail view (content of a history) 
    - [x] print template 
    - [x] ~(do we need to?) print labels and annotations~
- [x] kubectl rollout undo: 
  - [x] list controller history, figure out which revision to rollback to
    - if toRevision == 0, rollback to the latest revision, otherwise choose the history with matching revision
  - [x] update the ds using the history to rollback to 
    - [x] replace the ds template with history's
    - [x] ~(do we need to?) replace the ds labels and annotations with history's~
- [x] test-cmd.sh 

@kubernetes/sig-apps-pr-reviews @erictune @kow3ns @lukaszo @kargakis @kubernetes/sig-cli-maintainers 

--- 

**Release note**:

```release-note
```
2017-06-05 03:06:26 -07:00
xilabao 8fe8e4f106 fix parse pairs 2017-06-05 11:06:48 +08:00
Kubernetes Submit Queue 8929a73a6f Merge pull request #46758 from zhangxiaoyu-zidif/delete-unused-code
Automatic merge from submit-queue

Delete meaningless check

**What this PR does / why we need it**:
Delete meaningless check
The deleted check is redundant.

**Release note**:

```release-note
NONE
```
2017-06-03 22:11:01 -07:00
Kubernetes Submit Queue 64a4d23af2 Merge pull request #46706 from CaoShuFeng/unit-create-role
Automatic merge from submit-queue (batch tested with PRs 40760, 46706, 46783, 46742, 46751)

Fix unit test for kubectl create role

When expected err is not nil but error deos not happen, we should report error in unit test.
**Release note**:

```
NONE
```
2017-06-03 18:30:40 -07:00
Janet Kuo edabdac094 Implement kubectl rollout history and undo for DaemonSet 2017-06-03 17:10:57 -07:00
Kubernetes Submit Queue e837c3bbc2 Merge pull request #46388 from lavalamp/whitlockjc-generic-webhook-admission
Automatic merge from submit-queue (batch tested with PRs 46239, 46627, 46346, 46388, 46524)

Dynamic webhook admission control plugin

Unit tests pass.

Needs plumbing:
* [ ] service resolver (depends on @wfender PR)
* [x] client cert (depends on ????)
* [ ] hook source (depends on @caesarxuchao PR)

Also at least one thing will need to be renamed after Chao's PR merges.

```release-note
Allow remote admission controllers to be dynamically added and removed by administrators.  External admission controllers make an HTTP POST containing details of the requested action which the service can approve or reject.
```
2017-06-02 23:37:42 -07:00
Kubernetes Submit Queue 2629bf79f2 Merge pull request #46265 from waseem/printers-genericity
Automatic merge from submit-queue (batch tested with PRs 41563, 45251, 46265, 46462, 46721)

Denote if a printer is generic.

This fixes #38779.

This allows us to avoid case in which printers.GetStandardPrinter
returns nil for both printer and err removing any potential panics that
may arise throughout kubectl commands.

Please see #38779 and #38112 for complete context.
2017-06-02 19:53:40 -07:00
Kubernetes Submit Queue 97a5d37841 Merge pull request #40848 from smarterclayton/serverside_get
Automatic merge from submit-queue (batch tested with PRs 46432, 46701, 46326, 40848, 46396)

Add a server side Get operation

Implement proposal kubernetes/community#363

```release-note
The Kubernetes API supports retrieving tabular output for API resources via a new mime-type `application/json;as=Table;v=v1alpha1;g=meta.k8s.io`.  The returned object (if the server supports it) will be of type `meta.k8s.io/v1alpha1` with `Table`, and contain column and row information related to the resource.  Each row will contain information about the resource - by default it will be the object metadata, but callers can add the `?includeObject=Object` query parameter and receive the full object.  In the future kubectl will use this to retrieve the results of `kubectl get`.
```
2017-06-02 11:47:11 -07:00
Kubernetes Submit Queue b7a424fd06 Merge pull request #46701 from CaoShuFeng/unit_clusterrole_binding
Automatic merge from submit-queue (batch tested with PRs 46432, 46701, 46326, 40848, 46396)

add some unit tests for "kubectl create clusterrole"

#45809 adds support for non-resource-url to "kubectl create clusterrole"
This pr add some unit test for #45809 

**Release note**:

```
NONE
```
2017-06-02 11:47:04 -07:00
Kubernetes Submit Queue 54cf289467 Merge pull request #46432 from CaoShuFeng/can-i-non-resource-url
Automatic merge from submit-queue (batch tested with PRs 46432, 46701, 46326, 40848, 46396)

This change add nonResourceURL to kubectl auth cani

**Release note**:

```
support nonResourceURL to kubectl auth cani
```
2017-06-02 11:47:01 -07:00
zhangxiaoyu-zidif 02af4b31a6 Use t.Fatalf instead 2017-06-02 17:35:33 +08:00
Kubernetes Submit Queue 82245a1f06 Merge pull request #45980 from mengqiy/setElementOrder
Automatic merge from submit-queue

support setElementOrder

Implement [proposal](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/preserve-order-in-strategic-merge-patch.md).

Fixes #40373

```release-note
kubectl edit and kubectl apply will keep the ordering of elements in merged lists
```
2017-06-01 09:12:13 -07:00
Kubernetes Submit Queue 2269f5ca76 Merge pull request #43505 from zjj2wry/004
Automatic merge from submit-queue

unit test for kubectl config set-cluster

**What this PR does / why we need it**:
unit test for create cluster

**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**:
i want test secure mode,but CA path how set?

**Release note**:

```release-note
NONE
```
2017-06-01 05:16:02 -07:00
zhangxiaoyu-zidif d519800cf0 Delete meaningless check 2017-06-01 16:17:16 +08:00
xilabao fe4afa8643 allow output patch string in edit command 2017-06-01 14:53:17 +08:00
Daniel Smith d6e1140b5d Implement dynamic admission webhooks
Also fix a bug in rest client
2017-05-31 16:38:46 -07:00
ymqytw c3481b07d2 support setElementOrder 2017-05-31 15:08:25 -07:00
Janet Kuo 97ebcc8382 Add controllerrevisions as valid resource in kubectl help 2017-05-31 13:18:26 -07:00
Cao Shufeng a5865cfa1d Fix unit test for kubectl create role 2017-05-31 19:30:24 +08:00
Cao Shufeng fb8d78bec9 add some unit tests for "kubectl create clusterrole" 2017-05-31 17:43:15 +08:00
zhengjiajin 7a55b5663c Delete unuse err check 2017-05-31 15:45:03 +08:00
Waseem Ahmad 8442a118ea Denote if a printer is generic.
This fixes #38779.

This allows us to avoid case in which printers.GetStandardPrinter
returns nil for both printer and err removing any potential panics that
may arise throughout kubectl commands.

Please see #38779 and #38112 for complete context.

Add comment explaining adding handlers to printers.HumanReadablePrinter
also remove an unnecessary conversion of printers.HumanReadablePrinter
to printers.ResourcePrinter.
2017-05-31 13:02:23 +05:30
Kubernetes Submit Queue 9c7b59778c Merge pull request #46394 from alexandercampbell/write-help-messages-to-stdout
Automatic merge from submit-queue (batch tested with PRs 46394, 46650, 46436, 46673, 46212)

Write "kubectl options" help message to stdout, not stderr

Fix a very minor issue causing `kubectl` to write its help messages to `stderr` instead of `stdout`.

Try this:

`kubectl options | grep log`

It should print only the options related to logging, but right now it prints the entire help menu (since it's printing to stderr).

This patch brings us closer to unix convention and reduces user friction.

~~Another use case (if a user can't remember whether it's `-r` or `-R` for recursion):~~

~~`kubectl patch -h | grep recursive`~~

Update: this patch only affects `kubectl options`. The other commands are working as intended.

**Release note**:

```release-note
NONE
```
2017-05-31 00:14:00 -07:00
Kubernetes Submit Queue e97b72296f Merge pull request #46556 from mbohlool/gvk
Automatic merge from submit-queue (batch tested with PRs 46076, 43879, 44897, 46556, 46654)

Use meta.v1 GroupVersionKind with json tags to generate OpenAPI spec

We are using two different GVK struct in generation of OpenAPI extensions. This PR unify that and also add json tags to meta.v1 GVK to comply with json naming system in other serializations. Also the value of Action extension is now lowercase.

ref: https://github.com/kubernetes/kubernetes/pull/46388
2017-05-30 23:20:04 -07:00
zhengjiajin 7c362f2f65 unit test for create cluster 2017-05-31 14:19:12 +08:00
Cao Shufeng 3bf3a031e8 This change add nonResourceURL to kubectl auth cani 2017-05-31 11:25:29 +08:00
Kubernetes Submit Queue f7215b7cdf Merge pull request #45755 from ahmetb/set-context-differentiate
Automatic merge from submit-queue (batch tested with PRs 42240, 46100, 46154, 46431, 45755)

Differentiate update/create message on set-context
2017-05-30 14:57:07 -07:00
Kubernetes Submit Queue 001513e9d0 Merge pull request #46100 from zjj2wry/hh
Automatic merge from submit-queue (batch tested with PRs 42240, 46100, 46154, 46431, 45755)

clean up: put test description in head to clear

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-05-30 14:56:59 -07:00
mbohlool a3cbfde4b1 Make OpenAPI GVK and Action extensions all lower-case 2017-05-30 14:43:27 -07:00
Kubernetes Submit Queue 1889d654f5 Merge pull request #46114 from arthur0/rename_context
Automatic merge from submit-queue (batch tested with PRs 46489, 46281, 46463, 46114, 43946)

Add `kubectl config rename-context`

Add `kubectl config rename-context`

This command allows renaming a context, instead of editing manually in .kubeconfig

Fix https://github.com/kubernetes/kubernetes/issues/45131

```release-note
Add `kubectl config rename-context`
```
2017-05-30 11:59:07 -07:00
Kubernetes Submit Queue 69c4a8ff0c Merge pull request #46281 from zjj2wry/err
Automatic merge from submit-queue (batch tested with PRs 46489, 46281, 46463, 46114, 43946)

add error info

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-05-30 11:59:02 -07:00
Kubernetes Submit Queue a07298ce54 Merge pull request #46608 from fabianofranz/fixes_kubectl_cache_on_windows
Automatic merge from submit-queue (batch tested with PRs 46552, 46608, 46390, 46605, 46459)

Fixes kubectl cached discovery on Windows

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

The `kubectl` cached discovery makes use of `func (f *File) Chmod(mode FileMode) error` which is not supported and errors out on Windows, making `kubectl get` and potentially a number of other commands to fail miserably on that platform. `os.Chmod` by file name, on the other hand, does not error out and should be used instead.

**Release note**:

```release-note
NONE
```
@deads2k @brendandburns @kubernetes/sig-cli-pr-reviews
2017-05-30 08:41:54 -07:00
Kubernetes Submit Queue 4979ae4b86 Merge pull request #46074 from zjj2wry/set-image
Automatic merge from submit-queue (batch tested with PRs 45488, 45335, 45909, 46074, 46615)

add test for set image validation

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-05-30 03:47:02 -07:00
xiangpengzhao 7092307f5e
Mark deprecated info in short description of deprecated commands. 2017-05-30 15:43:50 +08:00
Clayton Coleman 7ce63eb608
Refactor printers to support rendering as a Table
Return tables from the server.
2017-05-29 18:30:10 -04:00
Fabiano Franz 5c4da128c3 Fixes kubectl cached discovery on Windows 2017-05-29 17:52:00 -03:00
Alexander Campbell 0d65d9594c cmd/options: `kubectl options` writes to `out` stream
Previous behavior was to write to stderr (thanks to the fallback system
in the Cobra library), which made it difficult to grep for flags.

For example:

	kubectl options | grep recursive
2017-05-28 11:23:44 -07:00
zhengjiajin 586ebdb337 add error info 2017-05-27 22:27:12 +08:00
Kubernetes Submit Queue 1720e20059 Merge pull request #46277 from zjj2wry/credentials
Automatic merge from submit-queue (batch tested with PRs 46252, 45524, 46236, 46277, 46522)

add test in create authinfo

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-05-26 19:48:01 -07:00
Kubernetes Submit Queue 72a398240c Merge pull request #46272 from zjj2wry/selector
Automatic merge from submit-queue (batch tested with PRs 46450, 46272, 46453, 46019, 46367)

add test for set selector

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-05-26 18:48:58 -07:00
Kubernetes Submit Queue 899b6c00ba Merge pull request #45809 from CaoShuFeng/non-resource-url-create-rolebinding
Automatic merge from submit-queue

support NonResourceURL for kubectl create clusterrole

Release note:
```release-note
add --non-resource-url to kubectl create clusterrole
```
2017-05-26 16:47:06 -07:00
Kubernetes Submit Queue f3406bfe16 Merge pull request #42256 from shiywang/edit
Automatic merge from submit-queue (batch tested with PRs 42256, 46479, 45436, 46440, 46417)

Add `kubectl apply edit-last-applied` subcommand

third command of https://github.com/kubernetes/community/pull/287
Fixes https://github.com/kubernetes/kubernetes/issues/44905
@pwittrock @AdoHe @ymqytw @kubernetes/sig-cli-feature-requests could you guys have an early review ? cause some of feature I'm not sure about, will add unit tests if you think it's ok.
2017-05-26 15:58:57 -07:00
Kubernetes Submit Queue 00acd84b28 Merge pull request #45645 from zjj2wry/kubectl-create-quota
Automatic merge from submit-queue (batch tested with PRs 46383, 45645, 45923, 44884, 46294)

Fix test not use test flags

**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**:
old code not use test.flags, now use it

**Release note**:

```release-note
```
2017-05-26 12:58:00 -07:00
Kubernetes Submit Queue 37e95db803 Merge pull request #45422 from suyogbarve/set_resources_test
Automatic merge from submit-queue

test case for set_resources

PR adds basic unit test for set_resources.go
2017-05-26 11:50:47 -07:00
Arthur Miranda 83fec5bafb Add `kubeclt config rename-context`
Enables renaming of a context via `kubectl`

Fix https://github.com/kubernetes/kubernetes/issues/45131
2017-05-26 15:49:30 -03:00
Bryan Boreham 219cebecf7 Don't print "running in local/dry-run mode..." at the top
because the user may be trying to pipe the output of this command as
the input to another. This makes `set subject` and `set resources`
consistent with all similar commands in this directory.

Signed-off-by: Bryan Boreham <bryan@weave.works>
2017-05-26 13:34:31 +00:00
zhengjiajin ba555314d3 add test for kubectl create pdb 2017-05-26 17:38:26 +08:00
Cao Shufeng 93e50b167e support NonResourceURL for kubectl create clusterrole 2017-05-26 10:07:44 +08:00
Shiyang Wang 4597658cb9 add `kubectl apply edit-last-applied` subcommand 2017-05-26 00:20:48 +08:00
zhengjiajin 98ee2463ec add test fot set selector 2017-05-24 13:08:43 +08:00
Kubernetes Submit Queue 8e87c02959 Merge pull request #46139 from monopole/removeDepOnPkgHelper
Automatic merge from submit-queue (batch tested with PRs 42042, 46139, 46126, 46258, 46312)

Remove kubectl's dependence on pkg/api/helper

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

Remove kubectl's dependence on pkg/api/helper, as part of
broader effort to isolate kubectl from the rest of k8s.
In this case, the code becomes private to kubectl; nobody else uses it.

**Which issue this PR fixes**

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

**Release note**:
```release-note
NONE
```
2017-05-23 19:42:59 -07:00
zhengjiajin 61e5b5815d Fix test not use test flags 2017-05-24 10:14:00 +08:00
zhengjiajin 802362007e add test in create authinfo 2017-05-24 10:01:45 +08:00
Anirudh 078f9566d9 PDB MaxUnavailable: kubectl changes 2017-05-23 07:18:44 -07:00
Kubernetes Submit Queue 4871f4a75b Merge pull request #45637 from xilabao/hide-api-version
Automatic merge from submit-queue

remove --api-version
2017-05-23 06:15:45 -07:00
Kazuki Suda feb8148796 Add statefulset to the completion candidates of kubectl scale 2017-05-23 21:17:33 +09:00
Kubernetes Submit Queue 644a544d62 Merge pull request #46062 from alexandercampbell/correct-deprecation-errors
Automatic merge from submit-queue (batch tested with PRs 46201, 45952, 45427, 46247, 46062)

kubectl: fix deprecation warning bug

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

Some kubectl commands were deprecated but would fail to print the
correct warning message when a flag was given before the command name.

	# Correctly prints the warning that "resize" is deprecated and
	# "scale" is now preferred.
	kubectl resize [...]

	# Should print the same warning but no warning is printed.
	kubectl --v=1 resize [...]

This was due to a fragile check on os.Args[1].

This commit implements a new function deprecatedCmd() that is used to
construct new "passthrough" commands which are marked as deprecated and
hidden.

Note that there is an existing "filters" system that may be preferable
to the system created in this commit. I'm not sure why the "filters"
array was not used for all deprecated commands in the first place.

**Release note**:

```release-note
NONE
```
2017-05-22 20:58:07 -07:00
Kubernetes Submit Queue c6cf666fa1 Merge pull request #45308 from fabianofranz/more_cmd_sanity_checks
Automatic merge from submit-queue (batch tested with PRs 46022, 46055, 45308, 46209, 43590)

More cli sanity verifications

Adds some more `kubectl` command sanity checks to improve consistency and avoid the need of code reviews for some of our CLI style and standards.

**Release note**:

```release-note
NONE
```
@kubernetes/sig-cli-pr-reviews
2017-05-22 19:59:59 -07:00
Kubernetes Submit Queue 199465c3a5 Merge pull request #43663 from shiywang/quato
Automatic merge from submit-queue (batch tested with PRs 38990, 45781, 46225, 44899, 43663)

Fix command exec -- COMMAND can not contain spaces

Fixes https://github.com/kubernetes/kubernetes/issues/7688
the problem is when you execute command:
 `cluster/kubectl.sh exec -p client-blue-8yw37 -c client -i -t -- 'ls -t /usr'`
the args is 
[`client-blue-8yw37` , `ls -t /usr`] 
**instead of** 
[`client-blue-8yw37`, `ls`, `-t`, `/usr`]
@kubernetes/sig-cli-pr-reviews, so I add a warning, wdyt ?
cc @ymqytw @adohe @fabianofranz
2017-05-22 19:07:12 -07:00
Roberto J Rojas e24384643e kubectl: fixes issues #45736 and #45737
Adds long description from #45902
2017-05-22 18:57:11 -04:00
Alexander Campbell c9c8d61048 Merge branch 'master' into correct-deprecation-errors 2017-05-22 09:55:07 -07:00
Kubernetes Submit Queue cdbfec3148 Merge pull request #43501 from xingzhou/kube-43126
Automatic merge from submit-queue

Use TabWriter to keep output of "kubectl get xx -w" aligned.

Use TabWriter to keep output of "kubectl get xx -w" aligned.

fixed #43126
2017-05-22 00:22:40 -07:00
Jeffrey Regan 5a9b06b717 **What this PR does / why we need it**:
Remove kubectl's dependence on pkg/api/helper, as part of
broader effort to isolate kubectl from the rest of k8s.
In this case, the code becomes private to kubectl; nobody else uses it.

**Which issue this PR fixes**

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

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2017-05-21 20:44:21 -07:00
Fabiano Franz 18cb56bf78 kubectl plugins have access config, global flags and environment 2017-05-19 19:17:43 -03:00
Alexander Campbell 5e1a3fd020 kubectl: improve deprecatedAlias unit test
Two new behaviors are tested:

 1. The output message that deprecatedAlias gives when it is called must
    include the word "deprecatated" and the name of the new function
    that the user should use instead.
 2. The correct function must be called by the alias (alias should "fall
    back" to the functionality of the original.
2017-05-19 14:49:03 -07:00
Alexander Campbell ca899ec048 kubectl: write unit test for deprecatedAlias() 2017-05-19 11:25:11 -07:00
Alexander Campbell 2f0faedbee kubectl: make "Deprecated" a private function
There's no reason to export this function, so I've made it private.
2017-05-19 10:45:49 -07:00
Alexander Campbell bf2fc62144 kubectl: renmae deprecatedCmd -> deprecatedAlias
This will clear up some of the confusion around the deprecatedCmd /
Deprecated function.
2017-05-19 10:40:21 -07:00
Alexander Campbell b3fc6556e4 kubectl: improve docstring on deprecatedCmd 2017-05-19 08:55:12 -07:00
zhengjiajin ddcbc47f18 add test for set image validation 2017-05-19 12:15:49 +08:00
Waseem Ahmad 958a7113de Use variadic nature of *cobra.Command.AddCommand to add group of commands to a parent command
Rather than looping over commands in a group and add it one by one to a
parent command, use variadic nature of *cobra.Command.AddCommand to add
the group of commands to the parent.
2017-05-19 08:38:35 +05:30
xilabao e0b4f3f73c remove --api-version 2017-05-19 10:56:35 +08:00
Alexander Campbell 9e7f29c3fb cmd: fix deprecation warning bug
Some kubectl commands were deprecated but would fail to print the
correct warning message when a flag was given before the command name.

	# Correctly prints the warning that "resize" is deprecated and
	# "scale" is now preferred.
	kubectl scale [...]

	# Should print the same warning but no warning is printed.
	kubectl --v=1 scale [...]

This was due to a fragile check on os.Args[1].

This commit implements a new function deprecatedCmd() that is used to
construct new "passthrough" commands which are marked as deprecated and
hidden.

Note that there is an existing "filters" system that may be preferable
to the system created in this commit. I'm not sure why the "filters"
array was not used for all deprecated commands in the first place.
2017-05-18 16:48:13 -07:00
Fabiano Franz 3bb04c67cc More cli sanity verifications 2017-05-18 15:44:49 -03:00
zhengjiajin 9ecab7e20c clean up: put test description in head to locate quickly 2017-05-19 02:04:59 +08:00
Kubernetes Submit Queue 6e12c4cdbd Merge pull request #45890 from zjj2wry/xx
Automatic merge from submit-queue (batch tested with PRs 45977, 45890)

add test to cover more in kubectl create service

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
```
2017-05-17 15:39:04 -07:00
Kubernetes Submit Queue 4a9a702ee1 Merge pull request #45926 from MrHohn/api-annotations-move
Automatic merge from submit-queue

Move all API related annotations into annotation_key_constants.go

Separate from #45869. See https://github.com/kubernetes/kubernetes/pull/45869#discussion_r116839411 for details.

This PR does nothing but move constants around :)

/assign @caesarxuchao 

**Release note**:

```release-note
NONE
```
2017-05-17 10:34:53 -07:00
deads2k edd2d973a3 stop setting bad defaults that are indistinguishable from real values for clients 2017-05-17 07:18:34 -04:00
deads2k 75bd27a595 remove unnessary confusion of dead values 2017-05-17 07:15:29 -04:00
Zihong Zheng 5992425588 Autogenerated files 2017-05-16 21:55:51 -07:00
Zihong Zheng c0920f75cf Move API annotations into annotation_key_constants and remove api/annotations package 2017-05-16 21:55:23 -07:00
zhengjiajin 735e32ef83 add test to cover more in kubectl create service 2017-05-16 18:45:38 +08:00
Kubernetes Submit Queue 560323ad9b Merge pull request #45389 from monopole/isolation1
Automatic merge from submit-queue (batch tested with PRs 45835, 45389)

Introduce visibility rules to kubernetes code.

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

Use rules to identify "bad" dependencies on kubectl code for later refactoring or removal, and prevent their reintroduction.

**Which issue this PR fixes**

First in a series of PRs to address kubernetes/community#598

**Release note**:
```release-note
NONE
```
2017-05-15 19:34:52 -07:00
Chao Xu 36e2d0b4cb hack/update-bazal.sh
hack/update-godep-license
2017-05-15 13:51:39 -07:00
Chao Xu d9c2fbbf23 rely on staging/metrics instead of on
vendor/k8s.io/heapster/metrics/apis/metrics/v1alpha1

fix some related imports
2017-05-15 13:50:49 -07:00
Jeffrey Regan 7abff879d7 Introduce visibility rules to kubernetes code.
**What this PR does / why we need it**:

Visibility rules allow dependency control.  The rules currently in
place make all targets public, to override the default state of
private.  This PR removes public visibility from kubectl code.  It
uses specially named pacakge groups to identify "bad" dependencies on
kubectl code for later refactoring or removal.

**Which issue this PR fixes**

First in a series of PRs to address kubernetes/community#598

**Release note**:
```release-note
NONE
```
2017-05-15 12:50:56 -07:00
shiywang 6d44c8417d Fix command exec -- COMMAND can not contain spaces, update help information 2017-05-15 23:47:17 +08:00
Dmitry Shulyak 2612e0c78a Move client/unversioned/remotecommand to client-go
Module remotecommand originally part of kubernetes/pkg/client/unversioned was moved
to client-go/tools, and will be used as authoritative in kubectl, e2e and other places.

Module remotecommand relies on util/exec module which will be copied to client-go/pkg/util
2017-05-15 16:28:56 +03:00
Kubernetes Submit Queue ad6a9bb78e Merge pull request #44950 from xilabao/use-StringArrayVar-for-ResourceName
Automatic merge from submit-queue

use StringArrayVar for ResourceName

ref to https://github.com/kubernetes/kubernetes/pull/43903

```release-note
`kubectl create role` and `kubectl create clusterrole` no longer allow specifying multiple resource names as comma-separated arguments. Use repeated `--resource-name` arguments to specify multiple resource names. 
```
2017-05-14 19:39:52 -07:00
Ahmet Alp Balkan f39afd4eeb
Differentiate update/create message on set-context
kubectl config set-context prints the same message (Context %q set) for both
new and existing contexts. This patch helps differentiate whether an existing
context is modified or a new context is created.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
2017-05-12 18:22:02 -07:00
Kubernetes Submit Queue b4b5bfdb46 Merge pull request #45648 from karataliu/fixtmpdir
Automatic merge from submit-queue

Fix hardcoded tmp dir path in kubectl test.

**What this PR does / why we need it**:
Current case uses hardcoded tmp dir path, and it does not delete tmp dir after test run.

Which means 1. The case could not be run by different users (no permission) 2. /tmp dir keeps growing.

**Which issue this PR fixes** 

**Special notes for your reviewer**:

**Release note**:
2017-05-12 06:10:17 -07:00
Kubernetes Submit Queue 230d2473db Merge pull request #45698 from zjj2wry/nnn
Automatic merge from submit-queue (batch tested with PRs 45691, 45667, 45698, 45715)

testName to head

**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**:
testName in head, may be can quick location

**Release note**:

```release-note
```
2017-05-12 04:09:43 -07:00
Dong Liu 42f600870e Fix hardcoded tmp dir path in kubectl test. 2017-05-12 16:07:58 +08:00
xilabao 61e53998e5 ResourceName could possibly contain a comma should use StringArray, not StringSlice 2017-05-12 13:11:21 +08:00
Kubernetes Submit Queue ed4b25e46e Merge pull request #45406 from xilabao/fix-impersonate-in-create-role
Automatic merge from submit-queue

fix specialized verbs in create role
2017-05-11 20:18:12 -07:00
deads2k e91716a2db orphan when kubectl delete --cascade=false 2017-05-11 09:11:07 -04:00
zhengjiajin 77c207b424 small change to clear 2017-05-11 20:09:31 +08:00
xilabao 02deeb224e fix specialized verbs in create role 2017-05-11 09:32:43 +08:00
Alexander Staubo 4f8cbc15ac kubectl: 'apply view-last-applied' must not use printf(), as this will cause format codes in the YAML/JSON to be interpreted. 2017-05-10 16:17:12 -04:00
Shiyang Wang d43f4bb3b6 refactor functions in editoptions.go to use less arguments 2017-05-10 16:46:04 +08:00
Kubernetes Submit Queue 148b5da60b Merge pull request #44746 from xiangpengzhao/fix-podpreset
Automatic merge from submit-queue

Add support for PodPreset in `kubectl get` command

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

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

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2017-05-09 21:16:17 -07:00
xiangpengzhao baafbf406e Add support for PodPreset in kubectl get command 2017-05-10 08:59:22 +08:00
Kubernetes Submit Queue ceff8d8d4d Merge pull request #45320 from pwittrock/junit
Automatic merge from submit-queue (batch tested with PRs 45508, 44258, 44126, 45441, 45320)

Print a newline after ginkgo tests so the test infra doesn't think th…

Fixes #45279

Print a newline after ginkgo tests so the test infra doesn't think that they fail

```release-note
NONE
```
2017-05-08 16:34:48 -07:00
Suyog Barve 89ffe55c52 test case for set_resources
test case for set_resources updated BUILD file

update BUILD file as per update-bazel.sh
2017-05-05 19:46:57 -05:00
mbohlool ea042c6ca0 Update go-restful dependency 2017-05-05 13:57:01 -07:00
Kubernetes Submit Queue cc1f9f7254 Merge pull request #44740 from ravisantoshgudimetla/kubectl_taints_label_selector#44522
Automatic merge from submit-queue

Kubectl taint node based on label selector

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes  #44522
**Release note**:
```
Taints the node based on label selector
```
2017-05-05 09:25:02 -07:00
Kubernetes Submit Queue 4e74c43e9a Merge pull request #43436 from xilabao/add-set-rolebinding-command
Automatic merge from submit-queue

add set rolebinding/clusterrolebinding command

add command to set user/group/serviceaccount in rolebinding/clusterrolebinding /cc @liggitt @deads2k
2017-05-05 07:21:58 -07:00
xilabao 20876757c2 add set rolebinding/clusterrolebinding command 2017-05-05 09:55:35 +08:00
Phillip Wittrock 83ff8f2d6c Print a newline after ginkgo tests so the test infra doesn't think that they fail
Fixes #45279
2017-05-04 16:20:53 -07:00
Chao Xu bbb94e42c1 remove registry from testing/fixture.go; update client-gen to not use
registry in the generated clients
2017-05-04 11:30:51 -07:00
Suyog Barve 05131c627f use of --local should completely eliminate communication with API server
fix testcase use of --local should completely eliminate communication with API server
2017-05-03 15:57:57 -05:00
Kubernetes Submit Queue 4ff9234eec Merge pull request #44908 from suyogbarve/proxybug
Automatic merge from submit-queue

allow kubectl proxy to handle specified reject methods and default to…

What this PR does / why we need it:
"kubect proxy" command had a bug and was not supporting feature to reject http methods
--reject-methods='POST,PUT,PATCH'
this was due to missing filter for RejectMethods in kubectl/cmd/proxy.go
This PR adds the desired flag, however to retain the current behaviour of "kubectl proxy" the Default Rejected methods are changed from 'POST,PUT,PATCH' to '^$' i.e. none.

Issue not created and no existing issue found
2017-05-03 08:55:18 -07:00
Dr. Stefan Schimanski 20df61009d Get rid of meta.KindToResource in rollingupdate 2017-05-03 09:49:02 +02:00
Cao Shufeng de3db1eec3 add subresource support to kube auth can-i
Eg:
    kubectl auth can-i get pods --subresource=log
2017-05-02 12:08:20 +08:00
Suyog Barve f3a7ac4311 allow kubectl proxy to handle specified reject methods and default to allow all 2017-04-29 21:10:52 -05:00
Kubernetes Submit Queue 3a2a01bddc Merge pull request #44930 from fabianofranz/issue_44832
Automatic merge from submit-queue (batch tested with PRs 44044, 44766, 44930, 45109, 43301)

Fixes get -oname for unstructured objects

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

Make sure we display kind in `kubectl get -o name` for unknown resource types.

**Release note**:

```release-note
NONE
```
2017-04-28 17:49:10 -07:00
Kubernetes Submit Queue 0afab578d8 Merge pull request #44952 from CaoShuFeng/proxy_reject_path
Automatic merge from submit-queue

Log warning when invalid dir passed to kubectl proxy --www

**Release note**:

```
Log warning when invalid directory is passed to `kubectl proxy --www`
```
2017-04-28 14:00:20 -07:00
Kubernetes Submit Queue d4ece0abc3 Merge pull request #37499 from fabianofranz/kubectl_plugins
Automatic merge from submit-queue

kubectl binary plugins

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

Introduces the ability to extend `kubectl` by adding third-party plugins that will be exposed through `kubectl`.

Plugins are executable commands written in any language. To be included as a plugin, a binary or script file has to

1. be located under one of the supported plugin path locations:
1.1 `~/.kubectl/plugins` dir
1.2. one or more directory set in the `KUBECTL_PLUGINS_PATH` env var
1.3. the `kubectl/plugins` dir under one or more directory set in the `XDG_DATA_DIRS` env var, which defaults to `/usr/local/share:/usr/share`
2. in any of the plugin path above, have a subfolder with the plugin file(s)
3. in the subfolder, contain at least a `plugin.yaml` file that describes the plugin

Example:

```
$ cat ~/.kube/plugins/myplugin/plugin.yaml
name: "myplugin"
shortDesc: "My plugin's short description"
command: "echo Hello plugins!"

$ kubectl myplugin
Hello plugins!
```

~~In case the plugin declares `tunnel: true`, the plugin engine will pass the `KUBECTL_PLUGIN_API_HOST` env var when calling the plugin binary. Plugins can then access the Kube REST API in "http://$KUBECTL_PLUGIN_API_HOST/api" using the same context currently in use by `kubectl`.~~

Test plugins are provided in `pkg/kubectl/plugins/examples`. Just copy (or symlink) the files to `~/.kube/plugins` to test.

**Which issue this PR fixes**:

Related to the discussions in the proposal document: https://github.com/kubernetes/kubernetes/pull/30086 and https://github.com/kubernetes/community/pull/122.

**Release note**:
```release-note
Introduces the ability to extend kubectl by adding third-party plugins. Developer preview, please refer to the documentation for instructions about how to use it.
```
2017-04-28 12:23:59 -07:00
Fabiano Franz 1aa84d101a Fixes get -oname for unstructured objects 2017-04-28 14:12:36 -03:00
Kubernetes Submit Queue d6fd997d44 Merge pull request #41530 from bruceauyeung/k8s-branch-do-not-use-underscores-in-go-variable-names
Automatic merge from submit-queue

rename variables to make sure that they conform to golang variable name conventions

rename variables to make sure that they conform to golang variable name conventions

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

there are lots of package level unexported variables in package `cmd` not conforming golang variable name conventions, such as `version_example`, in this PR i rename all of them to make sure that they conform to golang variable name conventions
2017-04-28 09:28:13 -07:00
ravisantoshgudimetla 081ba02fa5 Changes to kubectl taint to respect selector flag 2017-04-28 10:28:26 -04:00
Fabiano Franz 2158473474 Plugins are loaded under the 'kubectl plugin' command 2017-04-28 01:34:07 -03:00
Fabiano Franz 2b178ad608 Basic support for kubectl plugins 2017-04-28 01:34:07 -03:00
Kubernetes Submit Queue 65838085b0 Merge pull request #43618 from xilabao/fix-kubectl-run-output
Automatic merge from submit-queue (batch tested with PRs 44970, 43618)

fix kubectl run output

fixes https://github.com/kubernetes/kubernetes/issues/40440
2017-04-26 22:58:13 -07:00
Kubernetes Submit Queue 433aec11c8 Merge pull request #44531 from pwittrock/kubectl-openapi
Automatic merge from submit-queue

OpenAPI support for kubectl

Support for openapi spec in kubectl.

Includes:
- downloading and caching openapi spec to a local file
- parsing openapi spec into binary serializable datastructures (10x faster load times 600ms -> 40ms)
- caching parsed openapi spec in memory for each command

```release-note
NONE
```
2017-04-26 16:59:17 -07:00
Cao Shufeng 3cfaf3049b Log warning when invalid dir passed to kubectl proxy --www 2017-04-26 17:53:54 +08:00
Kubernetes Submit Queue b7f890fc96 Merge pull request #44607 from supereagle/update-kubectl-apply-doc
Automatic merge from submit-queue (batch tested with PRs 44607, 44472, 44482)

update kubectl apply doc for required resource name

**What this PR does / why we need it**:
Update kubectl apply doc to illustrate that the resource name is required.

**Which issue this PR fixes** : fixes #44501

**Special notes for your reviewer**:
@liggitt @adohe @jayunit100

**Release note**:

```release-note
```
2017-04-25 14:47:37 -07:00
Phillip Wittrock 21e239fb82 kubectl OpenAPI bazel updates 2017-04-25 10:45:50 -07:00
Phillip Wittrock 212c2a3a72 kubectl OpenAPI support 2017-04-25 10:45:49 -07:00
Kubernetes Submit Queue 1fd19f7fa2 Merge pull request #42477 from jsafrane/v1-2-new-api
Automatic merge from submit-queue (batch tested with PRs 42477, 44462)

Use storage.v1 instead of v1beta1

storage.v1beta1 was used to work around GKE which did not expose v1. Now that GKE is updated, we can switch everything to v1.

This is simple sed v1beta1 -> v1 + enabled a new test + changed preference of exposed interfaces in `storage/install/install.go`.

@msau42, PTAL and let me know when GKE is updated with storage v1 API and this PR can be actually merged.

@kubernetes/sig-storage-pr-reviews 

```release-note
NONE
```
2017-04-25 10:25:44 -07:00
Kubernetes Submit Queue 51fe7d2ba1 Merge pull request #44693 from xilabao/remove-incorrect-validate-in-create-role
Automatic merge from submit-queue

remove resourcename validation in create role

@liggitt Since #44659 is not correct. I think we should fix the validation in create role command.
2017-04-25 08:13:36 -07:00
supereagle d9d2a72d9c update kubectl apply doc for required resource name 2017-04-25 19:22:08 +08:00
Jan Safranek 9d0c47f1db Use storage.v1 instead of v1beta1
storage.v1beta1 was used to work around GKE which does not expose v1. Now that
GKE is updated, we can switch everything to v1.
2017-04-25 10:13:38 +02:00
bruceauyeung ab4029c85b Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
rename variables to make sure that they conform to golang variable name convention
2017-04-25 15:07:01 +08:00
Kubernetes Submit Queue f4b1968b91 Merge pull request #44207 from shiywang/hotfix
Automatic merge from submit-queue

Add --all support for view-last-applied 

Fixes https://github.com/kubernetes/kubernetes/issues/44195
sorry for my careless, and thanks for the review, @ymqytw ptal
2017-04-24 20:25:48 -07:00
Kubernetes Submit Queue 390e98721f Merge pull request #42241 from xiangpengzhao/shortname-np
Automatic merge from submit-queue (batch tested with PRs 44862, 42241, 42101, 43181, 44147)

Add short name "netpol" for networkpolicies

**What this PR does / why we need it**:
Add short name for `networkpolicies` in kubectl command for good user experience.

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

**Special notes for your reviewer**:
None

**Release note**:

```release-note
Add short name "netpol" for networkpolicies
```
2017-04-24 19:39:40 -07:00
xilabao 7bd9ddef60 remove resourcename validation in create role 2017-04-25 09:22:02 +08:00
Kubernetes Submit Queue ed539fb76f Merge pull request #39404 from adohe/refactor_edit
Automatic merge from submit-queue

add EditOptions to make edit reusable

FYI. Added `EditOptions` to decouple edit implementation from cobra command, thus make edit reusable. Once this get merged, we can refactor `create` commands to put them in their own package. @kubernetes/sig-cli-misc please give a quick review, and I would like to get this merged asap.
2017-04-24 16:20:39 -07:00
Kubernetes Submit Queue b26d902070 Merge pull request #43517 from zjj2wry/007
Automatic merge from submit-queue

unit test for kubectl config set

**What this PR does / why we need it**:
unit test for kubectl config set

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

**Release note**:

```release-note
```
2017-04-24 06:27:52 -07:00
xilabao 19217bc4a2 support subresource when running kubectl create role 2017-04-24 10:05:47 +08:00
Kubernetes Submit Queue e7ca665a0d Merge pull request #43896 from CaoShuFeng/list-meta
Automatic merge from submit-queue

Reorganize the output of "kubectl get -o json"

"resourceVersion" and "selfLink" are members of "metadata" rather than
the list. This change reorganize the struct to provide consistency with
other places.

Before this change:
```json
    "kind": "List",
    "metadata": {},
    "resourceVersion": "",
    "selfLink": ""
```
After this change:
```json
    "kind": "List",
    "metadata": {
        "resourceVersion": "",
        "selfLink": ""
    }
```

Reference:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go#L57



**Release note**:

```release-note
NONE
```
2017-04-23 10:14:41 -07:00
Kubernetes Submit Queue c289286647 Merge pull request #42612 from CaoShuFeng/create_role_trival
Automatic merge from submit-queue

add "bind" to validResourceVerbs in "create role" cli 

"bind" and "impersonate" are also a legal verbs according this:
https://github.com/kubernetes/kubernetes.github.io/pull/2771/files
**Release note**:

```NONE
```
2017-04-22 12:18:00 -07:00
Kubernetes Submit Queue af57b82bfc Merge pull request #40784 from adamreese/fix/clientcache-threadsafe
Automatic merge from submit-queue (batch tested with PRs 42202, 40784, 44642, 44623, 44761)

make kubectl clientcache thread safe

**What this PR does / why we need it**:
Prevent panics when accessing kubectl client cache concurrently.

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

https://github.com/kubernetes/helm/issues/1879
2017-04-21 11:52:05 -07:00
Kubernetes Submit Queue f613e66ad6 Merge pull request #44543 from xilabao/fix-warning-in-auth
Automatic merge from submit-queue

remove warning infomation when using '*'

```
#kubectl auth can-i "*" "*"
Warning: the server doesn't have a resource type '*'
yes
```
2017-04-21 10:12:56 -07:00
shiywang 03a58ceeaa Add --all support for view-last-applied 2017-04-21 08:45:30 +08:00
Kubernetes Submit Queue 2c6fbc95c4 Merge pull request #43171 from ravisantoshgudimetla/kubectl_taints_ux
Automatic merge from submit-queue

Refactoring reorganize taints function in kubectl to expose operations

**What this PR does / why we need it**:
This adds some UX functionality when specifying taints using kubectl.
For example:
```
./kubectl.sh taint nodes XYZ dedicated1=abca2:NoSchedule 
node "XYZ" tainted
 ./kubectl.sh taint nodes XYZ dedicated1=abca1:NoSchedule --overwrite=True
node "XYZ overwritten
./kubectl.sh taint nodes XYZ dedicated1-
node "XYZ" untainted
./kubectl.sh taint nodes XYZ dedicated=abca1:NoSchedule dedicated1-
node "XYZ" modified
```
**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #43167 

**Release note**:
```
Fixed the output of kubectl taint node command with minor improvements.
```
2017-04-20 04:17:18 -07:00
Adam Reese 15fa01410b make kubectl clientcache thread safe 2017-04-18 15:31:52 -07:00
Kubernetes Submit Queue fab2f5e3af Merge pull request #44267 from zjj2wry/005-f
Automatic merge from submit-queue (batch tested with PRs 43000, 44500, 44457, 44553, 44267)

add kubectl config view test code

**What this PR does / why we need it**:
kubectl config view test code

**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**:
think you very much :)

**Release note**:

```release-note
```
2017-04-18 13:19:12 -07:00
Kubernetes Submit Queue 1ee8f2f543 Merge pull request #44088 from xingzhou/kube-44069
Automatic merge from submit-queue

Fixed `kubectl cluster-info dump` to support multi-container pod.

Fixed `kubectl cluster-info dump` to support multi-container pod.

**Release note**:
```
Improve `kubectl cluster-info dump` to support multi-container pod information dump.
```

Fixed #44069
2017-04-18 07:42:14 -07:00
AdoHe 5ed1ab66a2 refactor edit to remove cobra dependency and also make it reusable 2017-04-18 20:44:25 +08:00