Merge pull request #68906 from neolit123/docker-verify

kubeadm: fix broken Docker 17.xx validation
This commit is contained in:
k8s-ci-robot 2018-09-21 09:36:09 -07:00 committed by GitHub
commit 5e5f7e5389
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View File

@ -38,7 +38,7 @@ func (d *DockerValidator) Name() string {
const ( const (
dockerConfigPrefix = "DOCKER_" dockerConfigPrefix = "DOCKER_"
maxDockerValidatedVersion = "18.06" latestValidatedDockerVersion = "18.06"
) )
// TODO(random-liu): Add more validating items. // TODO(random-liu): Add more validating items.
@ -78,9 +78,9 @@ func (d *DockerValidator) validateDockerInfo(spec *DockerSpec, info types.Info)
if r.MatchString(info.ServerVersion) { if r.MatchString(info.ServerVersion) {
d.Reporter.Report(dockerConfigPrefix+"VERSION", info.ServerVersion, good) d.Reporter.Report(dockerConfigPrefix+"VERSION", info.ServerVersion, good)
w := fmt.Errorf( w := fmt.Errorf(
"docker version is greater than the most recently validated version. Docker version: %s. Max validated version: %s", "this Docker version is not on the list of validated versions: %s. Latest validated version: %s",
info.ServerVersion, info.ServerVersion,
maxDockerValidatedVersion, latestValidatedDockerVersion,
) )
return w, nil return w, nil
} }

View File

@ -28,7 +28,7 @@ func TestValidateDockerInfo(t *testing.T) {
Reporter: DefaultReporter, Reporter: DefaultReporter,
} }
spec := &DockerSpec{ spec := &DockerSpec{
Version: []string{`1\.1[1-3]\..*`, `18\.06\..*`}, // Requires [1.11, 18.06]. Version: []string{`1\.1[1-3]\..*`, `17\.0[3,6,9]\..*`, `18\.06\..*`},
GraphDriver: []string{"driver_1", "driver_2"}, GraphDriver: []string{"driver_1", "driver_2"},
} }
for _, test := range []struct { for _, test := range []struct {
@ -71,6 +71,11 @@ func TestValidateDockerInfo(t *testing.T) {
err: false, err: false,
warn: false, warn: false,
}, },
{
info: types.Info{Driver: "driver_2", ServerVersion: "17.09.0-ce"},
err: false,
warn: false,
},
{ {
info: types.Info{Driver: "driver_2", ServerVersion: "18.06.0-ce"}, info: types.Info{Driver: "driver_2", ServerVersion: "18.06.0-ce"},
err: false, err: false,

View File

@ -62,7 +62,7 @@ var DefaultSysSpec = SysSpec{
Cgroups: []string{"cpu", "cpuacct", "cpuset", "devices", "freezer", "memory"}, Cgroups: []string{"cpu", "cpuacct", "cpuset", "devices", "freezer", "memory"},
RuntimeSpec: RuntimeSpec{ RuntimeSpec: RuntimeSpec{
DockerSpec: &DockerSpec{ DockerSpec: &DockerSpec{
Version: []string{`1\.1[1-3]\..*`, `18\.06\..*`}, // Requires [1.11, 18.06] Version: []string{`1\.1[1-3]\..*`, `17\.0[3,6,9]\..*`, `18\.06\..*`},
GraphDriver: []string{"aufs", "overlay", "overlay2", "devicemapper", "zfs"}, GraphDriver: []string{"aufs", "overlay", "overlay2", "devicemapper", "zfs"},
}, },
}, },