Skip to content

Commit ca3e86e

Browse files
authored
Merge pull request kubernetes#81623 from neolit123/kernel-validator
kubeadm: support any Linux kernel version newer than 3.10
2 parents 9c16209 + bec9c36 commit ca3e86e

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

cmd/kubeadm/app/util/system/kernel_validator_test.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func TestValidateKernelVersion(t *testing.T) {
3131
// they may be different.
3232
// This is fine, because the test mainly tests the kernel version validation logic,
3333
// not the DefaultSysSpec. The DefaultSysSpec should be tested with node e2e.
34-
testRegex := []string{`3\.[1-9][0-9].*`, `4\..*`}
34+
testRegex := []string{`^3\.[1-9][0-9].*$`, `^([4-9]|[1-9][0-9]+)\.([0-9]+)\.([0-9]+).*$`}
3535
for _, test := range []struct {
3636
name string
3737
version string
@@ -53,9 +53,19 @@ func TestValidateKernelVersion(t *testing.T) {
5353
err: true,
5454
},
5555
{
56-
name: "5.0.0 no version regex matches",
56+
name: "5.0.0 one of version regexes matches",
5757
version: "5.0.0",
58-
err: true,
58+
err: false,
59+
},
60+
{
61+
name: "10.21.1 one of version regexes matches",
62+
version: "10.21.1",
63+
err: false,
64+
},
65+
{
66+
name: "99.12.12 one of version regexes matches",
67+
version: "99.12.12",
68+
err: false,
5969
},
6070
{
6171
name: "3.9.0 no version regex matches",

cmd/kubeadm/app/util/system/types_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const dockerEndpoint = "unix:///var/run/docker.sock"
3030
var DefaultSysSpec = SysSpec{
3131
OS: "Linux",
3232
KernelSpec: KernelSpec{
33-
Versions: []string{`3\.[1-9][0-9].*`, `4\..*`, `5\..*`}, // Requires 3.10+, 4+ or 5+
33+
Versions: []string{`^3\.[1-9][0-9].*$`, `^([4-9]|[1-9][0-9]+)\.([0-9]+)\.([0-9]+).*$`}, // Requires 3.10+, or newer
3434
// TODO(random-liu): Add more config
3535
// TODO(random-liu): Add description for each kernel configuration:
3636
Required: []KernelConfig{

0 commit comments

Comments
 (0)