From 9af3b0a406c829a802456ae7410b5d702c71a133 Mon Sep 17 00:00:00 2001 From: xiangpengzhao Date: Thu, 6 Apr 2017 10:44:28 +0800 Subject: [PATCH] Use existed global var criSupportedLogDrivers and helper function IsCRISupportedLogDriver --- pkg/kubelet/dockershim/docker_container.go | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/pkg/kubelet/dockershim/docker_container.go b/pkg/kubelet/dockershim/docker_container.go index 428c8c1555..b76d0cac09 100644 --- a/pkg/kubelet/dockershim/docker_container.go +++ b/pkg/kubelet/dockershim/docker_container.go @@ -32,10 +32,6 @@ import ( "k8s.io/kubernetes/pkg/kubelet/dockertools" ) -const ( - dockerDefaultLoggingDriver = "json-file" -) - // ListContainers lists all containers matching the filter. func (ds *dockerService) ListContainers(filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error) { opts := dockertypes.ContainerListOptions{All: true} @@ -234,19 +230,16 @@ func (ds *dockerService) createContainerLogSymlink(containerID string) error { path, realPath, containerID, err) } } else { - dockerLoggingDriver := "" - dockerInfo, err := ds.client.Info() + supported, err := IsCRISupportedLogDriver(ds.client) if err != nil { - glog.Errorf("Failed to execute Info() call to the Docker client: %v", err) - } else { - dockerLoggingDriver = dockerInfo.LoggingDriver - glog.V(10).Infof("Docker logging driver is %s", dockerLoggingDriver) + glog.Warningf("Failed to check supported logging driver by CRI: %v", err) + return nil } - if dockerLoggingDriver == dockerDefaultLoggingDriver { - glog.Errorf("Cannot create symbolic link because container log file doesn't exist!") + if supported { + glog.Warningf("Cannot create symbolic link because container log file doesn't exist!") } else { - glog.V(5).Infof("Unsupported logging driver: %s", dockerLoggingDriver) + glog.V(5).Infof("Unsupported logging driver by CRI") } }