diff --git a/pkg/kubelet/container/runtime.go b/pkg/kubelet/container/runtime.go index 3bd2962a5c3..c7ea7029cda 100644 --- a/pkg/kubelet/container/runtime.go +++ b/pkg/kubelet/container/runtime.go @@ -74,6 +74,11 @@ type Runtime interface { PullImage(image string) error // IsImagePresent checks whether the container image is already in the local storage. IsImagePresent(image string) (bool, error) + // GetContainerLogs returns logs of a specific container. By + // default, it returns a snapshot of the container log. Set 'follow' to true to + // stream the log. Set 'follow' to false and specify the number of lines (e.g. + // "100" or "all") to tail the log. + GetContainerLogs(containerID, tail string, follow bool, stdout, stderr io.Writer) (err error) } // Pod is a group of containers, with the status of the pod. diff --git a/pkg/kubelet/dockertools/manager.go b/pkg/kubelet/dockertools/manager.go index 05d6c935f6f..0aaa3626924 100644 --- a/pkg/kubelet/dockertools/manager.go +++ b/pkg/kubelet/dockertools/manager.go @@ -171,12 +171,12 @@ func (sc *stringCache) Get(uid types.UID, name string) (string, bool) { } } -// GetKubeletDockerContainerLogs returns logs of a specific container. By -// default, it returns a snapshot of the container log. Set |follow| to true to -// stream the log. Set |follow| to false and specify the number of lines (e.g. +// GetContainerLogs returns logs of a specific container. By +// default, it returns a snapshot of the container log. Set 'follow' to true to +// stream the log. Set 'follow' to false and specify the number of lines (e.g. // "100" or "all") to tail the log. // TODO: Make 'RawTerminal' option flagable. -func (dm *DockerManager) GetKubeletDockerContainerLogs(containerID, tail string, follow bool, stdout, stderr io.Writer) (err error) { +func (dm *DockerManager) GetContainerLogs(containerID, tail string, follow bool, stdout, stderr io.Writer) (err error) { opts := docker.LogsOptions{ Container: containerID, Stdout: true, diff --git a/pkg/kubelet/kubelet.go b/pkg/kubelet/kubelet.go index 8ef919e4bc4..730a572a8b6 100644 --- a/pkg/kubelet/kubelet.go +++ b/pkg/kubelet/kubelet.go @@ -1655,7 +1655,7 @@ func (kl *Kubelet) GetKubeletContainerLogs(podFullName, containerName, tail stri // waiting state. return err } - return kl.containerManager.GetKubeletDockerContainerLogs(dockerContainerID, tail, follow, stdout, stderr) + return kl.containerManager.GetContainerLogs(dockerContainerID, tail, follow, stdout, stderr) } // GetHostname Returns the hostname as the kubelet sees it.