diff --git a/validators/kernel_validator.go b/validators/kernel_validator.go index d3a006d..42af3be 100644 --- a/validators/kernel_validator.go +++ b/validators/kernel_validator.go @@ -90,7 +90,7 @@ func (k *KernelValidator) validateKernelVersion(kSpec KernelSpec) error { } } k.Reporter.Report("KERNEL_VERSION", k.kernelRelease, bad) - return fmt.Errorf("kernel release %s is unsupported, and %s", k.kernelRelease, kSpec.VersionsNote) + return fmt.Errorf("kernel release %s is unsupported. %s", k.kernelRelease, kSpec.VersionsNote) } // validateKernelConfig validates the kernel configurations. diff --git a/validators/kernel_validator_test.go b/validators/kernel_validator_test.go index ec89887..77f046f 100644 --- a/validators/kernel_validator_test.go +++ b/validators/kernel_validator_test.go @@ -43,10 +43,15 @@ func TestValidateKernelVersion(t *testing.T) { err: true, }, { - name: "4.4.14+ no version regex matches", + name: "4.4.14+ first version regex matches", version: "4.4.14+", err: false, }, + { + name: "4.7.1 no version regex matches", + version: "4.7.1", + err: true, + }, { name: "4.17.3 no version regex matches", version: "4.17.3", diff --git a/validators/types.go b/validators/types.go index 5bc14dc..eee7e81 100644 --- a/validators/types.go +++ b/validators/types.go @@ -42,7 +42,7 @@ type KernelConfig struct { type KernelSpec struct { // Versions define supported kernel version. It is a group of regexps. Versions []string `json:"versions,omitempty"` - // VersionsNote provides a prompt message for user if Versions do not match. + // VersionsNote provides additional information if Versions do not match. VersionsNote string `json:"versionsNote,omitempty"` // Required contains all kernel configurations required to be enabled // (built in or as module). diff --git a/validators/types_unix.go b/validators/types_unix.go index b2fb9d1..4bf23c8 100644 --- a/validators/types_unix.go +++ b/validators/types_unix.go @@ -29,9 +29,8 @@ var DefaultSysSpec = SysSpec{ OS: "Linux", KernelSpec: KernelSpec{ // 4.4 & 4.19 are selected as kernel Super Long Term Support (SLTS), and the Civil Infrastructure Platform will provide support until at least 2026. - // For cgroup v2, Kubernetes recommends to use 5.8 and later, and in runc docs, the minimal version is 4.15 and 5.2+ is recommended. - Versions: []string{`^4\.4.*$`, `^4\.19.*$`, `^4\.[2-9][0-9].*$`, `^([5-9]|[1-9][0-9]+)\.([0-9]+)\.([0-9]+).*$`}, // Requires 5.8+, or newer for cgroup v2 - VersionsNote: "kernel version should be in maintenance, at least 4.4 or 4.19+, and to use cgroup v2, 5.8+ is recommended.", + Versions: []string{`^4\.4.*$`, `^4\.19.*$`, `^4\.[2-9][0-9].*$`, `^([5-9]|[1-9][0-9]+)\.([0-9]+)\.([0-9]+).*$`}, + VersionsNote: "Recommended LTS versions from the 4.x series are 4.4 and 4.19. Any 4.x version newer than 4.19 is also supported. For cgroups v2 support, the minimal version is 4.15 and the recommended version is 5.8+", // TODO(random-liu): Add more config // TODO(random-liu): Add description for each kernel configuration: Required: []KernelConfig{ diff --git a/validators/types_windows.go b/validators/types_windows.go index 74e75b6..2c5c367 100644 --- a/validators/types_windows.go +++ b/validators/types_windows.go @@ -29,7 +29,7 @@ var DefaultSysSpec = SysSpec{ OS: "Microsoft Windows Server 2016", KernelSpec: KernelSpec{ Versions: []string{`10\.0\.1439[3-9]`, `10\.0\.14[4-9][0-9]{2}`, `10\.0\.1[5-9][0-9]{3}`, `10\.0\.[2-9][0-9]{4}`, `10\.[1-9]+\.[0-9]+`}, //requires >= '10.0.14393' - VersionsNote: "kernel version should >= '10.0.14393'", + VersionsNote: "The kernel version should be >= '10.0.14393'", Required: []KernelConfig{}, Optional: []KernelConfig{}, Forbidden: []KernelConfig{},