mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #23658 from Random-Liu/fix-termination-message-path
Fix TerminationMessagePath
This commit is contained in:
commit
1a9cb97bdd
@ -384,11 +384,14 @@ func (dm *DockerManager) inspectContainer(id string, podName, podNamespace strin
|
||||
|
||||
terminationMessagePath := containerInfo.TerminationMessagePath
|
||||
if terminationMessagePath != "" {
|
||||
if path, found := iResult.Volumes[terminationMessagePath]; found {
|
||||
if data, err := ioutil.ReadFile(path); err != nil {
|
||||
message = fmt.Sprintf("Error on reading termination-log %s: %v", path, err)
|
||||
} else {
|
||||
message = string(data)
|
||||
for _, mount := range iResult.Mounts {
|
||||
if mount.Destination == terminationMessagePath {
|
||||
path := mount.Source
|
||||
if data, err := ioutil.ReadFile(path); err != nil {
|
||||
message = fmt.Sprintf("Error on reading termination-log %s: %v", path, err)
|
||||
} else {
|
||||
message = string(data)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user