Commit Graph

338 Commits (c317f929907bc292ddf29cf4558d1663f1456b08)

Author SHA1 Message Date
Kubernetes Submit Queue e3a3743410 Merge pull request #40073 from matthyx/master
Automatic merge from submit-queue (batch tested with PRs 40046, 40073, 40547, 40534, 40249)

Issue #13501 - printEvent Source to much more cleaner

Create a formatEventSource func and use it.



**What this PR does / why we need it**:
Adds a smarter way to print EventSource, removing "{ }" and the eventual extra ", " when Host is empty.
It was also reported in OpenShift issue https://github.com/openshift/origin/issues/6586

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

**Special notes for your reviewer**:
I have used this new func in all user facing printouts, but there are other places where EventSource are printed to logs, like DumpEventsInNamespace in test/e2e/framework/util.go for instance.
Don't know if I should correct there too...

**Release note**:

```release-note
Improve formatting of EventSource in kubectl get and kubectl describe
```
2017-01-26 16:10:36 -08:00
Matthias Bertschy 42eb8ff0e7 Issue #13501 - create a formatEventSource func and use it. 2017-01-26 08:23:44 +01:00
deads2k 5a8f075197 move authoritative client-go utils out of pkg 2017-01-24 08:59:18 -05:00
deads2k 9c6a522882 mechanical results of client auth plugin 2017-01-20 08:05:18 -05:00
Clayton Coleman 9a2a50cda7
refactor: use metav1.ObjectMeta in other types 2017-01-17 16:17:19 -05:00
deads2k 6a4d5cd7cc start the apimachinery repo 2017-01-11 09:09:48 -05:00
Kubernetes Submit Queue 4d9bd12cac Merge pull request #39536 from screeley44/add-storage-class
Automatic merge from submit-queue (batch tested with PRs 39673, 39536, 39617, 39540, 39686)

Adding storageclass to resource printers for get pv and pvc

Give ability to see what Storage Class a PV is using, as well as what StorageClass a PVC has requested

```
[root@screeley-sc1 gce]# kubectl get pv
NAME                                       CAPACITY   ACCESSMODES   RECLAIMPOLICY   STATUS      CLAIM                            STORAGECLASS   REASON    AGE
pv-gce                                     2Gi        RWO           Retain          Available                                    anything                 41m
pvc-774217fd-d440-11e6-9d11-42010af00010   2Gi        RWO           Delete          Bound       default/gce-claim-storageclass   slow                     0s

[root@screeley-sc1 gce]# kubectl get pvc
NAME                              STATUS    VOLUME                                     CAPACITY   ACCESSMODES   REQUESTEDSTORAGECLASS   AGE
gce-claim-class1                  Pending                                                                                      		6m
gce-claim-classless               Pending                                                                                      		6m
gce-claim-storageclass            Bound     pvc-774217fd-d440-11e6-9d11-42010af00010   2Gi        RWO           slow           		6m
gce-claim-storageclass-nonexist   Pending                                                                       superfly       		4s
```
@kubernetes/sig-storage
2017-01-10 20:38:15 -08:00
Kubernetes Submit Queue 9ef9630976 Merge pull request #39486 from ncdc/allow-missing-keys-in-templates
Automatic merge from submit-queue (batch tested with PRs 39486, 37288, 39477, 39455, 39542)

Allow missing keys in templates by default

Switch to allowing missing keys in jsonpath templates by default.

Add support for allowing/disallowing missing keys in go templates
(default=allow).

Add --allow-missing-template-keys flag to control this behavior (default=true /
allow missing keys).

Fixes #37991

@kubernetes/sig-cli-misc @kubernetes/api-reviewers @smarterclayton @fabianofranz @liggitt @pwittrock
2017-01-10 14:33:10 -08:00
Scott Creeley 79fea8857d Adding storageclass to resource printers 2017-01-09 10:57:28 -05:00
Andy Goldstein 80c5cd8b88 Allow missing keys in templates by default
Switch to allowing missing keys in jsonpath templates by default.

Add support for allowing/disallowing missing keys in go templates
(default=allow).

Add --allow-missing-template-keys flag to control this behavior
(default=true / allow missing keys).
2017-01-09 10:35:46 -05:00
Xing Zhou 5edac7c575 Add software versions to "kubectl get nodes -o wide" output.
Added "OS-IMAGE" and "KERNEL-VERSION" two columns to
"kubectl get nodes -o wide" output. This will help to provide
more information for user to locate or debug issues. See discussion
in ticket #25579
2017-01-09 03:06:28 +00:00
shiywang 31c4d158af move wideHeader string into handlerEntry
change var name, remove formatWideHeaders()

go fmt
2017-01-06 14:20:50 +08:00
Xing Zhou 4fcc770367 Add three more columns to `kubectl get deploy -o wide` output.
Added CONTAINER(S), IMAGE(S) and SELECTOR fields to the output
of `kubectl get deploy -o wide`.
2016-12-28 03:07:13 +00:00
Kubernetes Submit Queue 52df372f9b Merge pull request #35805 from dgoodwin/token-mgmt
Automatic merge from submit-queue

Implement kubeadm bootstrap token management

Creates bootstrap tokens as secrets per the specification in #30707 

_WARNING_: These are not currently hooked up to the discovery service or the token it creates.

Still TODO:
- [x] delete tokens
- [x] merge with #35144 and adopt it's testing approach
- [x] determine if we want wholesale json output & templating like kubectl (we do not have an API object with the data we want here) may require a bit of plumbing.
- [x] allow specifying a token duration on the CLI
- [x] allow configuring the default token duration
- [x] hook up the initial token created during init

Sample output:

```
(root@centos1 ~) $ kubeadm token create
Running pre-flight checks
<cmd/token> Token secret created: f6dc69.c43e491752c4a0fd
(root@centos1 ~) $ kubeadm token create
Running pre-flight checks
<cmd/token> Token secret created: 8fad2f.e7b78c8a5f7c7b9a
(root@centos1 ~) $ kubeadm token list  
Running pre-flight checks
ID        TOKEN                     EXPIRATION
44d805    44d805.a4e78b6cf6435e33   23h
4f65bb    4f65bb.d006a3c7a0e428c9   23h
6a086e    6a086e.2ff99f0823236b5b   23h
8fad2f    8fad2f.e7b78c8a5f7c7b9a   23h
f6dc69    f6dc69.c43e491752c4a0fd   23h
f81653    f81653.9ab82a2926c7e985   23h
```
2016-12-20 14:44:40 -08:00
Devan Goodwin bfe345dd86 Implement kubeadm bootstrap token management.
Adds kubeadm subcommands to create, list, and delete bootstrap tokens.
Tokens can be created with a TTL duration, or 0 for tokens that will not
expire. The create command can also be used to specify your own token
(for use when bootstrapping masters and nodes in parallel), or update an
existing token's secret or ttl.

Marked "ex" for experimental for now as the boostrap controllers are not
yet hooked up in core.
2016-12-20 11:43:55 -04:00
tianshapjq 1453cd6264 reduce decoding times by changing kubectl.Filter(runtime.Object, *PrintOptions)'s return value 2016-12-16 09:37:11 +08:00
Clayton Coleman 42d410fdde
Switch to use pkg/apis/meta/v1/unstructured and the new interfaces
Avoid directly accessing an unstructured type if it is not required.
2016-12-10 18:05:28 -05:00
Kubernetes Submit Queue c323c72a66 Merge pull request #37943 from ailusazh/ailusa
Automatic merge from submit-queue (batch tested with PRs 36626, 37294, 37463, 37943, 36541)

Add Version to the resource printer for 'get nodes'

<!--  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>(, fixes #<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-12-08 00:23:15 -08:00
Clayton Coleman 3454a8d52c
refactor: update bazel, codec, and gofmt 2016-12-03 19:10:53 -05:00
Clayton Coleman 5df8cc39c9
refactor: generated 2016-12-03 19:10:46 -05:00
ailusazh f98c2fbbcf Add Version to the resource printer for 'get nodes' 2016-12-02 13:06:23 +00:00
Kubernetes Submit Queue 15fa210056 Merge pull request #36217 from xilabao/get-detail-about-rolebinding
Automatic merge from submit-queue

add kubectl get rolebindings/clusterrolebindings -o wide

Use "-o wide" to get more information of roleRef/subjects
`kubectl get rolebindings -o wide`

|NAME | AGE | ROLE | USERS | GROUPS | SERVICEACCOUNTS|
|:-------|:-------|:-------|:-------|:-------|:-------|
|admin-resource-binding |1s | Role/admin-resource-role | test | | |


`kubectl get clusterrolebindings -o wide`

|NAME|AGE|ROLE|USERS|GROUPS|SERVICEACCOUNTS|
|:-------|:-------|:-------|:-------|:-------|:-------|
|cluster-admin|27s|cluster-admin| |system:masters| |
|system:basic-user|27s|system:basic-user| |system:authenticated, system:unauthenticated | |
|system:controller:replication-controller|27s|system:controller:replication-controller | | |kube-system/replication-controller|
|system:discovery |27s|system:discovery| |system:authenticated, system:unauthenticated| |
2016-12-01 07:52:11 -08:00
Kubernetes Submit Queue 56779576f0 Merge pull request #36424 from xilabao/fix-forbid-clusterrole-with-namespace
Automatic merge from submit-queue

fix forbid clusterrole with namespace

run `kubectl get clusterroles --all-namespaces`
old version
return error message:
```
NAMESPACE   NAME      AGE
clusterRole is not namespaced
clusterRole is not namespaced
clusterRole is not namespaced
clusterRole is not namespaced
clusterRole is not namespaced
clusterRole is not namespaced
clusterRole is not namespaced
```


```release-note

Add error message when trying to use clusterrole with namespace in kubectl

```
2016-12-01 00:39:12 -08:00
Kubernetes Submit Queue 3c618a8167 Merge pull request #36726 from xilabao/fix-get-podsecuritypolicy
Automatic merge from submit-queue

fix kubectl get psp

old result:
```shell
./cluster/kubectl.sh --token=/system:masters get psp
NAME         PRIV      CAPS      VOLUMEPLUGINS   SELINUX    RUNASUSER
privileged   true      []        RunAsAny        RunAsAny   RunAsAny   RunAsAny   false     [*]
restricted   false     []        RunAsAny        RunAsAny   RunAsAny   RunAsAny   false     [*]
```

new result:
```shell
./cluster/kubectl.sh --token=/system:masters get psp
NAME         PRIV      CAPS      SELINUX    RUNASUSER   FSGROUP    SUPGROUP   READONLYROOTFS   VOLUMES
privileged   true      []        RunAsAny   RunAsAny    RunAsAny   RunAsAny   false            [*]
restricted   false     []        RunAsAny   RunAsAny    RunAsAny   RunAsAny   false            [*]
```

test.yaml
```
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
  name: privileged
spec:
  fsGroup:
    rule: RunAsAny
  privileged: true
  runAsUser:
    rule: RunAsAny
  seLinux:
    rule: RunAsAny
  supplementalGroups:
    rule: RunAsAny
  volumes:
  - '*'
---
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
  name: restricted
spec:
  fsGroup:
    rule: RunAsAny
  runAsUser:
    rule: RunAsAny
  seLinux:
    rule: RunAsAny
  supplementalGroups:
    rule: RunAsAny
  volumes:
  - '*'
```
2016-11-30 02:04:49 -08:00
Clayton Coleman 35a6bfbcee
generated: refactor 2016-11-23 22:30:47 -06:00
deads2k baa2418b11 let printer update unstructured list 2016-11-14 10:42:28 -05:00
xilabao b472d49bf2 fix kubectl get psp 2016-11-14 10:29:37 +08:00
Kubernetes Submit Queue a551dff534 Merge pull request #35901 from justinsb/kubectl_show_labels
Automatic merge from submit-queue

kubectl: show node label if defined

We are moving towards marking master nodes as tainted, and not
necessarily unschedulable.  Further now we encourage users to taint
nodes, marking them unschedulable.

Thus the reliance on "Unschedulable" is not really a great indicator for
the master.

Instead, recognize the existing node 'role' markers, and surface them
where Unschedulable is (in the status).

We recognize:

 * a kubernetes.io/role label
 * a kubeadm.alpha.kubernetes.io/role label
~a taint with Key 'dedicated'~

Fix #33533
2016-11-10 03:12:33 -08:00
Marcin 9cee1456a6 Describe and get support for the updated api + tests 2016-11-09 13:39:16 +01:00
Maciej Szulik 5f8e76b479 Add resource printer and describer for PodDisruptionBudget 2016-11-09 11:33:51 +01:00
xilabao b346911299 fix forbid clusterrole with namespace 2016-11-08 16:25:33 +08:00
xilabao 93be603d8f add kubectl get rolebindings/clusterrolebindings -o wide 2016-11-08 16:19:57 +08:00
Justin Santa Barbara 98f7c3919e kubectl: show node label if defined
We are moving towards marking master nodes as tainted, and not
necessarily unschedulable.  Further now we encourage users to cordon
nodes, marking them unschedulable.

Thus the reliance on "Unschedulable" is not really a great indicator for
the master.

So, recognize the existing node 'role' markers, and surface them
where Unschedulable is (in the status).

We recognize:

 * a kubernetes.io/role label
 * a kubeadm.alpha.kubernetes.io/role label

Fix #33533
2016-11-07 18:38:21 -05:00
Maciej Szulik 41d88d30dd Rename ScheduledJob to CronJob 2016-11-07 10:14:12 +01:00
deads2k 61673c4b39 make kubectl get generic with respect to objects 2016-11-04 09:04:57 -04:00
Anirudh a5bdc5f509 Set reason and message on Pod during nodecontroller eviction
Pods which are evicted by the nodecontroller due to network
malfunction, or unresponsive kubelet should be differentiated
from termination initiated by other sources. The reason/message
are consumed by kubectl to provide a better summary using get/describe.
2016-11-03 13:47:03 -07:00
deads2k 235678d591 always allow decoding of status when returned from the API 2016-11-01 16:36:45 -04:00
Janet Kuo 10aee82ae3 Rename PetSet API to StatefulSet 2016-10-27 17:25:10 -07:00
Kubernetes Submit Queue 10ebd65913 Merge pull request #34922 from zreigz/add-nodeport
Automatic merge from submit-queue

Add NodePort value in kubectl output

This PR enhances kubectl output after the command execution: `kubectl get svc`.
It additionally shows the value of the NodePort.

This PR is a response for this issue: https://github.com/kubernetes/kubernetes/issues/34100
2016-10-20 06:10:37 -07:00
Scott Creeley 86f1a94be5 Adding default StorageClass annotation printout for resource_printer 2016-10-19 10:59:07 -04:00
Lukasz Zajaczkowski b7da874789 Add NodePort value in kubectl output 2016-10-17 07:57:34 +02:00
Łukasz Oleś 5d2e215652 Add NumberReady to DaemonSet status
Fixes #25605
2016-10-12 15:15:10 +02:00
Kubernetes Submit Queue 882d431f96 Merge pull request #33552 from floreks/kubectl-node-external-ip
Automatic merge from submit-queue

kubectl: Add external ip information to node when '-o wide' is used

<!--  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
-->

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

**Special notes for your reviewer**: 
1. Is it possible to expose multiple external ips on the node?
2. Should this be supported or first one be taken like now? 
3. Should more node address types be shown?

I'll add tests if solution is approved.

**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: Add external ip information to node when '-o wide' is used
```
2016-10-07 21:10:27 -07:00
ymqytw d74704254d formatting json printer for runtime.Unknown 2016-09-29 08:45:08 -07:00
Sebastian Florek 776c551523
kubectl: Add external ip information to node when '-o wide' is used 2016-09-29 13:25:06 +02: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
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
PingWang de6a2452fa combine var
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
2016-09-20 16:56:25 +08:00
Michail Kargakis b87e8c79ca kubectl: move events sorting interface to the api for general use 2016-09-18 19:25:42 +02:00