Skip to content

Commit

Permalink
cluster: Update supported OS versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dveeden committed Nov 13, 2024
1 parent dcb557a commit 21ec16b
Showing 1 changed file with 31 additions and 12 deletions.
43 changes: 31 additions & 12 deletions pkg/cluster/operation/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ func checkSysInfo(opt *CheckOptions, sysInfo *sysinfo.SysInfo) []*CheckResult {
return results
}

// Try to keep this in sync with
// https://docs.pingcap.com/tidb/stable/hardware-and-software-requirements#os-and-platform-requirements
//
// This information is in most cases based on the `ID` (Vendor) and `VERSION_ID` (Release) of /etc/os-release
// See https://github.com/AstroProfundis/sysinfo/blob/tiup/os.go for details.
func checkOSInfo(opt *CheckOptions, osInfo *sysinfo.OS) *CheckResult {
result := &CheckResult{
Name: CheckNameOSVer,
Expand All @@ -175,17 +180,31 @@ func checkOSInfo(opt *CheckOptions, osInfo *sysinfo.OS) *CheckResult {
return result
}
case "amzn":
// https://aws.amazon.com/linux/amazon-linux-2023/
if osInfo.Version == "2023" {
return result
}

// Amazon Linux 2 is based on CentOS 7 and is recommended for
// AWS Graviton 2 (ARM64) deployments.
// https://aws.amazon.com/amazon-linux-2/
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 2 || ver >= 3 {
result.Err = fmt.Errorf("%s %s not supported, use version 2 please",
result.Err = fmt.Errorf("%s %s not supported, use Amazon Linux 2 or Amazon Linux 2023 please",
osInfo.Name, osInfo.Release)
return result
}
case "centos", "redhat", "rhel", "ol":
// check version
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 7 {
result.Err = fmt.Errorf("%s %s not supported, use version 8 please",
case "centos":
// CentOS Linux is EOL
// CentOS Stream 9 and newer is still fine
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 9 {
result.Err = fmt.Errorf("%s %s not supported, use version 9 or higher",
osInfo.Name, osInfo.Release)
return result
}
case "redhat", "rhel", "ol":
// RHEL 8.4 or newer 8.x versions are supported
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 8.4 || ver >= 9 {
result.Err = fmt.Errorf("%s %s not supported, use version 8.4 or a later 8.x version please",
osInfo.Name, osInfo.Release)
return result
}
Expand All @@ -198,30 +217,30 @@ func checkOSInfo(opt *CheckOptions, osInfo *sysinfo.OS) *CheckResult {
}
case "debian":
// debian support is not fully tested, but we suppose it should work
msg := "debian support is not fully tested, be careful"
msg := "Debian 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 < 9 {
result.Err = fmt.Errorf("%s %s not supported, use version 9 or higher (%s)",
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 10 {
result.Err = fmt.Errorf("%s %s not supported, use version 10 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"
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)",
if ver, _ := strconv.ParseFloat(osInfo.Version, 64); ver < 20.04 {
result.Err = fmt.Errorf("%s %s not supported, use version 20.04 or higher (%s)",
osInfo.Name, osInfo.Release, msg)
result.Warn = false
return result
}
case "openEuler":
return result
default:
result.Err = fmt.Errorf("os vendor %s not supported", osInfo.Vendor)
result.Err = fmt.Errorf("OS vendor %s not supported", osInfo.Vendor)
return result
}

Expand Down

0 comments on commit 21ec16b

Please sign in to comment.