1
0
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:
moelsayed
2019-02-15 22:40:36 +02:00
committed by Alena Prokharchyk
parent 30661bc429
commit f8b6131dd2
3 changed files with 52 additions and 32 deletions

View File

@@ -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
}