kubeadm: support any kernel version newer than 3.10

It seems undesirable that Kubernetes as a system should be
blocking a node if it's Linux kernel is way too new.

If such a problem even occurs we should exclude versions from
the list of supported versions instead of blocking users
from trying e.g. the latest 7.0.0-beta kernel because our
validators are not aware of this new version.
This commit is contained in:
Lubomir I. Ivanov 2019-08-20 01:11:25 +03:00
parent f4521bf5a2
commit bec9c3678b
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{