mirror of https://github.com/k3s-io/k3s
Merge pull request #63268 from Random-Liu/kubelet-readlog-backward-compatible
Automatic merge from submit-queue. 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>. Make kubelet `ReadLogs` backward compatible. `containerLogPathLabelKey` label was added in dockershim since 1.5.pull/8/head121a91eb12
ContainerStatus.LogPath was added since Kubernetes 1.7.c3b52267ca
I believe it is safe to reply on this field without backward compatibility issue. And `crictl` is using it as well https://github.com/kubernetes-incubator/cri-tools/blob/master/cmd/crictl/logs.go#L88. With this change, in the future, kubelet `ReadLogs` will be backward compatible as long as the log format is backward compatible. @feiskyer @yujuhong @kubernetes/sig-node-pr-reviews Signed-off-by: Lantao Liu <lantaol@google.com> **Release note**: ```release-note none ```
commit
ae53b78971
|
@ -736,10 +736,7 @@ func (m *kubeGenericRuntimeManager) GetContainerLogs(pod *v1.Pod, containerID ku
|
|||
glog.V(4).Infof("failed to get container status for %v: %v", containerID.String(), err)
|
||||
return fmt.Errorf("Unable to retrieve container logs for %v", containerID.String())
|
||||
}
|
||||
labeledInfo := getContainerInfoFromLabels(status.Labels)
|
||||
annotatedInfo := getContainerInfoFromAnnotations(status.Annotations)
|
||||
path := buildFullContainerLogsPath(pod.UID, labeledInfo.ContainerName, annotatedInfo.RestartCount)
|
||||
return m.ReadLogs(path, containerID.ID, logOptions, stdout, stderr)
|
||||
return m.ReadLogs(status.GetLogPath(), containerID.ID, logOptions, stdout, stderr)
|
||||
}
|
||||
|
||||
// GetExec gets the endpoint the runtime will serve the exec request from.
|
||||
|
|
Loading…
Reference in New Issue