kubernetes/pkg/kubelet/kuberuntime
Clayton Coleman 49250c6efc
Make container create, start, and stop events consistent
The messages for container lifecycle events are subtly inconsistent
and should be unified.

First, the field format for containers is hard to parse for a human,
so include the container name directly in the message for create
and start, and for kill remove the container runtime prefix.

Second, the pulling image event has inconsistent capitalization, fix
that to be sentence without punctuation.

Third, the kill container event was unnecessarily wordy and inconsistent
with the create and start events. Make the following changes:

* Use 'Stopping' instead of 'Killing' since kill is usually reserved for
  when we decide to hard stop a container
* Send the event before we dispatch the prestop hook, since this is an
  "in-progress" style event vs a "already completed" type event
* Remove the 'cri-o://' / 'docker://' prefix by printing the container
  name instead of id (we already do that replacement at the lower level
  to prevent high cardinality events)
* Use 'message' instead of 'reason' as the argument name since this is a
  string for humans field, not a string for machines field
* Remove the hash values on the container spec changed event because no
  human will ever be able to do anything with the hash value
* Use 'Stopping container %s(, explanation)?' form without periods to
  follow event conventions

The end result is a more pleasant message for humans:

```
35m         Normal    Created                       Pod    Created container
35m         Normal    Started                       Pod    Started container
10m         Normal    Killing                       Pod    Killing container cri-o://installer:Need to kill Pod
10m         Normal    Pulling                       Pod    pulling image "registry.svc.ci.openshift.org/openshift/origin-v4.0-2019-02-10-172026@sha256:3da5303d4384d24691721c1cf2333584ba60e8f82c9e782f593623ce8f83ddc5"
```

becomes

```
35m         Normal    Created                       Pod    Created container installer
35m         Normal    Started                       Pod    Started container installer
10m         Normal    Killing                       Pod    Stopping container installer
10m         Normal    Pulling                       Pod    Pulling image "registry.svc.ci.openshift.org/openshift/origin-v4.0-2019-02-10-172026@sha256:3da5303d4384d24691721c1cf2333584ba60e8f82c9e782f593623ce8f83ddc5"
```
2019-02-10 16:39:42 -05:00
..
logs Move from glog to klog 2018-11-10 07:50:31 -05:00
BUILD drop VerifyFeatureGatesUnchanged 2018-11-21 11:51:33 -05:00
doc.go cmd/kubelet 2016-11-23 15:53:09 -08:00
fake_kuberuntime_manager.go Merge pull request #68181 from Pingan2017/golint 2018-09-28 01:56:26 -07:00
helpers_linux_test.go Fix unit tests calling SetFeatureGateDuringTest incorrectly 2018-11-21 11:51:33 -05:00
helpers_linux.go fix #51135 make CFS quota period configurable, adds a cli flag and config option to kubelet to be able to set cpu.cfs_period and defaults to 100ms as before. 2018-09-01 20:19:59 +02:00
helpers_test.go Fix unit tests calling SetFeatureGateDuringTest incorrectly 2018-11-21 11:51:33 -05:00
helpers_unsupported.go Setup windows container config to kubelet CRI 2018-02-28 09:56:41 +08:00
helpers_windows.go Setup windows container config to kubelet CRI 2018-02-28 09:56:41 +08:00
helpers.go Move from glog to klog 2018-11-10 07:50:31 -05:00
instrumented_services_test.go fix golint failures - /pkg/kubelet/images 2018-09-17 10:52:25 +08:00
instrumented_services.go Add monitoring for RuntimeClass 2019-02-04 16:01:29 -08:00
kuberuntime_container_linux_test.go Merge pull request #72280 from verb/kubelet-no-containertype 2019-01-10 01:18:41 -08:00
kuberuntime_container_linux.go fix #51135 make CFS quota period configurable, adds a cli flag and config option to kubelet to be able to set cpu.cfs_period and defaults to 100ms as before. 2018-09-01 20:19:59 +02:00
kuberuntime_container_test.go Remove container type from kubelet runtime labels 2018-12-21 15:47:47 +01:00
kuberuntime_container_unsupported.go Setup windows container config to kubelet CRI 2018-02-28 09:56:41 +08:00
kuberuntime_container_windows.go Setup windows security context in CRI 2018-06-05 09:27:40 +08:00
kuberuntime_container.go Make container create, start, and stop events consistent 2019-02-10 16:39:42 -05:00
kuberuntime_gc_test.go Merge pull request #58740 from YuxiJin-tobeyjin/add-ut-for-kuberuntime-gc 2018-04-19 12:27:19 -07:00
kuberuntime_gc.go Move from glog to klog 2018-11-10 07:50:31 -05:00
kuberuntime_image_test.go Pass PodSandboxConfig to PullImage method in CRI 2018-12-07 10:10:22 +08:00
kuberuntime_image.go Pass PodSandboxConfig to PullImage method in CRI 2018-12-07 10:10:22 +08:00
kuberuntime_logs.go kubelet: plumb context for log requests 2018-08-10 17:35:46 -07:00
kuberuntime_manager_test.go Merge pull request #64648 from dcbw/remove-unused-param 2019-02-01 09:03:45 -08:00
kuberuntime_manager.go Make container create, start, and stop events consistent 2019-02-10 16:39:42 -05:00
kuberuntime_sandbox_test.go Merge pull request #73285 from tallclair/typed-runtimeclass 2019-02-04 16:13:30 -08:00
kuberuntime_sandbox.go Surface selected pod RuntimeHandler in Kubelet logs 2018-12-17 16:36:47 -08:00
labels_test.go Remove container type from kubelet runtime labels 2018-12-21 15:47:47 +01:00
labels.go Remove container type from kubelet runtime labels 2018-12-21 15:47:47 +01:00
legacy_test.go fix golint failures - /pkg/kubelet/images 2018-09-17 10:52:25 +08:00
legacy.go fix golint failures - /pkg/kubelet/images 2018-09-17 10:52:25 +08:00
security_context_test.go security_context_test.go(TestVerifyRunAsNonRoot): add more test cases. 2017-12-20 18:02:52 +01:00
security_context.go ProcMount: add api options and feature gate 2018-08-30 11:40:02 -04:00