Commit Graph

2480 Commits (0b04890605fd20ce2aba1ad56cc42a86c58ea564)

Author SHA1 Message Date
nikhiljindal bbea084375 Enable kubectl describe rs to work when apiserver does not support pods 2016-10-04 13:27:31 -07:00
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
Kubernetes Submit Queue f9dd76564c Merge pull request #33686 from ymqytw/format_json_printer_for_runtime.Unknown
Automatic merge from submit-queue

formatting json printer for runtime.Unknown

Formatting JSONPrinter.
It prints everything in one single line before.
Now it prints in well-formatted way.
2016-09-30 06:13:17 -07:00
Mike Danese 5f2569c16d allow kubectl -f to filter by selector 2016-09-30 00:42:35 -07:00
ymqytw d74704254d formatting json printer for runtime.Unknown 2016-09-29 08:45:08 -07:00
Kubernetes Submit Queue 5a59f3bbcc Merge pull request #33626 from lojies/changeport
Automatic merge from submit-queue

use len(params["port"]) > 0 to replace port > 0

**What this PR does / why we need it**:
port also needs to be passed to server when port is negative or zero.
this is an omission of pr https://github.com/kubernetes/kubernetes/pull/29605

**Which issue this PR 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-29 07:52:38 -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
lojies 9ef3ef3f17 use len > 0 to replace port > 0 2016-09-28 10:23:25 +08: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
Kubernetes Submit Queue 67219f4041 Merge pull request #32867 from kargakis/move-events-sort
Automatic merge from submit-queue

kubectl: move events sorting interface to the api for general use

Split from https://github.com/kubernetes/kubernetes/pull/19343

@kubernetes/kubectl
2016-09-22 20:39:29 -07:00
Kubernetes Submit Queue 3906acfba8 Merge pull request #33079 from ping035627/ping035627-patch-0920
Automatic merge from submit-queue

Merge the "var" segment

So much "var" doesn't seem clear, suggest to merge them.
2016-09-22 14:24:27 -07:00
Kubernetes Submit Queue 4b700f41ec Merge pull request #32944 from k82cn/refactor_builder_visitorResult
Automatic merge from submit-queue

Refactor Builder.visitorResult by extra methonds.

**What this PR does / why we need it**:
Code polish; it'll make code readable.
2016-09-22 13:45:09 -07:00
Marcin Maciaszczyk d2a288de6a Remove kubectl namespace command 2016-09-22 15:46:20 +02:00
Kubernetes Submit Queue 5af04d1dd1 Merge pull request #32876 from errordeveloper/more-cert-utils
Automatic merge from submit-queue

Refactor cert utils into one pkg, add funcs from bootkube for kubeadm to use

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

We have ended-up with rather incomplete and fragmented collection of utils for handling certificates. It may be worse to consider using `cfssl` for doing all of these things, but for now there is some functionality that we need in `kubeadm` that we can borrow from bootkube. It makes sense to move the utils from bookube into core, as discussed in #31221.

**Special notes for your reviewer**: I've taken the opportunity to review names of existing funcs and tried to make some improvements in that area (with help from @peterbourgon).

**Release note**:

```release-note
NONE
```
2016-09-22 01:29:46 -07: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
Kubernetes Submit Queue 4099a5cc98 Merge pull request #33136 from smarterclayton/default_config
Automatic merge from submit-queue

When client config is default or default is invalid, check ICC

Alternative fix to #33019
2016-09-21 02:21:34 -07:00
Kubernetes Submit Queue b245886658 Merge pull request #33058 from MHBauer/dead-interface
Automatic merge from submit-queue

delete private interface with no references in package

<!--  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**:
code quality. 

**Which issue this PR fixes**:
does not fix anything. removes unused interface. 

**Special notes for your reviewer**:
It does not do anything. Let us remove it.

**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
NONE
```
2016-09-20 23:35:49 -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
PingWang de6a2452fa combine var
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-09-20 16:56:25 +08: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
Morgan Bauer fa28ee8683
delete private interface with no references in package 2016-09-20 00:13:16 +00: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
Ilya Dmitrichenko 386fae4592
Refactor utils that deal with certs
- merge `pkg/util/{crypto,certificates}`
- add funcs from `github.com/kubernetes-incubator/bootkube/pkg/tlsutil`
- ensure naming of funcs is fairly consistent
2016-09-19 09:03:42 +01:00
Michail Kargakis b87e8c79ca kubectl: move events sorting interface to the api for general use 2016-09-18 19:25:42 +02:00
Kubernetes Submit Queue 8fd414537b Merge pull request #32823 from nikhiljindal/descNs
Automatic merge from submit-queue

Allow kubectl describe ns to pass if server does not support resource quotas and limit ranges

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

Context: federation-apiserver does not support limit ranges and resource quotas. Hence `kubectl describe ns` fails right now.
Fixing it so that `kubectl describe ns` does not error out and atleast prints information about the namespace.

cc @kubernetes/sig-cluster-federation @kubernetes/kubectl
2016-09-17 04:04:20 -07:00
Klaus Ma d55006d38f Refactor Builder.visitorResult by extra methonds. 2016-09-17 17:36:13 +08:00