k3s/staging
Kubernetes Submit Queue f49708bd49
Merge pull request #66643 from smarterclayton/improve_events
Automatic merge from submit-queue (batch tested with PRs 66445, 66643, 60551). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Improve the output of `kubectl get events`

Events have long shown the most data of the core objects in their output, but that data is of varying use to a user. Following the principle that events are intended for the system to communicate information back to the user, and that Message is the primary human readable field, this commit alters the default columns to ensure event is shown with the most width given to the message, and all other fields organized by their relevance to the message.

1. Events are no longer sorted in the printer (this was a bug and was broken with paging and server side rendering)
2. Only the last seen, type, reason, kind, and message fields are shown by default, which makes the message prominent
3. Source, subobject, count, and first seen are only shown under `-o wide`
4. The duration fields were changed to be the more precise output introduced for job duration (2-3 sig figs)
5. Prioritized the column order for scanning - when, how important, what kind of error, what kind of object, and the message.
6. Trim trailing newlines on the message.

```release-note
Improved the output of `kubectl get events` to prioritize showing the message, and move some fields to `-o wide`.
```

```
$ kubectl get events --sort-by lastTimestamp
LAST SEEN TYPE      REASON                   KIND                    MESSAGE
16m       Normal    SawCompletedJob          CronJob                 Saw completed job: image-mirror-origin-v3.11-quay-1532581200
16m       Normal    SuccessfulDelete         CronJob                 Deleted job image-mirror-origin-v3.11-quay-1532577600
14m       Normal    Scheduled                Pod                     Successfully assigned 50c42204-9091-11e8-b2a1-0a58ac101869 to origin-ci-ig-n-fqfh
14m       Normal    Pulling                  Pod                     pulling image "docker-registry.default.svc:5000/ci/commenter:latest"
14m       Normal    Created                  Pod                     Created container
14m       Normal    Pulled                   Pod                     Successfully pulled image "docker-registry.default.svc:5000/ci/commenter:latest"
14m       Normal    Started                  Pod                     Started container
14m       Normal    SandboxChanged           Pod                     Pod sandbox changed, it will be killed and re-created.
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m14s     Normal    ScaleDown                Pod                     deleting pod for node scale down
4m13s     Normal    SuccessfulCreate         ReplicationController   Created pod: tide-30-hmncf
4m13s     Normal    Scheduled                Pod                     Successfully assigned tide-30-hmncf to origin-ci-ig-n-x64l
4m12s     Normal    SuccessfulCreate         ReplicationController   Created pod: console-jenkins-operator-16-dd5k8
4m12s     Normal    SuccessfulCreate         ReplicationController   Created pod: sinker-23-scfmt
```
2018-07-31 15:56:07 -07:00
..
src Merge pull request #66643 from smarterclayton/improve_events 2018-07-31 15:56:07 -07:00
BUILD Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
OWNERS
README.md

README.md

External Repository Staging Area

This directory is the staging area for packages that have been split to their own repository. The content here will be periodically published to respective top-level k8s.io repositories.

Repositories currently staged here:

The code in the staging/ directory is authoritative, i.e. the only copy of the code. You can directly modify such code.

Using staged repositories from Kubernetes code

Kubernetes code uses the repositories in this directory via symlinks in the vendor/k8s.io directory into this staging area. For example, when Kubernetes code imports a package from the k8s.io/client-go repository, that import is resolved to staging/src/k8s.io/client-go relative to the project root:

// pkg/example/some_code.go
package example

import (
  "k8s.io/client-go/dynamic" // resolves to staging/src/k8s.io/client-go/dynamic
)

Once the change-over to external repositories is complete, these repositories will actually be vendored from k8s.io/<package-name>.