mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 12:32:03 +00:00
Shorten container ID in events
Log only first 12 characters of container ID in events.
This commit is contained in:
parent
5e5c1d1097
commit
d58768b351
@ -609,7 +609,7 @@ func (dm *DockerManager) runContainer(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ref != nil {
|
if ref != nil {
|
||||||
dm.recorder.Eventf(ref, "created", "Created with docker id %v", dockerContainer.ID)
|
dm.recorder.Eventf(ref, "created", "Created with docker id %v", util.ShortenString(dockerContainer.ID, 12))
|
||||||
}
|
}
|
||||||
|
|
||||||
binds := makeMountBindings(opts.Mounts)
|
binds := makeMountBindings(opts.Mounts)
|
||||||
@ -656,12 +656,12 @@ func (dm *DockerManager) runContainer(
|
|||||||
if err = dm.client.StartContainer(dockerContainer.ID, hc); err != nil {
|
if err = dm.client.StartContainer(dockerContainer.ID, hc); err != nil {
|
||||||
if ref != nil {
|
if ref != nil {
|
||||||
dm.recorder.Eventf(ref, "failed",
|
dm.recorder.Eventf(ref, "failed",
|
||||||
"Failed to start with docker id %v with error: %v", dockerContainer.ID, err)
|
"Failed to start with docker id %v with error: %v", util.ShortenString(dockerContainer.ID, 12), err)
|
||||||
}
|
}
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
if ref != nil {
|
if ref != nil {
|
||||||
dm.recorder.Eventf(ref, "started", "Started with docker id %v", dockerContainer.ID)
|
dm.recorder.Eventf(ref, "started", "Started with docker id %v", util.ShortenString(dockerContainer.ID, 12))
|
||||||
}
|
}
|
||||||
return dockerContainer.ID, nil
|
return dockerContainer.ID, nil
|
||||||
}
|
}
|
||||||
@ -1141,7 +1141,7 @@ func (dm *DockerManager) killContainer(containerID types.UID) error {
|
|||||||
glog.Warningf("No ref for pod '%v'", ID)
|
glog.Warningf("No ref for pod '%v'", ID)
|
||||||
} else {
|
} else {
|
||||||
// TODO: pass reason down here, and state, or move this call up the stack.
|
// TODO: pass reason down here, and state, or move this call up the stack.
|
||||||
dm.recorder.Eventf(ref, "killing", "Killing %v", ID)
|
dm.recorder.Eventf(ref, "killing", "Killing with docker id %v", util.ShortenString(ID, 12))
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user