Commit Graph

1612 Commits (158dc1a863442efc1e2ad8ac5ed0628487ffb6e1)

Author SHA1 Message Date
Ilya Dmitrichenko abc0a98d25
Replace references to http://releases.k8s.io/HEAD/docs/user-guide/ 2016-10-02 11:44:40 +01:00
Kubernetes Submit Queue 6f69293240 Merge pull request #32599 from mikedanese/kubectl-selector
Automatic merge from submit-queue

allow kubectl -f to filter by selector

cc @kubernetes/kubectl

Fixes #32544
2016-10-01 01:13:09 -07:00
Mike Danese 5f2569c16d allow kubectl -f to filter by selector 2016-09-30 00:42:35 -07:00
Kubernetes Submit Queue b840605197 Merge pull request #33677 from juanvallejo/jvallejo/add-linebreak-between-resource-groups
Automatic merge from submit-queue

add linebreak between resource groups

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

Printing multiple groups via `kubectl get all` can produce output that is
hard to read in cases where there are a lot of resource types to display
/ some resource types contain varying column amounts.

This patch adds a linebreak above each group of resources only when
there is more than one group to display, and always omitting the
linebreak above the first group. This makes for slightly improved
output.

Linebreaks are printed to stderr, and honor the `--no-headers` option.

**Before**

```
$ kubectl get all
NAME                     READY     STATUS    RESTARTS   AGE
po/database-1-u9m9l      1/1       Running   3          5d
po/idling-echo-1-9fmz6   2/2       Running   8          5d
po/idling-echo-1-gzb0v   2/2       Running   4          5d
NAME               DESIRED   CURRENT   READY     AGE
rc/database-1      1         1         1         6d
rc/idling-echo-1   2         2         2         6d
NAME              CLUSTER-IP       EXTERNAL-IP   PORT(S)
AGE
svc/database      172.30.11.104    <none>        5434/TCP
6d
svc/frontend      172.30.196.217   <none>        5432/TCP
6d
svc/idling-echo   172.30.115.67    <none>        8675/TCP,3090/UDP
6d
svc/kubernetes    172.30.0.1       <none>        443/TCP,53/UDP,53/TCP
6d
svc/mynodeport    172.30.81.254    <nodes>       8080/TCP
5d
svc/mynodeport1   172.30.198.193   <nodes>       8080/TCP
5d
svc/mynodeport2   172.30.149.48    <nodes>       8080/TCP
5d
svc/mynodeport3   172.30.195.235   <nodes>       8080/TCP
5d
```

**After**

```
$ kubectl get all
NAME                     READY     STATUS    RESTARTS   AGE
po/database-1-u9m9l      1/1       Running   3          5d
po/idling-echo-1-9fmz6   2/2       Running   8          5d
po/idling-echo-1-gzb0v   2/2       Running   4          5d

NAME               DESIRED   CURRENT   READY     AGE
rc/database-1      1         1         1         6d
rc/idling-echo-1   2         2         2         6d

NAME              CLUSTER-IP       EXTERNAL-IP   PORT(S)
AGE
svc/database      172.30.11.104    <none>        5434/TCP
6d
svc/frontend      172.30.196.217   <none>        5432/TCP
6d
svc/idling-echo   172.30.115.67    <none>        8675/TCP,3090/UDP
6d
svc/kubernetes    172.30.0.1       <none>        443/TCP,53/UDP,53/TCP
6d
svc/mynodeport    172.30.81.254    <nodes>       8080/TCP
5d
svc/mynodeport1   172.30.198.193   <nodes>       8080/TCP
5d
svc/mynodeport2   172.30.149.48    <nodes>       8080/TCP
5d
svc/mynodeport3   172.30.195.235   <nodes>       8080/TCP
5d
```

cc @fabianofranz @liggitt
2016-09-28 23:13:07 -07:00
Kubernetes Submit Queue faac71c0dc Merge pull request #31818 from juanvallejo/jvallejo_suggest-explain-cmd-in-kube-get
Automatic merge from submit-queue

suggest use of `kube explain <resource>` in kube get output

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

This patch improves usability flow, making it easier for a user to
discover the command `kube explain <resource>` through `kube get` output.

##### After
```
$ kube get
You must specify the type of resource to get. Valid resource types include:
   * componentstatuses (aka 'cs')
   * configmaps (aka 'cm')
   * daemonsets (aka 'ds')
   * deployments (aka 'deploy')
   * events (aka 'ev')
   * endpoints (aka 'ep')
   * horizontalpodautoscalers (aka 'hpa')
   * ingress (aka 'ing')
   * jobs
   * limitranges (aka 'limits')
   * nodes (aka 'no')
   * namespaces (aka 'ns')
   * petsets (alpha feature, may be unstable)
   * 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.
Use "kubectl explain <resource>" for a detailed description of that resource (e.g. kubectl explain pods).
See 'kubectl get -h' for help and examples.
```
2016-09-28 21:59:29 -07:00
juanvallejo 0988f967f0 add check to NewCmdExec before printing suggestion
checks that the "describe" command and a parent command path exist
before printing suggestion to use the describe command to list
containers in a pod.
2016-09-28 18:02:33 -04:00
juanvallejo 48370b2802 suggest use of `kube explain <resource>` in kube get output
This patch improves usability flow, making it easier for a user to
discover the command `kube explain <resource>` through `kube get`
output.
2016-09-28 14:54:15 -04:00
juanvallejo 735fbf9c09
add linebreak between resource groups
Printing multiple groups via `kubectl get all` can produce output that is
hard to read in cases where there are a lot of resource types to display
/ some resource types contain varying column amounts.

This patch adds a linebreak above each group of resources only when
there is more than one group to display, and always omitting the
linebreak above the first group. This makes for slightly improved
output.

Linebreaks are printed to stderr, and honor the `--no-headers` option.

**Before**

```
$ kubectl get all
NAME                     READY     STATUS    RESTARTS   AGE
po/database-1-u9m9l      1/1       Running   3          5d
po/idling-echo-1-9fmz6   2/2       Running   8          5d
po/idling-echo-1-gzb0v   2/2       Running   4          5d
NAME               DESIRED   CURRENT   READY     AGE
rc/database-1      1         1         1         6d
rc/idling-echo-1   2         2         2         6d
NAME              CLUSTER-IP       EXTERNAL-IP   PORT(S)
AGE
svc/database      172.30.11.104    <none>        5434/TCP
6d
svc/frontend      172.30.196.217   <none>        5432/TCP
6d
svc/idling-echo   172.30.115.67    <none>        8675/TCP,3090/UDP
6d
svc/kubernetes    172.30.0.1       <none>        443/TCP,53/UDP,53/TCP
6d
svc/mynodeport    172.30.81.254    <nodes>       8080/TCP
5d
svc/mynodeport1   172.30.198.193   <nodes>       8080/TCP
5d
svc/mynodeport2   172.30.149.48    <nodes>       8080/TCP
5d
svc/mynodeport3   172.30.195.235   <nodes>       8080/TCP
5d
```

**After**

```
$ kubectl get all
NAME                     READY     STATUS    RESTARTS   AGE
po/database-1-u9m9l      1/1       Running   3          5d
po/idling-echo-1-9fmz6   2/2       Running   8          5d
po/idling-echo-1-gzb0v   2/2       Running   4          5d

NAME               DESIRED   CURRENT   READY     AGE
rc/database-1      1         1         1         6d
rc/idling-echo-1   2         2         2         6d

NAME              CLUSTER-IP       EXTERNAL-IP   PORT(S)
AGE
svc/database      172.30.11.104    <none>        5434/TCP
6d
svc/frontend      172.30.196.217   <none>        5432/TCP
6d
svc/idling-echo   172.30.115.67    <none>        8675/TCP,3090/UDP
6d
svc/kubernetes    172.30.0.1       <none>        443/TCP,53/UDP,53/TCP
6d
svc/mynodeport    172.30.81.254    <nodes>       8080/TCP
5d
svc/mynodeport1   172.30.198.193   <nodes>       8080/TCP
5d
svc/mynodeport2   172.30.149.48    <nodes>       8080/TCP
5d
svc/mynodeport3   172.30.195.235   <nodes>       8080/TCP
5d
```
2016-09-28 14:21:46 -04:00
Doug Davis 9d5bac6330 Change minion to node
Contination of #1111

I tried to keep this PR down to just a simple search-n-replace to keep
things simple.  I may have gone too far in some spots but its easy to
roll those back if needed.

I avoided renaming `contrib/mesos/pkg/minion` because there's already
a `contrib/mesos/pkg/node` dir and fixing that will require a bit of work
due to a circular import chain that pops up. So I'm saving that for a
follow-on PR.

I rolled back some of this from a previous commit because it just got
to big/messy. Will follow up with additional PRs

Signed-off-by: Doug Davis <dug@us.ibm.com>
2016-09-28 10:53:30 -07:00
Kubernetes Submit Queue cbbf22a7d2 Merge pull request #33154 from krmayankk/drain
Automatic merge from submit-queue

fix kubectl drain help to be consistent with documentation

fix kubectl drain usage to be consistent with documentation at https://github.com/kubernetes/kubernetes.github.io/blob/master/docs/user-guide/kubectl/kubectl_drain.md

It would be ideal if both could be sourced from a single file though
2016-09-28 04:55:09 -07:00
Kubernetes Submit Queue e811f5b991 Merge pull request #33566 from guangxuli/k8s_0927_config_test
Automatic merge from submit-queue

clean up the tmp Cert data
2016-09-28 01:46:49 -07:00
Kubernetes Submit Queue 8ce107cbff Merge pull request #33263 from wu8685/flag_string_array
Automatic merge from submit-queue

Update godep for github.com/spf13/pflag and replace StringSlice with String Array in configMap

Update godep for pkg `github.com/spf13/pflag`, because the new flag type `StringArray` within it is needed in issue #27454
2016-09-28 00:20:43 -07:00
Kubernetes Submit Queue 563919c3ec Merge pull request #31763 from fraenkel/drain_finished
Automatic merge from submit-queue

Finished pods can be drained

fixes #26080



```release-note
Kubectl drain will now drain finished Pods
```
2016-09-27 20:30:54 -07:00
guangxuli d8331735a2 clean up the tmp Cert data
use function os.Remove to remove file
2016-09-27 23:17:47 +08:00
wu8685 f4a95ff3d9 fix issue #27454: replace flag type StringSlice with StringArray in configMap 2016-09-27 19:21:46 +08:00
Kubernetes Submit Queue 4d9581345e Merge pull request #32449 from smarterclayton/defend_get
Automatic merge from submit-queue

Unwrap aggregates of size 1 when writing errors

Our special error logic was being defeated by aggregates.

Also, only use aggregate in get when we actually are dealing with
multiple errors.

@kubernetes/kubectl

For other kubectl reviewers - no one should use an aggregate unless you are ranging over a list, and even then ask yourself whether you really care about returning all errors.
2016-09-27 03:09:00 -07:00
Kubernetes Submit Queue 35e9f4d07f Merge pull request #31235 from ping035627/ping035627-patch-0823-1
Automatic merge from submit-queue

Implement replace with a call to testapi.Codec()

Implement replace with a call to testapi.Codec().
2016-09-26 18:02:49 -07:00
Kubernetes Submit Queue 9a899b92ae Merge pull request #29605 from lojies/addportvalidate
Automatic merge from submit-queue

add port validate when --port is set or --expose=true

```shell
$ kubectl run nginx --image=nginx --port=88888 --expose=true
The Deployment "nginx" is invalid.
spec.template.spec.containers[0].ports[0].containerPort: Invalid value: 88888: must be between 1 and 65535, inclusive
$ kubectl run nginx --image=nginx --port=0 --expose=true
error: --port must be a positive integer when exposing a service
```

1. when port is greater than 65535, port is required between 1 and 65535 and deployment 'nginx' can not be created.
2. when port is less than 1, port is not validated and deployment 'nginx' can be created. But service will be created failed.

so i add this change:
when --port is set or --expose=true, validate port range so that error reported can be the same when port is greater than 65535 or less than 1.
And this can also find the port  range error before creating the deployment other than during creating the deployment.
2016-09-26 17:25:30 -07:00
Kubernetes Submit Queue ea688f5e44 Merge pull request #31276 from juanvallejo/jvallejo_update-dry-run-create
Automatic merge from submit-queue

Update kubectl create message when using --dry-run

`kubectl create <resource> <name> --dry-run` provides a misleading success
message.

When commands such as `kubectl new-app node` are run with a
`--dry-run` flag, they make this clear by appending a "(DRY RUN)"
string to the final output. `kubectl create <resource>  <name> --dry-run`
does not do this, providing a potentially misleading output.

This patch appends a "(DRY RUN)" string to the end of a successful
message of `kubectl create` subcommands that support the `--dry-run` flag.

`kubectl create quota quota --dry-run`
```
resourcequota "quota" created
```

`kubectl create quota quota --dry-run`
```
resourcequota "quota" created (DRY RUN)
```

**Release note**:
```release-note
release-note-none
```
2016-09-26 16:01:17 -07:00
Clayton Coleman 9bfa63dbba
Unwrap aggregates of size 1 when writing errors
Also, only use aggregate in get when we actually are dealing with
multiple errors.
2016-09-26 15:56:38 -04:00
Kubernetes Submit Queue beba1e2c8f Merge pull request #33275 from maciaszczykm/remove-kubectl-namespace-cmd
Automatic merge from submit-queue

Remove kubectl namespace command

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

It removes deprecated `kubectl namespace` command, which `has been superseded by the context.namespace field of .kubeconfig files.  See 'kubectl config set-context --help' for more details`. It was done nearly two years ago, so like `// TODO remove once people have been given enough time to notice` comment says it may be a good time to get rid of it.

**Special notes for your reviewer**:

None ATM.

**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
Remove kubectl namespace command
```
2016-09-24 02:51:39 -07:00
Kubernetes Submit Queue b95fa62fe1 Merge pull request #31163 from juanvallejo/jvallejo_filter-resources-before-printing
Automatic merge from submit-queue

add resource filter handling before printing

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

Resources are currently filtered (in order to prevent printing) at print
time in their HumanReadablePrinter handlers. This design makes it not
possible to filter objects when they are printed using any other
printer, such as YAML, JSON, or the NamePrinter.

This patch removes any filters previously added at the printer level for
pods and adds a way to define resource-specific filters before they are
sent to a printer handler. A woking filter handler for pods has also been
implemented.

Filters affect resources being printed through the HumanReadablePrinter,
YAML, JSON, and `--template` printers.

cc @smarterclayton
2016-09-23 10:45:57 -07:00
Marcin Maciaszczyk d2a288de6a Remove kubectl namespace command 2016-09-22 15:46:20 +02:00
juanvallejo 7000e2cf4f
add resource handling before printing
Resources are currently filtered (in order to prevent printing) at print
time in their HumanReadablePrinter handlers. This design makes it not
possible to filter objects when they are printed using any other
printer, such as YAML, JSON, or the NamePrinter.

This patch removes any filters previously added at the printer level for
pods and adds a way to define resource-specific filters before they are
sent to a printer handler. A woking filter handler for pods has also
been
implemented.

Filters affect resources being printed through the HumanReadablePrinter,
YAML, JSON, and `--template` printers.
2016-09-21 10:03:59 -04:00
deads2k e9c1b87b80 move extensions registry packages 2016-09-21 09:14:38 -04:00
Kubernetes Submit Queue 313ef63993 Merge pull request #32680 from sttts/sttts-gracefully-kubectl-without-version
Automatic merge from submit-queue

Behave gracefully in kubectl if /version returns 404

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

It's only about caching the swagger spec here. So it's safe to fall back to non-caching mode and continue.
2016-09-21 04:59:16 -07:00
Clayton Coleman 07f079216e
Make clientcmd defaulting a function of ConfigOverrides and LoadingRules
This commit moves away from using a global variable for default
configuration checking, and instead exposes a method on LoadingRules to
determine whether a particular restclient.Config should be considered
"default". This allows kubectl to provide its own defaults (the same
as before, KUBERNETES_MASTER and the static localhost:8080 values) while
allowing other clients to avoid defining them.

In-cluster config defaulting is now easier to read.
2016-09-21 01:28:06 -04:00
Mayank Kumar 822b2d791c fix drain help and make consistent with doc 2016-09-20 21:42:01 -07:00
Kubernetes Submit Queue c97246247a Merge pull request #30199 from dims/re-add-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

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
2016-09-20 01:49:45 -07:00
Kubernetes Submit Queue 8d0518d4d2 Merge pull request #32897 from deads2k/api-07-remove-dead-mapper
Automatic merge from submit-queue

remove dead mapper

Removing a write-only field I found looking at the registration code.
2016-09-19 23:12:06 -07:00
Kubernetes Submit Queue 2941069307 Merge pull request #32894 from deads2k/cli-01-remove-arg
Automatic merge from submit-queue

make --include-extended-apis deprecated and remove plumbing

Marks a dead CLI parameter as deprecated and removes the plumbing for it.
2016-09-19 21:11:04 -07:00
Davanum Srinivas e1373cf516 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
2016-09-19 13:01:59 -04:00
deads2k 4aa61ddcb2 remove dead mapper 2016-09-19 09:57:19 -04:00
Yanqiang Miao ed3b3ad47d delete a unused function in the 'pkg/kubectl/cmd/util/helpers.go'
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

update

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2016-09-17 12:43:59 +08:00
Kubernetes Submit Queue 051ee17094 Merge pull request #30815 from ymqytw/refactoring
Automatic merge from submit-queue

Fixes #30562: Refactor kubectl command options to use common struct for common file params

Fixes #30562 : Refactor common go struct options in pkg/kubectl/cmd/*.go.
@pwittrock
2016-09-16 19:48:22 -07:00
deads2k 862415aaa2 make --include-extended-apis deprecated and remove plumbing 2016-09-16 16:05:52 -04:00
Kubernetes Submit Queue 27c093ea90 Merge pull request #32048 from smarterclayton/consistent_errors
Automatic merge from submit-queue

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.

Related to #32009 but isn't the fix (so far)
2016-09-15 20:13:48 -07:00
deads2k 771915c6c4 make shortcut expanding restmapper handle all 2016-09-15 11:03:51 -04:00
deads2k 4359c79f53 add FirstHitRESTMapper for adding thirdparty resources 2016-09-15 10:26:39 -04:00
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