mirror of
https://github.com/rancher/rke.git
synced 2025-09-01 15:06:23 +00:00
Use supported rke-tools for backup and restore in legacy clusters
This commit is contained in:
committed by
Alena Prokharchyk
parent
30661bc429
commit
f8b6131dd2
25
util/util.go
25
util/util.go
@@ -12,6 +12,8 @@ import (
|
||||
|
||||
const (
|
||||
WorkerThreads = 50
|
||||
|
||||
SupportedSyncToolsVersion = "0.1.22"
|
||||
)
|
||||
|
||||
func StrToSemVer(version string) (*semver.Version, error) {
|
||||
@@ -108,3 +110,26 @@ func ValidateVersion(version string) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetDefaultRKETools() string {
|
||||
return v3.AllK8sVersions[v3.DefaultK8s].Alpine
|
||||
}
|
||||
|
||||
func IsRancherBackupSupported(image string) bool {
|
||||
v := strings.Split(image, ":")
|
||||
last := v[len(v)-1]
|
||||
|
||||
sv, err := StrToSemVer(last)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
supported, err := StrToSemVer(SupportedSyncToolsVersion)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
if sv.LessThan(*supported) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
Reference in New Issue
Block a user