Skip to content

Commit

Permalink
address review comments & add a 4.7.3 test case
Browse files Browse the repository at this point in the history
  • Loading branch information
pacoxu committed Jul 25, 2024
1 parent e00d6f3 commit 9778272
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion validators/kernel_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions validators/kernel_validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func TestValidateKernelVersion(t *testing.T) {
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",
Expand Down
2 changes: 1 addition & 1 deletion validators/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions validators/types_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ 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.
// Requires 5.8+, or newer for cgroup v2.
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.",
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{
Expand Down
2 changes: 1 addition & 1 deletion validators/types_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand Down

0 comments on commit 9778272

Please sign in to comment.