diff --git a/src/go/rpk/pkg/cli/redpanda/start.go b/src/go/rpk/pkg/cli/redpanda/start.go index 9b662a9304b80..dfac0a9894be2 100644 --- a/src/go/rpk/pkg/cli/redpanda/start.go +++ b/src/go/rpk/pkg/cli/redpanda/start.go @@ -700,12 +700,12 @@ func check( if action, exists := checkFailedActions[result.CheckerID]; exists { action(&result) } - msg := fmt.Sprintf("System check '%s' failed. Required: %v, Current %v, Error: %v", - result.Desc, result.Required, result.Current, result.Err) + msg := fmt.Sprintf("System check '%s' failed. Required: %v, Current %v, Error: %v, Severity: %v", + result.Desc, result.Required, result.Current, result.Err, result.Severity) if result.Severity == tuners.Fatal { return errors.New(msg) } - fmt.Println(msg) + zap.L().Sugar().Warn(msg) } } return nil diff --git a/src/go/rpk/pkg/config/params.go b/src/go/rpk/pkg/config/params.go index b35351015b648..5dd254b9511f2 100644 --- a/src/go/rpk/pkg/config/params.go +++ b/src/go/rpk/pkg/config/params.go @@ -1000,6 +1000,7 @@ func (p *Params) readRedpandaConfig(fs afero.Fs, c *Config) error { if errors.Is(err, afero.ErrFileNotFound) { continue } + return fmt.Errorf("unable to read file in %v: %v", path, err) } if err := yaml.Unmarshal(file, &c.redpandaYaml); err != nil { diff --git a/src/go/rpk/pkg/tuners/kernel_version.go b/src/go/rpk/pkg/tuners/kernel_version.go index 9f35c869238da..847cd629aa150 100644 --- a/src/go/rpk/pkg/tuners/kernel_version.go +++ b/src/go/rpk/pkg/tuners/kernel_version.go @@ -12,7 +12,7 @@ package tuners import "fmt" const ( - ExpectedKernelVersion string = "4.19" + ExpectedKernelVersion string = "3.19" ) func NewKernelVersionChecker( @@ -38,7 +38,7 @@ func (kernelVersionChecker) GetSeverity() Severity { } func (kernelVersionChecker) GetRequiredAsString() string { - return "4.19" + return ExpectedKernelVersion } func (c kernelVersionChecker) Check() *CheckResult { @@ -63,7 +63,7 @@ func (c kernelVersionChecker) Check() *CheckResult { return res } - if major < 4 || major == 4 && minor < 19 { + if major < 3 || major == 3 && minor < 19 { res.Err = fmt.Errorf("%s", "kernel version is too old") return res } diff --git a/src/go/rpk/pkg/tuners/kernel_version_test.go b/src/go/rpk/pkg/tuners/kernel_version_test.go index 2f6405f312f86..6f7cfe7016b93 100644 --- a/src/go/rpk/pkg/tuners/kernel_version_test.go +++ b/src/go/rpk/pkg/tuners/kernel_version_test.go @@ -30,28 +30,28 @@ func Test_kernelVersionChecker_Check(t *testing.T) { name: "Shall return valid result when condition is met", check: func(c int) bool { return c == 26 }, renderRequired: func() string { return "0" }, - getCurrent: func() (string, error) { return "4.19.0", nil }, + getCurrent: func() (string, error) { return "3.19.0", nil }, want: &CheckResult{ CheckerID: KernelVersion, IsOk: true, - Current: "4.19.0", + Current: "3.19.0", Desc: "Kernel Version", Severity: Warning, - Required: "4.19", + Required: "3.19", }, }, { name: "Shall return valid result when minor is higher", check: func(c int) bool { return c == 26 }, renderRequired: func() string { return "0" }, - getCurrent: func() (string, error) { return "4.20.0", nil }, + getCurrent: func() (string, error) { return "3.20.0", nil }, want: &CheckResult{ CheckerID: KernelVersion, IsOk: true, - Current: "4.20.0", + Current: "3.20.0", Desc: "Kernel Version", Severity: Warning, - Required: "4.19", + Required: "3.19", }, }, { @@ -65,21 +65,21 @@ func Test_kernelVersionChecker_Check(t *testing.T) { Current: "5.1.0", Desc: "Kernel Version", Severity: Warning, - Required: "4.19", + Required: "3.19", }, }, { name: "Shall return invalid result when minor is lower", check: func(c int) bool { return c == 26 }, renderRequired: func() string { return "0" }, - getCurrent: func() (string, error) { return "4.18.0", nil }, + getCurrent: func() (string, error) { return "3.18.0", nil }, want: &CheckResult{ CheckerID: KernelVersion, IsOk: false, - Current: "4.18.0", + Current: "3.18.0", Desc: "Kernel Version", Severity: Warning, - Required: "4.19", + Required: "3.19", Err: errors.New("kernel version is too old"), }, }, @@ -87,14 +87,14 @@ func Test_kernelVersionChecker_Check(t *testing.T) { name: "Shall return invalid result when major is lower", check: func(c int) bool { return c == 26 }, renderRequired: func() string { return "0" }, - getCurrent: func() (string, error) { return "3.19.0", nil }, + getCurrent: func() (string, error) { return "2.19.0", nil }, want: &CheckResult{ CheckerID: KernelVersion, IsOk: false, - Current: "3.19.0", + Current: "2.19.0", Desc: "Kernel Version", Severity: Warning, - Required: "4.19", + Required: "3.19", Err: errors.New("kernel version is too old"), }, }, @@ -102,14 +102,14 @@ func Test_kernelVersionChecker_Check(t *testing.T) { name: "Shall return invalid result when patch is missing", check: func(c int) bool { return c == 26 }, renderRequired: func() string { return "0" }, - getCurrent: func() (string, error) { return "4.19", nil }, + getCurrent: func() (string, error) { return "3.19", nil }, want: &CheckResult{ CheckerID: KernelVersion, IsOk: false, - Current: "4.19", + Current: "3.19", Desc: "Kernel Version", Severity: Warning, - Required: "4.19", + Required: "3.19", Err: errors.New("failed to parse kernel version"), }, }, @@ -124,7 +124,7 @@ func Test_kernelVersionChecker_Check(t *testing.T) { Current: "5.8.0-19-generic", Desc: "Kernel Version", Severity: Warning, - Required: "4.19", + Required: "3.19", }, }, }