Commit Graph

1724 Commits (f67ecd73f7581fb27644af57ab0c775da7f8ab93)

Author SHA1 Message Date
deads2k 500cddc5c3 use discovery restmapper for kubectl 2016-09-15 10:26:39 -04:00
juanvallejo 52fc8efa55 update PrintSuccess message when using --dry-run 2016-09-15 10:11:21 -04:00
Dr. Stefan Schimanski 54f5a9b423 Disable swagger spec caching without /version 2016-09-14 18:44:46 +02:00
Brendan Burns 23c7c2e3e7 Add namespace error checking if a resource is not found. 2016-09-14 06:51:36 -07:00
Kubernetes Submit Queue 33e5b0e0db Merge pull request #32504 from kargakis/top-pod-fixes
Automatic merge from submit-queue

kubectl: run validation for 'top pod'

@mksalawa @kubernetes/kubectl
2016-09-14 05:35:42 -07:00
Kubernetes Submit Queue 630c7532c6 Merge pull request #32274 from ping035627/ping035627-patch-0908
Automatic merge from submit-queue

Change all jsonmerge to strategicpatch

Implement all jsonmerge changed to strategicpatch in edit.go.
2016-09-13 01:15:52 -07:00
Kubernetes Submit Queue ba3ab80b09 Merge pull request #32060 from lojies/addaliasdeploy
Automatic merge from submit-queue

add alias deploy for deployment

deploy is also alias of deployment. add alias deploy for deployment so the help can see deploy in the Aliases like below:
```sh
k8s@k8s-node1:~/go/workspace/src/k8s.io/kubernetes/cmd/kubectl$ ./kubectl create dep -h
Create a deployment with the specified name.

Aliases:
deployment, dep, deploy
```
2016-09-13 00:29:31 -07:00
Kubernetes Submit Queue 8f2f836e4e Merge pull request #32106 from jellonek/fd_leaks
Automatic merge from submit-queue

Ensure that we are closing files.

**What this PR does / why we need it**: In several places we are leaking file descriptors. This could be problematic on systems with low ulimits for them.

**Release note**:
```release-note
```
2016-09-12 23:43:38 -07:00
ymqytw c67a62da49 Fixes #30562: Refactor kubectl command options to use common struct for common file params 2016-09-12 11:01:37 -07:00
Michail Kargakis 4787dca073 kubectl: run validation for 'top pod' 2016-09-12 19:20:46 +02:00
deads2k 519c13745f convert rest of kubectl to generated clients 2016-09-12 08:22:34 -04:00
deads2k f756e43e7f convert rolling updater to generated client 2016-09-12 07:38:34 -04:00
deads2k 9d43f7e52c convert more command to use a generated clientset 2016-09-12 07:38:34 -04:00
Piotr Skamruk dc3674c8d0 Ensure that we are closing files. 2016-09-12 09:33:24 +02:00
Kubernetes Submit Queue 0f14ede4ed Merge pull request #32174 from lojies/usededentforcreatequota
Automatic merge from submit-queue

use dedent for create_quota.go
2016-09-12 00:08:05 -07:00
Kubernetes Submit Queue 19364c2d3b Merge pull request #32222 from juanvallejo/jvallejo_bugfix/single-resource-prefix-kubectl-get-all
Automatic merge from submit-queue

print resource kind prefix when `kubectl get all` has single type to display

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

This patch forces the HumanReadablePrinter to display resource kind
prefixes when there is only one type of resource to show and a specific
resource type has not been specified as an argument to kubectl get

`$ kubectl get all`
```
NAME         CLUSTER-IP   EXTERNAL-IP   PORT(S)                 AGE
kubernetes   172.30.0.1   <none>        443/TCP,53/UDP,53/TCP   2m
```

`$ kubectl get all`
```
NAME         CLUSTER-IP   EXTERNAL-IP   PORT(S)                 AGE
svc/kubernetes   172.30.0.1   <none>        443/TCP,53/UDP,53/TCP   2m
```
2016-09-11 19:39:17 -07:00
Kubernetes Submit Queue a7571aa367 Merge pull request #32230 from juanvallejo/jvallejo_update-kubectl-expose-output-to-usage-error
Automatic merge from submit-queue

update `kubectl expose` output to UsageError

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

This patch updates `kubectl expose` output (with no resources provided)
to a UsageError so that the `kubectl expose -h` suggestion is displayed.

##### Before
`$ kubectl expose`
```
error: You must provide one or more resources by argument or filename.
Example resource specifications include:
   '-f rsrc.yaml'
   '--filename=rsrc.json'
   'pods my-pod'
   'services'
```

##### After
```
error: You must provide one or more resources by argument or filename.
Example resource specifications include:
   '-f rsrc.yaml'
   '--filename=rsrc.json'
   'pods my-pod'
   'services'
See 'kubectl expose -h' for help and examples.
```
2016-09-11 16:20:22 -07:00
Kubernetes Submit Queue 27c5e5dca7 Merge pull request #31110 from AdoHe/rollout_dry_run
Automatic merge from submit-queue

Rollout dry run

**What this PR does / why we need it**: rollout undo add dry-run implementation

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

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```
rollout undo add dry-run option
```
2016-09-11 15:05:16 -07:00
Kubernetes Submit Queue b4c09192bc Merge pull request #31841 from fraenkel/replace_force
Automatic merge from submit-queue

Replace force

fixes #28115
2016-09-11 14:27:30 -07:00
Kubernetes Submit Queue 5cb9b3a3b7 Merge pull request #32176 from lojies/addaliasforcreateservice
Automatic merge from submit-queue

add alias svc for create_service.go

add alias 'svc' for service in create_service.go so that  alias 'svc'  can be used and also can be seen in help message's Aliases like below:
```shell
$ kubectl create svc -h
Create a service using specified subcommand.

Aliases:
service, svc

Available Commands:
  clusterip    Create a clusterIP service.
  loadbalancer Create a LoadBalancer service.
  nodeport     Create a NodePort service.

Usage:
  kubectl create service [options]
```
2016-09-11 12:25:33 -07:00
Kubernetes Submit Queue 64f5d9c3f4 Merge pull request #32092 from asalkeld/get-strange-output
Automatic merge from submit-queue

Improve the get output for completed pods

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

- rename FinishPrint() to AfterPrint()
- add a newline to separate it from the table
- remove the "objects" and ()
- assume plural

**Which issue this PR fixes** 
fixes #31160

**Special notes for your reviewer**:
None

**Release note**:
```release-note
Improve the get output for completed pods
```
2016-09-11 06:22:03 -07:00
Kubernetes Submit Queue dd9d5aa27d Merge pull request #32378 from kevin-wangzefeng/update-taints-e2e
Automatic merge from submit-queue

update taints e2e, restrict taints operation with key, effect

Since taints are now unique by key, effect on a node, this PR is to restrict existing taints adding/removing/updating operations in taints e2e.
Also fixes https://github.com/kubernetes/kubernetes/issues/31066#issuecomment-242870101
Related prior Issue/PR #29362 and #30590
2016-09-10 13:20:51 -07:00
Kubernetes Submit Queue f9e1ef97db Merge pull request #30717 from juanvallejo/jvallejo_add-oc-describe-help-suggestion
Automatic merge from submit-queue

add suggestion to use `describe` to obtain container names

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

Commands with the `--container=` option provide no suggestions to a user
on how to obtain a container's name from a pod.

This patch adds a suggestion on the usage output to use the `describe`
command on a pod to obtain the container value that is passed to the
`--container=` flag.

`$ kubectl exec -h`
```
Execute a command in a container.

Examples:

kubectl exec 123456-7890 date

kubectl exec 123456-7890 -c ruby-container date

kubectl exec 123456-7890 -c ruby-container -i -t -- bash -il

Flags:
  -c, --container string   Container name. If omitted, the first container in the pod will be chosen. Use the 'describe' command to find the list of containers on a pod.
  -p, --pod string         Pod name
  -i, --stdin              Pass stdin to the container
  -t, --tty                Stdin is a TTY
2016-09-10 12:02:10 -07:00
Kubernetes Submit Queue e4ca861892 Merge pull request #31598 from ping035627/ping035627-patch-0829
Automatic merge from submit-queue

Return all the invalid flags for rollingupdate

It had better to return all the invalid flags for the "validateArguments" function, so the user can modify them at once.
2016-09-10 11:26:23 -07:00
Kubernetes Submit Queue bb51525d0d Merge pull request #31212 from YuPengZTE/printf
Automatic merge from submit-queue

It is better to add "\n" in printf

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

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

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

**Special notes for your reviewer**:

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

Return all the invalid parameters for set_image

Suggest returning all the invalid parameters for "ImageOptions.Validate()" in set_image.go.
2016-09-10 09:26:25 -07:00
Kubernetes Submit Queue 099d47f0eb Merge pull request #31089 from ping035627/ping035627-patch-0822
Automatic merge from submit-queue

Optimise the DefaultGenerators function

It needn't define all the generators in the "DefaultGenerators" function, it just return the "cmdName" generator, the others is redundant.
2016-09-10 07:43:02 -07:00
Kubernetes Submit Queue 97ec720a19 Merge pull request #32152 from deads2k/client-02-make-clientset
Automatic merge from submit-queue

add ClientSet to factory to remove non-generated client

We should move to using generated clients in the `kubectl` client.  We should really move to generated external clients, but this at least moves away from using manually created clients.

@fabianofranz @mfojtik When I complete this work (move the other commands and eliminate the old API), this will ripple downstream.
2016-09-10 01:59:02 -07:00
Kubernetes Submit Queue 8b5317bf87 Merge pull request #32141 from deads2k/client-01-fix-swagger
Automatic merge from submit-queue

make swaggerschema agnostic about which version to use

`Factory.SwaggerSchema` was reliant on having a non-generated client bits filled in so that it could get the adapted client it wanted.  There's no need since discovery ignores configured GroupVersions.  This eliminates the unneeded dependency.
2016-09-09 22:27:52 -07:00
Kevin fff139ce32 update taints e2e, respect that taint is unique by key, effect 2016-09-09 19:15:11 +08:00
PingWang 121f6fb289 change all jsonmerge to strategicpatch
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

update preconditions define

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-09-09 08:28:10 +08:00
Kubernetes Submit Queue d974051c47 Merge pull request #32177 from lojies/changesomeerrorcomment
Automatic merge from submit-queue

fix some error comment in create_service.go

some comments were error. mofify these to match the real.
2016-09-08 05:41:26 -07:00
Michael Fraenkel c036d28689 Wait until resource is deleted before creating 2016-09-08 08:37:11 -04:00
Michael Fraenkel 88e17d7478 Require force when using grace period or timeout 2016-09-08 07:45:20 -04:00
AdoHe 6a68dbdac4 rollout undo add dry-run implementation 2016-09-08 08:02:04 +08:00
Angus Salkeld ee298a80e9 Simplify the output in AfterPrint()
- Change FinishPrint() to AfterPrint()
  (As suggested in #31160)
- add a newline to separate it from the table
- remove the "objects" and ()
- assume plural
2016-09-08 09:42:17 +10:00
Michael Fraenkel fb4a466321 Save stderr since it may become nil 2016-09-07 19:01:59 -04:00
juanvallejo 8faff9f949
update `kubectl expose` output to UsageError
This patch updates `kubectl expose` output (with no resources provided)
to a UsageError so that the `kubectl expose -h` suggestion is displayed.
2016-09-07 17:20:09 -04:00
juanvallejo 59ba00f822
print resource kind prefix when `kubectl get all` has single type to display
This patch forces the HumanReadablePrinter to display resource kind
prefixes when there is only one type of resource to show and a specific
resource type has not been specified as an argument to kubectl get

`$ kubectl get all`
```
NAME         CLUSTER-IP   EXTERNAL-IP   PORT(S)                 AGE
kubernetes   172.30.0.1   <none>        443/TCP,53/UDP,53/TCP   2m
```

`$ kubectl get all`
```
NAME         CLUSTER-IP   EXTERNAL-IP   PORT(S)                 AGE
svc/kubernetes   172.30.0.1   <none>        443/TCP,53/UDP,53/TCP   2m
    ```
2016-09-07 16:12:34 -04:00
juanvallejo f8cc2ab3b8
add suggestion to use `describe` to obtain container names 2016-09-07 13:06:22 -04:00
deads2k 1d5e5532ed add ClientSet to factory to remove non-generated client 2016-09-07 09:44:01 -04:00
lojies 8b349ebfb0 fix some error comment in create_service.go 2016-09-07 10:14:50 +08:00
lojies c8fe895d5b add alias svc for create_service.go 2016-09-07 09:46:56 +08:00
lojies eaf257a993 use dedent for create_quota.go 2016-09-07 09:09:12 +08:00
deads2k aee962c0f2 make swaggerschema agnostic about which version to use 2016-09-06 14:16:02 -04:00
deads2k cd5b6cc491 move StorageClass to its own group 2016-09-06 08:41:17 -04:00
lojies b118db0a17 Use dedent for completion.go 2016-09-06 15:49:20 +08:00
Kubernetes Submit Queue 5e22e51f34 Merge pull request #31675 from brendandburns/msgs
Automatic merge from submit-queue

improve some error messages.

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

@pwittrock @deads2k 
@kubernetes/kubectl
2016-09-05 23:23:11 -07:00
Kubernetes Submit Queue 7d09f954c4 Merge pull request #31860 from lojies/adddeployforsetimage
Automatic merge from submit-queue

add deploy for deployment in kubectl set image help text

add shorthand deploy for deployment in kubectl set image help text
2016-09-05 22:44:53 -07:00
Kubernetes Submit Queue 1143107d8b Merge pull request #31857 from lojies/annotataresourcechange
Automatic merge from submit-queue

change annotate_resources to valid_resources

annotate_resources missing some resources such as deployment, namespace. 

i think using valid_resources to replace annotate_resources  more suitable.
2016-09-05 21:32:21 -07:00
Kubernetes Submit Queue 36a85cae7b Merge pull request #31764 from lojies/adddeploy
Automatic merge from submit-queue

add deploy for deployment in kubectl expose help text

add shorthand deploy for  deployment
2016-09-05 20:13:47 -07:00
lojies 8d9b537ac1 add alias deploy for deployment 2016-09-06 11:00:50 +08:00
Kubernetes Submit Queue 8d00825481 Merge pull request #31685 from jellonek/jell/29524
Automatic merge from submit-queue

kubectl edit: Do not add warning header if ftype is json.

This PR blocks adding warning header if `kubectl edit` is used with `-o json` option.
Fixed header contains comment (what is not supported by json standard) what can break utilities which are using libraries that conforms with http://www.ietf.org/rfc/rfc7159.txt

fixes #29524

/cc @pwittrock 

```release-note
Removed comments in json config when using kubectl edit with -o json
```
2016-09-05 19:35:31 -07:00
Kubernetes Submit Queue ae3b956c65 Merge pull request #31144 from ohmystack/fix/zsh-completion
Automatic merge from submit-queue

Fix named pipe in kubectl zsh completion

This PR fixes #28049

Though my zsh version > 5.0, I still got the problem. So, I think we need this fix.

---

### Env

```
OS: Ubuntu 14.04
$ zsh --version
zsh 5.0.2 (x86_64-pc-linux-gnu)
```

### A simple DEMO to show the root cause

In zsh and bash, a multi-line named pipe, who is wrapped by parenthesis, is possible to mismatch the "right parenthesis", even that parenthesis is in a here-document.

The following script was going to use `sed` to print the text in the 'BASH_COMPLETION_EOF' here-document. 
> * I made the `sed` simpler. As you can see, `sed` actually does nothing here. It just prints what it gets from `<<`). In real [`pkg/kubectl/cmd/completion.go`](https://github.com/kubernetes/kubernetes/blob/v1.3.5/pkg/kubectl/cmd/completion.go#L246-L258), `sed` will do some text replacement, changing bash functions to zsh functions. But that is not the point of the problem.
> * I use `cat <(...)` to replace the `source <(...)`.
> In this way, we can see how named pipe works.

run-bad.zsh:
```bash
#!/usr/bin/zsh
cat <(sed -e 's/foo/bar/g' <<'BASH_COMPLETION_EOF'
  aaa='aaa'
  case aaa in
    'aaa')      #  <- This ')' is in a here-document, but it is handled by named pipe by mistake.
      echo 'yes'
      ;;
  esac
BASH_COMPLETION_EOF
)
```

> Output:
> ```
> ./run-bad.zsh
>     aaa='aaa'
>     case aaa in
>       'aaa'yes     <- You can see the here-document `echo yes` has been executed!!!
> ./run-bad.zsh:8: parse error near `;;'
> ```

The named pipe `<(sed ...` "eats" the `)`, which should belong to `case aaa in 'aaa')`. So that the named pipe ends earlier than expectation. The left zsh code is broken, it fails.

### Here's the fix

Move the code into a function, and use an inline named pipe.

run.zsh:
```bash
#!/usr/bin/zsh

print_sed_result() {
  sed -e 's/foo/bar/g' <<'BASH_COMPLETION_EOF'
  aaa='aaa'
  case aaa in
    'aaa')
      echo 'yes'
      ;;
  esac
BASH_COMPLETION_EOF
}

cat <(print_sed_result)     # <- Use an inline named pipe
```

> Output:
> ```
> ./run.zsh                                                                                                                                                                    > stack@docker-dev01
>         aaa='aaa'
>         case aaa in
>           'aaa')
>             echo 'yes'
>             ;;
>         esac
> ```

Now, the here-document and named pipe work correctly.
2016-09-05 15:31:18 -07:00
Kubernetes Submit Queue cf7b033fbf Merge pull request #25810 from andreykurilin/kubectl_rollingupdate
Automatic merge from submit-queue

Add link to diagram of `kubectl rolling-update`
2016-09-05 14:15:45 -07:00
Clayton Coleman 5e6f5fee8a
Handle Stream() errors consistently in restclient
We should be following the same rules for Stream() as the normal body
request flow.

Also add slightly more output on a server error - in the future we may
want to clean this up but it's potentially hiding bad responses.
2016-09-04 14:50:04 -04:00
Kubernetes Submit Queue 17ee588c3e Merge pull request #31510 from mksalawa/kubectltop
Automatic merge from submit-queue

Print a message if metrics are not yet available.

**What this PR does / why we need it**:
It takes about 80s to gather first metrics for the newly created pod. We would like to indicate this to the user, so that they don't mistake it for the command failure.

In case no metrics are found, we check whether there should be any, and if yes, print the appropriate message to the user.

**Which issue this PR fixes**
#30826 

```release-note
NONE
```
2016-09-01 11:30:16 -07:00
Kubernetes Submit Queue c98a1e2416 Merge pull request #31333 from xingzhou/kube-25287
Automatic merge from submit-queue

Fixed incomplete kubectl bash completion.

Added bash completion for several kubectl commands.

Fixes #25287
2016-09-01 10:49:51 -07:00
PingWang 5a9848207a implement replace with a call to testapi.Codec()
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

delete comments

Signed-off-by: PingWang <wang.ping5@zte.com.cn>

update annotateRuntimeObject

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-09-01 17:34:54 +08:00
lojies ef87972835 add port validate when --port is set or --expose=true 2016-09-01 17:24:02 +08:00
lojies b50cef53eb add deploy for deployment in kubectl set image help text 2016-09-01 17:17:41 +08:00
lojies 479ddc8818 change annotate_resources to valid_resources 2016-09-01 16:33:51 +08:00
Brendan Burns d1fa7ff7a8 Address comments. 2016-08-31 21:16:46 -07:00
Kubernetes Submit Queue 3d30787abc Merge pull request #31719 from nikhiljindal/kubectlHelp
Automatic merge from submit-queue

Adding clusters to the list of valid resources printed by kubectl help

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

Adding clusters to the list of valid resources printed by kubectl help with a clear message that it only works when talking to federation apiserver.
In future, we should replace the hard coded list with a dynamic list generated using APIServer's discovery API.

```release-note
Adding clusters to the list of valid resources printed by kubectl help
```


cc @kubernetes/kubectl @kubernetes/sig-cluster-federation
2016-08-31 17:52:53 -07:00
Michael Fraenkel 9cff11dbb0 Finished pods can be drained
- Don't bother trying to filter pods that have succeeded or failed
2016-08-31 08:30:30 -04:00
mksalawa 87cba30aae Print message if metrics are not yet available. 2016-08-31 11:54:53 +02:00
nikhiljindal 0fcbde5ee1 Adding clusters to the list of valid resources printed in kubectl help 2016-08-30 18:57:35 -07:00
lojies 513f24f857 add deploy for deployment 2016-08-31 09:50:22 +08:00
Clayton Coleman 06cbb29e9e
ClientConfig should not default to http://localhost:8080
This changes clientcmd to skip the default cluster, but preserves the
behavior in kubectl. This prevents the possibility of an administrator
misconfiguration in kubelet or other server component from allowing a
third party who can bind to 8080 on that host from potentially
impersonating an API server and gaining root access.
2016-08-30 10:43:24 -04:00
Piotr Skamruk d0e59e0c22 kubectl: Do not add warning header if ftype is json. 2016-08-30 10:15:45 +02:00
Brendan Burns 155fb9f4be improve some error messages. 2016-08-29 22:27:22 -07:00
Xing Zhou 80d6cd0a40 Added bash completion for several kubectl commands.
This path added/fixed bash completion for several
kubectl commands.

Fixes #25287
2016-08-30 13:12:09 +08:00
PingWang 8ec61c1dce return all the invalid parameters for set_image
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-29 17:17:51 +08:00
PingWang 6ca2c36e71 return all the invalid flags for rollingupdate
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-29 15:11:01 +08:00
Kubernetes Submit Queue e24aff0711 Merge pull request #29821 from alexbrand/config-cluster
Automatic merge from submit-queue

Add get/delete cluster, delete context to kubectl config

Fixes #29794 by adding `get-clusters`, `delete-cluster` and `delete-context` actions to `kubectl config`.
2016-08-26 11:44:46 -07:00
Kubernetes Submit Queue dd42d95bab Merge pull request #31000 from mksalawa/fix_pods_from_all_namespaces
Automatic merge from submit-queue

Fix getting pods from all namespaces

**What this PR does / why we need it**:
Use Heapster handler for pods from all namespaces (added in the new version).

Depends on #30993
2016-08-26 03:19:39 -07:00
Kubernetes Submit Queue f73c684404 Merge pull request #31383 from janetkuo/run-attach-err
Automatic merge from submit-queue

Print to stderr when attach failed

@kubernetes/kubectl
2016-08-26 00:40:15 -07:00
YuPengZTE 83cdfba0e0 It is better to add "\n" in printf
Signed-off-by: YuPengZTE <yu.peng36@zte.com.cn>
2016-08-26 11:58:26 +08:00
Kubernetes Submit Queue c2f8c265b4 Merge pull request #30958 from lojies/addvalidresourceforexplain
Automatic merge from submit-queue

add valid resources when args is nil

add valid resources message is more friendly to user when running `kubectl explain`
and this also can be same with other cmd like get\describe.
2016-08-25 01:38:52 -07:00
mksalawa f4016bef7a Use heapster handler for pods from all namespaces. 2016-08-25 09:08:31 +02:00
Kubernetes Submit Queue bdeeb9db90 Merge pull request #31135 from xingzhou/bash_completion_bug
Automatic merge from submit-queue

Fixed two issues of kubectl bash completion.

This patch includes the fix of the following issue:
• Correct the method invocation from "__kubectl_namespace_flag"
  to "__kubectl_override_flags"
• Support bash completion if "--namespace=xxx" style flags are
  specified in the kubectl command

Fixes #31134
2016-08-24 23:43:20 -07:00
Janet Kuo 1d620b545c Print to stderr when attach failed 2016-08-24 15:36:52 -07:00
Kubernetes Submit Queue b8c1a833a6 Merge pull request #31210 from lojies/changetostderr
Automatic merge from submit-queue

change to stderr

`fmt.Fprint(out, "You must specify the type of resource to describe. ", valid_resources)`

change this to stderr.
2016-08-24 03:32:57 -07:00
Kubernetes Submit Queue d84dcaf3fb Merge pull request #30858 from kargakis/status-column-for-rs
Automatic merge from submit-queue

kubectl: display ready replicas in 'get {rs,rc}'

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

@kubernetes/kubectl @janetkuo @bgrant0607
2016-08-24 00:38:53 -07:00
Kubernetes Submit Queue 2fe56d4bb3 Merge pull request #30863 from ping035627/ping035627-patch-0818
Automatic merge from submit-queue

Optimise the ValidateBytes function

The PR optimise the "ValidateBytes" function in factory.go. Too much "if" branches is poor readability, use "switch" to look better.
2016-08-23 23:59:00 -07:00
lojies f21c37db64 change to stderr 2016-08-23 14:51:56 +08:00
lojies f5b7a6e2a3 add valid resources when args is nil 2016-08-23 09:40:57 +08:00
ohmystack 1ea3da1eb6 Fix named pipe in kubectl zsh completion
In zsh and bash, a multi-line named pipe, who is wrapped by
parenthesis, is possible to mismatch the right parenthesis, even that
parenthesis is in a here-document. So, we move the code into a
function, and use an inline named pipe.

Signed-off-by: ohmystack <jiangjun1990@gmail.com>
2016-08-23 01:42:05 +08:00
Xing Zhou 48100f7117 Fixed two issues of kubectl bosh completion.
This patch includes the fix of the following issue:
• Correct the method invocation from "__kubectl_namespace_flag"
  to "__kubectl_override_flags"
• Support bash completion if "--namespace=xxx" style flags are
  specified in the kubectl command

Fixes #31134
2016-08-23 01:13:38 +08:00
Michail Kargakis 51a894e616 kubectl: display ready replicas in 'get {rs,rc}' 2016-08-22 15:12:14 +02:00
Kubernetes Submit Queue 5b5a4145da Merge pull request #30821 from ardnaxelarak/21076_change_isEmpty_to_Empty
Automatic merge from submit-queue

Rename IsEmpty to Empty

addresses #21076
2016-08-22 00:54:28 -07:00
PingWang 0926f7d3f1 Optimise the DefaultGenerators function
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-22 10:43:15 +08:00
Kubernetes Submit Queue d1ed6f598f Merge pull request #30614 from AdoHe/run_pull_policy
Automatic merge from submit-queue

kubectl run add pull-policy flag to control image pull policy

```release-note
Add support for --image-pull-policy to 'kubectl run'
```

Fix #30493 
@pwittrock @thockin ptal
2016-08-21 14:04:15 -07:00
Kubernetes Submit Queue a956dd1c25 Merge pull request #25524 from AdoHe/kubectl_reorg
Automatic merge from submit-queue

update kubectl help output for better organization

## Pull Request Guidelines

1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md).
1. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md).
1. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below.

```release-note
* Use the release-note-* labels to set the release note state 
* Clear this block to use the PR title as the release note 
-OR-
* Enter your extended release note here
```


[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-08-21 09:08:56 -07:00
bindata-mockuser e792d4117d Add return code support to kubectl-exec and -run 2016-08-20 15:58:47 +02:00
bindata-mockuser 6dcb0c9130 Rectify kubectl error output 2016-08-20 15:58:10 +02:00
Kubernetes Submit Queue 3c65fdc752 Merge pull request #30313 from juanvallejo/jvallejo_kube-remove-duplicate-error-msgs
Automatic merge from submit-queue

remove duplicate errors from aggregate error outputs

release-label-none

Duplicate error messages are sometimes shown when displaying aggregate errors:

`$ kubectl label pod/database-1-fn0r7 qwer1345%$$#=self`
```
* metadata.labels: Invalid value: "qwer1345%5602#": name part must match the regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9] (e.g. 'MyName' or 'my.name' or '123-abc')
* metadata.labels: Invalid value: "qwer1345%5602#": name part must match the regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9] (e.g. 'MyName' or 'my.name' or '123-abc')
* metadata.labels: Invalid value: "qwer1345%5602#": name part must match the regex ([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9] (e.g. 'MyName' or 'my.name' or '123-abc')
```

This patch removes any duplicate messages (adjacent or not) that appear in the final list of errors.
2016-08-20 02:18:46 -07:00
Kubernetes Submit Queue c39f0eec4a Merge pull request #30993 from mksalawa/bump_heapster_version
Automatic merge from submit-queue

Bump heapster version

Bump heapster version to v1.2.0-beta.1.
Migrate metrics tests and HPA to use List objects introduced in the new version.
2016-08-19 19:36:53 -07:00
AdoHe b411fe217f update kubectl help output for better organization 2016-08-20 08:03:39 +08:00
Kubernetes Submit Queue 3787a068fc Merge pull request #30955 from lojies/modifygetresource
Automatic merge from submit-queue

use valid_resources to replace kubectl.PossibleResourceTypes

```release
Fix resource list printed by kubectl help 
```

 `kubectl get` return 

> 
You must specify the type of resource to get. Valid resource types include:
   * componentstatuses (aka 'cs')
   * configmaps
   * daemonsets (aka 'ds')
   * deployments
   * events (aka 'ev')
   * endpoints (aka 'ep')
   * horizontalpodautoscalers (aka 'hpa')
   * ingress (aka 'ing')
   * jobs
   * limitranges (aka 'limits')
   * nodes (aka 'no')
   * namespaces (aka 'ns')
   * pods (aka 'po')
   * persistentvolumes (aka 'pv')
   * persistentvolumeclaims (aka 'pvc')
   * quota
   * resourcequotas (aka 'quota')
   * replicasets (aka 'rs')
   * replicationcontrollers (aka 'rc')
   * secrets
   * serviceaccounts (aka 'sa')
   * services (aka 'svc')
error: Required resource not specified.
See 'kubectl get -h' for help and examples.

while `kubectl get --help` return

> root@k8s-node1:~# kubectl get --help
Display one or many resources.
Possible resource types include (case insensitive): pods (po), services (svc), deployments,
replicasets (rs), replicationcontrollers (rc), nodes (no), events (ev), limitranges (limits),
persistentvolumes (pv), persistentvolumeclaims (pvc), resourcequotas (quota), namespaces (ns),
serviceaccounts (sa), ingresses (ing), horizontalpodautoscalers (hpa), daemonsets (ds), configmaps,
componentstatuses (cs), endpoints (ep), and secrets.
By specifying the output as 'template' and providing a Go template as the value
of the --template flag, you can filter the attributes of the fetched resource(s).
......

kubectl.PossibleResourceTypes missing some resouces such as jobs quota.
describe and explain have the same problem.

i think using valid_resources to replace kubectl.PossibleResourceTypes more suitable.
2016-08-19 15:49:15 -07:00
Kubernetes Submit Queue 56045bbd6a Merge pull request #30971 from lojies/removenil
Automatic merge from submit-queue

remove unnecessary err == nil

because if err != nil has returned err, so remove unnecessary err == nil.
2016-08-19 15:48:23 -07:00
Kubernetes Submit Queue 68c4190e60 Merge pull request #30579 from smarterclayton/strip_extra_newlines
Automatic merge from submit-queue

Describing a single item should not have extra newlines

@fabianofranz
2016-08-19 14:33:39 -07:00
Kara Alexandra d12a66a422 Rename IsEmpty to Empty
Signed-off-by: Kara Alexandra <kalexandra@us.ibm.com>
2016-08-19 14:19:19 -07:00
Kubernetes Submit Queue f51e834d63 Merge pull request #30445 from deads2k/get-raw
Automatic merge from submit-queue

add --raw for kubectl get

Adds a `--raw` option to `kubectl get` that allow you specify your URI, but use the transport built by `kubectl`.  This is especially useful when working with secured environments that require authentication and authorization to hit non-api endpoints.  For example, `kubect get --raw /metrics` or if you want to debug a watch with a view at the exact data `kubectl get --raw '/api/v1/namespaces/one/replicationcontrollers?watch=true'`.

@kubernetes/kubectl 
@fabianofranz fyi
2016-08-19 09:29:08 -07:00
mksalawa ddf66e0dae Update Godeps. 2016-08-19 17:28:25 +02:00
mksalawa 2833119a15 Use List objects for metrics in kubectl top and HPA 2016-08-19 17:26:50 +02:00
Kubernetes Submit Queue 2099c6f495 Merge pull request #30767 from mksalawa/kubectltop
Automatic merge from submit-queue

Add percentage of used resources to node metrics.

Show percentage along with resource usage in 'kubectl top node' command.

Remove Storage column. (#30782)

Sample output:
```
$ kubectl top node

NAME                           CPU(cores)   CPU%      MEMORY(bytes)   MEMORY%   
kubernetes-master              238m         23%       1982Mi          53%       
kubernetes-minion-group-xxxx   62m          3%        1576Mi          21%       
kubernetes-minion-group-yyyy   68m          3%        1638Mi          21%       
kubernetes-minion-group-zzzz   42m          2%        1568Mi          20%
```

**Release note**
```release-note
NONE
```
2016-08-19 06:58:18 -07:00
Kubernetes Submit Queue 40367df750 Merge pull request #30590 from kevin-wangzefeng/taint-unique-by-key-effect
Automatic merge from submit-queue

make taints unique by <key, effect> on a node

closes #29362
2016-08-19 04:58:12 -07:00
mksalawa 566af82be3 Add percentage of used resources to node metrics. 2016-08-19 13:35:39 +02:00
lojies a459a4a188 remove unnecessary err == nil 2016-08-19 14:34:27 +08:00
lojies f81fef1f04 use valid_resources to replace kubectl.PossibleResourceTypes 2016-08-19 09:42:46 +08:00
Clayton Coleman a7a7fd4631
Patch was not requesting a version to encode to 2016-08-18 14:45:01 -04:00
PingWang cd158938b9 Optimise the ValidateBytes function
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-18 19:23:10 +08:00
Kubernetes Submit Queue 4b5fd43e24 Merge pull request #30250 from krousey/kctl_dynamic
Automatic merge from submit-queue

Change kubectl create to use dynamic client

https://github.com/kubernetes/kubernetes/issues/16764 https://github.com/kubernetes/kubernetes/issues/3955

This is a series of changes to allow kubectl create to use discovery-based REST mapping and dynamic clients.

cc @kubernetes/sig-api-machinery

**Release note**:
<!--  Steps to write your release note:
1. Use the release-note-* labels to set the release note state (if you have access) 
2. Enter your extended release note in the below block; leaving it blank means using the PR title as the release note. If no release note is required, just write `NONE`. 
-->
```release-note
kubectl will no longer do client-side defaulting on create and replace.
```
2016-08-17 14:48:56 -07:00
deads2k 1ed263e0e5 add --raw for kubectl get 2016-08-17 08:45:50 -04:00
Kubernetes Submit Queue aedeccda95 Merge pull request #28352 from vefimova/fix_22986-1
Automatic merge from submit-queue

Added warning msg for `kubectl get`

- added warning description regarding terminated pods to `get` long help message
  - added printing of warning message in case of `get pods` if there are hidden pods

Fixes #22986  (initiall PR and discussion are here #26417)

## **Output examples:**
### # kubectl get pods
```
NAME                       READY     STATUS             RESTARTS   AGE
dapi-test-pod1             0/1       Terminating        0          22h
liveness-http              0/1       CrashLoopBackOff   11245      22d
ubuntu1-1206318548-oh9tc   0/1       CrashLoopBackOff   2336       8d
  info: 1 completed object(s) was(were) not shown in pods list. Pass --show-all to see all objects.

```

### #  kubectl get pods,namespaces
```
NAME                          READY     STATUS             RESTARTS   AGE
po/dapi-test-pod1             0/1       Terminating        0          22h
po/liveness-http              1/1       Running            11242      22d
po/ubuntu1-1206318548-oh9tc   0/1       CrashLoopBackOff   2335       8d
 info: 1 completed object(s) was(were) not shown in pods list. Pass --show-all to see all objects.

NAME             STATUS    AGE
ns/default       Active    89d
ns/kube-system   Active    41d
```

### # kubectl get pods -a
```
NAME                       READY     STATUS             RESTARTS   AGE
busybox                    0/1       Error              0          27d
dapi-test-pod1             0/1       Terminating        0          22h
liveness-http              0/1       CrashLoopBackOff   11245      22d
ubuntu1-1206318548-oh9tc   0/1       CrashLoopBackOff   2336       8d
```

### # kubectl get -h
```
Display one or many resources.

Possible resource types include (case insensitive): pods (aka 'po'), services (aka 'svc'), deployments (aka 'deploy'),
replicasets (aka 'rs'), replicationcontrollers (aka 'rc'), nodes (aka 'no'), events (aka 'ev'), limitranges (aka 'limits'),
persistentvolumes (aka 'pv'), persistentvolumeclaims (aka 'pvc'), resourcequotas (aka 'quota'), namespaces (aka 'ns'),
serviceaccounts (aka 'sa'), ingresses (aka 'ing'), horizontalpodautoscalers (aka 'hpa'), daemonsets (aka 'ds'), configmaps (aka 'cm'),
componentstatuses (aka 'cs), endpoints (aka 'ep'), petsets (alpha feature, may be unstable) and secrets.

This command will hide resources that have completed. For instance, pods that are in the Succeeded or Failed phases.
You can see the full results for any resource by providing the '--show-all' flag.

By specifying the output as 'template' and providing a Go template as the value
of the --template flag, you can filter the attributes of the fetched resource(s).

Examples:

.........
````
2016-08-17 05:11:50 -07:00
Kevin 1e2d560253 make taints unique by <key, effect> on a node 2016-08-17 15:40:33 +08:00
AdoHe ca315e317b kubectl run add pull-policy flag to control image pull policy 2016-08-17 11:26:27 +08:00
juanvallejo 4b18f52fc9 add unit test for duplicate errors 2016-08-16 13:09:55 -04:00
juanvallejo 6e7df2c986 remove duplicate errors from aggregate error outputs 2016-08-16 13:09:52 -04:00
Kris b5235bccec Make kubectl replace use dynamic clients 2016-08-15 22:07:54 -07:00
Kris 7511412ca6 Make kubectl create use dynamic clients 2016-08-15 22:07:54 -07:00
Kris 63a512fe47 Add discovery mapper and dynamic typer to kubectl 2016-08-15 22:07:54 -07:00
PingWang bc3b74a499 Add validation conditions for autoscale
Signed-off-by: PingWang <wang.ping5@zte.com.cn>

delete --min judgment

Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-08-16 09:41:28 +08:00
vefimova f20c40ed65 Added warning msg for `kubectl get`
- added warning description regarding terminated objects to `get` long help message
  - added printing of warning message in case of `get pods` if there are hidden pods
Fixes #22986
2016-08-15 22:49:37 +00:00
Clayton Coleman 6caf4d5a3f
Describing a single item should not have extra newlines 2016-08-15 12:28:15 -04:00
Kubernetes Submit Queue f0e5dac1f1 Merge pull request #30247 from ardnaxelarak/28695_suppress_noisy_output
Automatic merge from submit-queue

Make more messages respect --quiet flag

Make following two messages respect `--quiet` in `kubectl run`
- `If you don't see a command prompt, try pressing enter.`
- `Pod "name" deleted`

Ref #28695
2016-08-12 21:34:14 -07:00
Kubernetes Submit Queue 612e3c2634 Merge pull request #30222 from hodovska/port-forward-cmd-struct
Automatic merge from submit-queue

kubectl/port-forward: complete/validate/run structure

```kubectl port-forward``` command is converted to a complete/validate/run kubectl command structure specified here: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/kubectl-conventions.md#command-conventions
In this PR is also exposed the ready and stop channel for API consumer.

Fixes #16504
2016-08-12 20:58:53 -07:00
Kubernetes Submit Queue a4acf08747 Merge pull request #30460 from juanvallejo/jvallejo_kube-add-zsh-compatibility-note-kubectl-completion
Automatic merge from submit-queue

Add zsh compatibility note `completion` cmd help

zsh completions are not supported on zsh versions < 5.2.

This patch advices user on supported versions of zsh when using the `completion`
command to avoid potential UX failure.

##### After
`$ kubectl completion -h`
```
Output shell completion code for the given shell (bash or zsh).

This command prints shell code which must be evaluation to provide interactive
completion of kubectl commands.

Examples:

$ source <(kubectl completion bash)

will load the kubectl completion code for bash. Note that this depends on the
bash-completion framework. It must be sourced before sourcing the kubectl
completion, e.g. on the Mac:

$ brew install bash-completion
$ source $(brew --prefix)/etc/bash_completion
$ source <(kubectl completion bash)

If you use zsh*, the following will load kubectl zsh completion:

$ source <(kubectl completion zsh)

* zsh completions are only supported in versions of zsh >= 5.2
```

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

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30460)
<!-- Reviewable:end -->
2016-08-12 10:16:50 -07:00
Kubernetes Submit Queue 6f20321833 Merge pull request #28509 from juanvallejo/jvallejo_update-human-readable-printer-signature
Automatic merge from submit-queue

Update HumanResourcePrinter signature w single PrintOptions param

release-note-none

- Makes [HumanReadablePrinter options field non-exported again](https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/resource_printer.go#L346-349)
- Adds test-case for HumanReadablePrinter resource printing with aliases.
- Better formatting for saving resource "kind" aliases

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/28509)
<!-- Reviewable:end -->
2016-08-12 07:27:56 -07:00
Kubernetes Submit Queue 9c3d539313 Merge pull request #28844 from mksalawa/kubectltop
Automatic merge from submit-queue

Implement 'kubectl top' command

```release-note
Added 'kubectl top' command showing the resource usage metrics.
```

Sample output:

Nodes:
```
$ kubectl top node

NAME                           CPU       MEMORY    STORAGE   TIMESTAMP                         
kubernetes-minion-group-xxxx   76m       1468 Mi   0 Mi      Tue, 12 Jul 2016 17:37:00 +0200   
kubernetes-minion-group-yyyy   73m       1511 Mi   0 Mi      Tue, 12 Jul 2016 17:37:00 +0200   
kubernetes-minion-group-zzzz   46m       1506 Mi   0 Mi      Tue, 12 Jul 2016 17:37:00 +0200   
kubernetes-master              76m       2059 Mi   0 Mi      Tue, 12 Jul 2016 17:37:00 +0200   
```

Pods in all namespaces:
```
$ kubectl top pod --all-namespaces

NAMESPACE     NAME                                                 CPU       MEMORY    STORAGE   TIMESTAMP                         
default       nginx-1111111111-zzzzz                               0m        1 Mi      0 Mi      Tue, 12 Jul 2016 17:49:00 +0200   
kube-system   etcd-server-kubernetes-master                        4m        116 Mi    0 Mi      Tue, 12 Jul 2016 17:49:00 +0200   
kube-system   fluentd-cloud-logging-kubernetes-minion-group-xxxx   14m       110 Mi    0 Mi      Tue, 12 Jul 2016 17:49:00 +0200   
kube-system   kube-dns-v18-zzzzz                                   1m        6 Mi      0 Mi      Tue, 12 Jul 2016 17:49:00 +0200   
...
```

Pod with containers:
```
$ kubectl top pod heapster-v1.1.0-1111111111-miail --namespace=kube-system --containers

NAMESPACE     NAME                               CPU       MEMORY    STORAGE   TIMESTAMP                         
kube-system   heapster-v1.1.0-1111111111-miail   1m        42 Mi     0 Mi      Tue, 12 Jul 2016 17:52:00 +0200   
              heapster                           1m        26 Mi     0 Mi                                        
              eventer                            0m        3 Mi      0 Mi                                        
              heapster-nanny                     0m        6 Mi      0 Mi                                        
              eventer-nanny                      0m        6 Mi      0 Mi                                        
```

ref #11382

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/28844)
<!-- Reviewable:end -->
2016-08-12 06:50:43 -07:00
Dominika Hodovska c5babe2396 expose ready/stop channel 2016-08-12 15:45:57 +02:00
Kubernetes Submit Queue 2ab58ea519 Merge pull request #30162 from juanvallejo/jvallejo_err-kube-run-on-invalid-image-value
Automatic merge from submit-queue

return err on `kubectl run --image` with invalid value

When running `kubectl run <configname> --image="Invalid$$%ImageValue%%__"`, a configuration is successfully created with an image name that is not a valid value for an image reference.

This patch validates that the image name is a valid image reference, and returns an error before creating a config if an invalid value is passed.

`$ kubectl run test --image="Invalid__%imagename"`
```
error: Invalid image name "Invalid__%imagename": invalid reference format
```

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30162)
<!-- Reviewable:end -->
2016-08-12 06:09:26 -07:00
Daniel Smith f1fd638962 fix register.go files up + add test import 2016-08-11 17:06:54 -07:00
Kubernetes Submit Queue 91a3930331 Merge pull request #30362 from lixiaobing10051267/masterAppsClient
Automatic merge from submit-queue

check validation with no apps client in kubectl util factory

autoscaling client already exist:

		if c.c.AutoscalingClient == nil {
			return errors.New("unable to validate: no autoscaling client")

so following autoscaling client should be apps client:

		if c.c.AppsClient == nil {
			return errors.New("unable to validate: no autoscaling client")
		}

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30362)
<!-- Reviewable:end -->
2016-08-11 12:54:14 -07:00
juanvallejo 9eb98cfb58 Add zsh compatibility note `completion` cmd help 2016-08-11 13:49:44 -04:00
mksalawa 5df9fe684d Implement kubectl top command with subcommands. 2016-08-11 17:25:18 +02:00
lixiaobing10051267 254189a5f2 check validation with no apps client in kubectl util factory 2016-08-10 21:20:50 +08:00
Kubernetes Submit Queue cc7d509e47 Merge pull request #30227 from soltysh/remove_seconds
Automatic merge from submit-queue

Remove seconds from scheduled jobs cron format

@erictune @janetkuo as promised this removes the seconds from the cron format

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30227)
<!-- Reviewable:end -->
2016-08-10 03:50:30 -07:00
Maciej Szulik 902ecd85fc Remove seconds from scheduled jobs cron format 2016-08-10 11:15:33 +02:00
juanvallejo af37981812 return err on kubectl run --image with invalid value 2016-08-09 15:05:44 -04:00
Dominika Hodovska ae584d8114 kubectl: Convert port-forward cmd to complete/validate/run structure 2016-08-09 12:10:04 +02:00
Kubernetes Submit Queue 16621cd32d Merge pull request #30022 from juanvallejo/jvallejo_add-timeout-unit-to-scale-help
Automatic merge from submit-queue

Update scale cmd help to display duration "units" in --timeout usage

release-note-none

`kubectl scale` has `--timeout` option, but the help info does not give accepted time units.

The help info gives default value 0 without a unit, potentially misleading a user into thinking they need to pass the numbered time only.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30022)
<!-- Reviewable:end -->
2016-08-08 17:58:02 -07:00
Kara Alexandra 4c959c0b23 Make more messages respect --quiet flag
- "If you don't see a command prompt, try pressing enter."
- "Pod "name" deleted"

Signed-off-by: Kara Alexandra <kalexandra@us.ibm.com>
2016-08-08 14:24:44 -07:00
Angus Salkeld bd0b7528b5 Add "create deployment" sub-command 2016-08-08 13:24:30 +10:00
Angus Salkeld 42ca885edb Add "create service" sub-commands
This adds:
 create service clusterip
 create service nodeport
 create service loadbalancer
2016-08-08 12:31:21 +10:00
Kubernetes Submit Queue 5f44431275 Merge pull request #30007 from ericchiang/kubectl-config-set-credentials-auth-providers
Automatic merge from submit-queue

kubectl config set-crentials: add arguments for auth providers

This PR adds `--auth-provider` and `--auth-provider-arg` flags to the
`kubectl config set-credentials` sub-command.

There's currently no way of interacting with the new auth provider framework added in #23066 through kubectl. You have to render a custom kubeconfig to use them. Additionally `kubectl config set` just sort of craps out when attempting to interact with authentication info objects (#29312).

This is a minimal implementation of allowing `kubect config set-credentials` to set fields for client auth providers.

cc @cjcullen @kubernetes/kubectl
2016-08-05 22:22:22 -07:00
Kubernetes Submit Queue 2537f66f0e Merge pull request #29230 from luxas/goimport
Automatic merge from submit-queue

Run goimport for the whole repo

While removing GOMAXPROC and running goimports, I noticed quite a lot of other files also needed a goimport format. Didn't commit `*.generated.go`, `*.deepcopy.go` or files in `vendor`

This is more for testing if it builds.
The only strange thing here is the gopkg.in/gcfg.v1 => github.com/scalingdata/gcfg replace.
cc @jfrazelle @thockin
2016-08-05 16:22:01 -07:00
Kubernetes Submit Queue e4b067efd0 Merge pull request #30125 from lixiaobing10051267/masterFormat
Automatic merge from submit-queue

Wrong format is used with single quotes in log

Wrong format is used with single quotes in log, should use ""
2016-08-05 10:29:52 -07:00
Kubernetes Submit Queue a13efbc01a Merge pull request #30070 from deads2k/fix-alias
Automatic merge from submit-queue

replace improper create quota alias

`q` is not a shortname for `resourcequota`, so it shouldn't be an alias for `kubectl create resourcequota`.

@sttts ptal
2016-08-05 02:36:44 -07:00
lixiaobing10051267 11f5ced9d3 Wrong format is used with single quotes in log 2016-08-05 15:23:23 +08:00
Kubernetes Submit Queue 7921a9ce67 Merge pull request #25816 from soltysh/scheduledjob_kubectl
Automatic merge from submit-queue

ScheduledJob kubectl

@erictune the last part (kubectl) of the ScheduledJob, as usual builds on top of previous PRs, so only last 2 commits matter (the kubectl one and storage leftovers).

```release-note
* Introducing ScheduledJobs as described in [the proposal](https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/scheduledjob.md) as part of `batch/v2alpha1` version (experimental feature).
```
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-08-04 17:36:07 -07:00
Kubernetes Submit Queue b8dbb3e34a Merge pull request #30045 from lojies/addalias
Automatic merge from submit-queue

add alias for createconfigmap

add Aliases for cmd create configmap.
this is a supplement for [https://github.com/kubernetes/kubernetes/pull/29652]
2016-08-04 16:25:58 -07:00
Eric Chiang 974473c45f kubectl config set-crentials: add arguments for auth providers
This PR adds `--auth-provider` and `--auth-provider-arg` flags to the
`kubectl config set-credentials` sub-command.
2016-08-04 16:23:40 -07:00
Kubernetes Submit Queue 8770b2e237 Merge pull request #29319 from juanvallejo/jvallejo_bugfix/single-resource-version-flag
Automatic merge from submit-queue

fix annotate.go single resource check

```release-note
Fix issue with kubectl annotate when --resource-version is provided.
```

When using `kubectl annotate` with a `--resource-version` on a resource, such as `kubectl annotate pod <pod_name> --resource-version=1820 description='myannotation'`, the command fails with the error: `error: --resource-version may only be used with a single resource`.

Upon printing the output of `resources` that the annotate command receives from cli args, it prints: `Resources:[pod <pod_name>]`. In other words, it treats the name of the resource as a second resource. This PR addresses this issue by using the resource builder `Singular` flag to determine if only a single resource was passed.
2016-08-04 13:26:50 -07:00
juanvallejo 620758c7e9 format resource printing with aliases 2016-08-04 12:01:25 -04:00
deads2k 0beca8e6be replace improper create quota alias 2016-08-04 08:02:14 -04:00
lojies 4426c5fd6f add alias for createconfigmap 2016-08-04 10:35:15 +08:00
Kubernetes Submit Queue 207e8836c0 Merge pull request #29921 from andreykurilin/kubectl_typos
Automatic merge from submit-queue

Fix various typos in kubectl
2016-08-03 13:43:32 -07:00
juanvallejo d9dedfff5e add timeout units to cmds help example 2016-08-03 16:36:51 -04:00
Maciej Szulik b5c68a9015 ScheduledJob kubectl changes 2016-08-03 17:25:37 +02:00
Kubernetes Submit Queue 24216fe02f Merge pull request #26958 from resouer/util-line
Automatic merge from submit-queue

Refactoring runner resource container linedelimiter to it's own pkg

Continuing my work ref #15634

Anyone is ok to review this fix.
2016-08-03 02:26:12 -07:00
Kubernetes Submit Queue 4f9c3d52b2 Merge pull request #29163 from lojies/adderr
Automatic merge from submit-queue

add err return

Since err can be returned by previous code,  add err return.
2016-08-02 21:39:39 -07:00
Kubernetes Submit Queue f2a9ba2339 Merge pull request #27392 from sjenning/old-kubectl-watch
Automatic merge from submit-queue

allow watching old resources with kubectl

Right now, one can not watch a resource with kubectl whose resourceVersion is outside the etcd watch window.  Specifying resourceVersion=0 returns the current object, then watches from the current index.

This PR changes the logic to use resourceVersion=0, which will work regardless of the resourceVersion of the object, and discard the first event if --watch-only is specified.

@ncdc @aveshagarwal
2016-08-02 14:44:20 -07:00
k8s-merge-robot 7a62b9c8d1 Merge pull request #29523 from fraenkel/service_names_rfc1035
Automatic merge from submit-queue

Allow service names up to 63 characters (RFC 1035)

fixes #3752
2016-08-02 10:33:16 -07:00
Andrey Kurilin 91cace347d Fix various typos in kubectl 2016-08-02 19:51:51 +03:00
Seth Jennings 461faae367 allow watching old resources with kubectl 2016-08-02 10:28:04 -05:00
Michael Fraenkel b1e7e6cf46 Service names conform to RFC 1035 2016-08-02 08:42:15 -06:00
k8s-merge-robot 0fbd60fa30 Merge pull request #29187 from soltysh/multiversion_kubectl
Automatic merge from submit-queue

Create client from API version passed in config or use default

When creating a client read the `GroupVersion` value passed in the `restclient.Config`. If the passed `GroupVersion` does not match current group or is not enabled fallback to default `GroupVersion` for that group.

This PR should allow accessing `ScheduledJob` properly in `batch/v2alpha1`.

@smarterclayton @deads2k @caesarxuchao @lavalamp ptal
2016-08-02 06:10:26 -07:00
Lucas Käldström c88a07ce1a Run goimports 2016-08-02 15:12:39 +03:00
k8s-merge-robot ad0a44ea0b Merge pull request #29823 from alexbrand/config-context-msg
Automatic merge from submit-queue

Fix error msg in kubectl config get-contexts

Fixes #29822
2016-08-02 02:28:42 -07:00
k8s-merge-robot 44ea855713 Merge pull request #28239 from ApsOps/kubectl-expose-headless-svc
Automatic merge from submit-queue

Add a flag for `kubectl expose`to set ClusterIP and allow headless services

- Use `--cluster-ip=None` to create a headless service
- Fixes #10294
2016-08-02 01:18:19 -07:00
Daniel Smith b712bfd7ac Revert "Extend all to more resources" 2016-08-01 21:51:57 -07:00
abrand 20ae1b87cc Fix error msg in kubectl config get-contexts 2016-08-01 17:27:15 -04:00
abrand 82c700c896 Add get/delete cluster, delete context to kubectl 2016-08-01 17:04:13 -04:00
k8s-merge-robot 95b4572e7c Merge pull request #28955 from dims/roadmap-extend-all
Automatic merge from submit-queue

Extend all to more resources

Added more things from the list here:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/cmd.go#L159

Note, did not add events as it did not seem useful to me. Since
this is just a list of messages generated by the system.

Related to a suggestion in issue #22337
2016-08-01 10:07:01 -07:00
Harry Zhang 15d0f5cfd5 Move linedelimiter to it's own pkg
Refactoring resource container
2016-07-29 02:29:26 -04:00
k8s-merge-robot 96996985a0 Merge pull request #29737 from andreykurilin/fix_kubectl_help_cmd
Automatic merge from submit-queue

Fix kubectl help command

PR 48d47b1027 broke `kubectl help` command due
to wrong check `help for help cmd` .

Fixes #29736
2016-07-28 19:07:55 -07:00
k8s-merge-robot b6b44b2d90 Merge pull request #29652 from lojies/shorthandconfigmaps
Automatic merge from submit-queue

add shorthand cm for configmaps

add shorthand 'cm' for configmaps.
2016-07-28 13:16:57 -07:00
Andrey Kurilin b2f8ee4f12 Fix kubectl help command
PR 48d47b1027 broke `kubectl help` command due
to wrong check `help for help cmd` .

Fixed issue #29736
2016-07-28 17:47:03 +03:00
k8s-merge-robot 5c6c8eb9a6 Merge pull request #29531 from AdoHe/rolling_update_panic
Automatic merge from submit-queue

fix kubectl rolling update empty file cause panic issue

 ```release-note
Fix issue with kubectl panicing when passed files that do not exist.
```

Fix #29398 
@pwittrock @justinsb ptal. This just fix on the cmd layer, I am thinking whether we should return err from marshal&unmarshal if the reader is empty.
2016-07-28 01:54:56 -07:00
juanvallejo 1e71359a77 fix annotate.go single resource check 2016-07-27 10:41:05 -04:00
lojies 79f09cb687 add shorthand cm for configmaps 2016-07-27 10:54:11 +08:00
Dr. Stefan Schimanski 199f991f6a Add --scopes to kubectl-create-quota and add tests 2016-07-26 14:12:35 +02:00
Maciej Szulik 1e496fd8ce Create client from API version passed in config or use default
When creating a client read the GroupVersion value passed in the
restclient.Config. If the passed GroupVersion does not match current
group or is not enabled fallback to default GroupVersion for that group.
2016-07-26 11:54:25 +02:00
maaz khan 5b95524d65 Add support for kubectl create quota command 2016-07-26 11:32:08 +02:00
AdoHe 0949e08336 fix kubectl rolling update empty file cause panic issue 2016-07-26 02:37:55 -04:00
lojies bf24ff00eb add err return 2016-07-26 08:55:53 +08:00
k8s-merge-robot b4b430bf0d Merge pull request #28833 from tnguyen-rh/fix-docstring
Automatic merge from submit-queue

Fix docstring: Say "flag options" instead of "flag statements"

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-07-25 16:16:06 -07:00
k8s-merge-robot c29f3238ec Merge pull request #26411 from zefciu/b17542
Automatic merge from submit-queue

Validation logic applied to edited file

The file that is submitted via ``edit`` is now subject to validation
logic as any other file. The validation flags were added to the ``edit``
command.

Fixes:  #17542
2016-07-25 09:18:55 -07:00
Davanum Srinivas ccf4e4d61e Extend all to more resources
Added more things from the list here:
https://github.com/kubernetes/kubernetes/blob/master/pkg/kubectl/cmd/cmd.go#L159

Update the devel/kubectl-conventions.md with the rules mentioned by
a few folks on which resources could be added to the special 'all' alias

Related to a suggestion in issue #22337
2016-07-24 21:14:50 -04:00
Janet Kuo 623a97c685 Use patch when recording commands in kubectl set image 2016-07-21 15:33:34 -07:00
k8s-merge-robot 1cf3f1cf03 Merge pull request #29237 from ncdc/fixup-windows-term
Automatic merge from submit-queue

Fix Windows terminal handling

Fix some issues with Windows terminal handling with respect to TTYs that came up as part of the
code that adds support for terminal resizing.

cc @smarterclayton @sttts @csrwng
2016-07-21 07:24:13 -07:00
Wojciech Tyczynski 4d0d115690 Revert "add tokenreviews endpoint to implement webhook" 2016-07-21 09:40:35 +02:00
deads2k 2c4a9f2e8d interesting changes to add tokenreviews endpoint to implement webhook 2016-07-20 15:11:56 -04:00
Andy Goldstein 77b0547b3d Fix Windows terminal handling
Fix some issues with Windows terminal handling with respect to TTYs that came up as part of the
code that adds support for terminal resizing.
2016-07-20 13:37:14 -04:00
k8s-merge-robot e72f6a892d Merge pull request #28234 from damemi/record-false-bugfix
Automatic merge from submit-queue

Make sure --record=false is acknowledged when passed to commands

```release-note
Change setting "kubectl --record=false" to stop updating the change-cause when a previous change-cause is found.
```

Ensures that when `--record=false` is explicity set that no `ChangeCauseAnnotation`s are set on the object. Previously, if `--record=true` was used then all following actions triggered a `ChangeCauseAnnotation` even if `--record=false` was set, due to the prior `ChangeCauseAnnotation` existing.

Reference to bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1351127

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
2016-07-18 11:32:15 -07:00
Thien-Thi Nguyen 165363a834 Fix docstring: Say "flag options" instead of "flag statements" 2016-07-18 11:58:40 +02:00
AdoHe ddbd539d1e kubectl apply add --overwrite flag 2016-07-18 00:32:13 -04:00
Mike Dame cfbf7da75b Make sure --record=false is acknowledged when passed to commands 2016-07-15 11:24:05 -04:00