Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cluster: fix and optimize os version check #1336

Merged
merged 5 commits into from
May 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions pkg/cluster/operation/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,35 @@ func checkOSInfo(opt *CheckOptions, osInfo *sysinfo.OS) *CheckResult {

// check OS vendor
switch osInfo.Vendor {
case "centos", "redhat":
case "centos", "redhat", "rhel":
// check version
if ver, _ := strconv.Atoi(osInfo.Version); ver < 7 {
result.Err = fmt.Errorf("%s %s not supported, use version 7 or higher",
osInfo.Name, osInfo.Release)
return result
}
case "debian", "ubuntu":
// check version
case "debian":
// debian support is not fully tested, but we suppose it should work
msg := "debian support is not fully tested, be careful"
result.Err = fmt.Errorf("%s (%s)", result.Msg, msg)
result.Warn = true
if ver, _ := strconv.Atoi(osInfo.Version); ver < 9 {
result.Err = fmt.Errorf("%s %s not supported, use version 9 or higher (%s)",
osInfo.Name, osInfo.Release, msg)
result.Warn = false
return result
}
case "ubuntu":
// ubuntu support is not fully tested, but we suppose it should work
msg := "ubuntu support is not fully tested, be careful"
result.Err = fmt.Errorf("%s (%s)", result.Msg, msg)
result.Warn = true
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 18.04 {
result.Err = fmt.Errorf("%s %s not supported, use version 18.04 or higher (%s)",
osInfo.Name, osInfo.Release, msg)
result.Warn = false
return result
}
default:
result.Err = fmt.Errorf("os vendor %s not supported", osInfo.Vendor)
return result
Expand Down