Merge pull request #44126 from xiangpengzhao/fix-const

Automatic merge from submit-queue (batch tested with PRs 45508, 44258, 44126, 45441, 45320)

Use existing global var criSupportedLogDrivers

**What this PR does / why we need it**:
Use existing global var `criSupportedLogDrivers` defined in docker_service.go. If CRI supports other log drivers in the future, we will only need to modify that global var.

cc @Random-Liu
pull/6/head
Kubernetes Submit Queue 2017-05-08 16:34:44 -07:00 committed by GitHub
commit 60e02711d4
1 changed files with 6 additions and 13 deletions

View File

@ -32,10 +32,6 @@ import (
"k8s.io/kubernetes/pkg/kubelet/dockertools" "k8s.io/kubernetes/pkg/kubelet/dockertools"
) )
const (
dockerDefaultLoggingDriver = "json-file"
)
// ListContainers lists all containers matching the filter. // ListContainers lists all containers matching the filter.
func (ds *dockerService) ListContainers(filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error) { func (ds *dockerService) ListContainers(filter *runtimeapi.ContainerFilter) ([]*runtimeapi.Container, error) {
opts := dockertypes.ContainerListOptions{All: true} opts := dockertypes.ContainerListOptions{All: true}
@ -236,19 +232,16 @@ func (ds *dockerService) createContainerLogSymlink(containerID string) error {
path, realPath, containerID, err) path, realPath, containerID, err)
} }
} else { } else {
dockerLoggingDriver := "" supported, err := IsCRISupportedLogDriver(ds.client)
dockerInfo, err := ds.client.Info()
if err != nil { if err != nil {
glog.Errorf("Failed to execute Info() call to the Docker client: %v", err) glog.Warningf("Failed to check supported logging driver by CRI: %v", err)
} else { return nil
dockerLoggingDriver = dockerInfo.LoggingDriver
glog.V(10).Infof("Docker logging driver is %s", dockerLoggingDriver)
} }
if dockerLoggingDriver == dockerDefaultLoggingDriver { if supported {
glog.Errorf("Cannot create symbolic link because container log file doesn't exist!") glog.Warningf("Cannot create symbolic link because container log file doesn't exist!")
} else { } else {
glog.V(5).Infof("Unsupported logging driver: %s", dockerLoggingDriver) glog.V(5).Infof("Unsupported logging driver by CRI")
} }
} }