Merge pull request #81623 from neolit123/kernel-validator

kubeadm: support any Linux kernel version newer than 3.10
This commit is contained in:
Kubernetes Prow Robot 2019-08-22 11:12:59 -07:00 committed by GitHub
commit ca3e86e662
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -31,7 +31,7 @@ func TestValidateKernelVersion(t *testing.T) {
// they may be different.
// This is fine, because the test mainly tests the kernel version validation logic,
// not the DefaultSysSpec. The DefaultSysSpec should be tested with node e2e.
testRegex := []string{`3\.[1-9][0-9].*`, `4\..*`}
testRegex := []string{`^3\.[1-9][0-9].*$`, `^([4-9]|[1-9][0-9]+)\.([0-9]+)\.([0-9]+).*$`}
for _, test := range []struct {
name string
version string
@ -53,9 +53,19 @@ func TestValidateKernelVersion(t *testing.T) {
err: true,
},
{
name: "5.0.0 no version regex matches",
name: "5.0.0 one of version regexes matches",
version: "5.0.0",
err: true,
err: false,
},
{
name: "10.21.1 one of version regexes matches",
version: "10.21.1",
err: false,
},
{
name: "99.12.12 one of version regexes matches",
version: "99.12.12",
err: false,
},
{
name: "3.9.0 no version regex matches",

View File

@ -30,7 +30,7 @@ const dockerEndpoint = "unix:///var/run/docker.sock"
var DefaultSysSpec = SysSpec{
OS: "Linux",
KernelSpec: KernelSpec{
Versions: []string{`3\.[1-9][0-9].*`, `4\..*`, `5\..*`}, // Requires 3.10+, 4+ or 5+
Versions: []string{`^3\.[1-9][0-9].*$`, `^([4-9]|[1-9][0-9]+)\.([0-9]+)\.([0-9]+).*$`}, // Requires 3.10+, or newer
// TODO(random-liu): Add more config
// TODO(random-liu): Add description for each kernel configuration:
Required: []KernelConfig{