Unverified Commit ae53b789 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

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. https://github.com/kubernetes/kubernetes/commit/121a91eb12a186640c634266e5d190c3ecd7f527 ContainerStatus.LogPath was added since Kubernetes 1.7. https://github.com/kubernetes/kubernetes/commit/c3b52267ca615e1efca70e47f24a39bfcab321cc 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: 's avatarLantao Liu <lantaol@google.com> **Release note**: ```release-note none ```
parents d6967f35 4bb16659
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment