mirror of https://github.com/kubernetes/kops.git
Balk at using Kubernetes versions too new to be supported
This commit is contained in:
parent
443012efc7
commit
8db90a3233
|
|
@ -1053,6 +1053,29 @@ func (c *ApplyClusterCmd) validateKubernetesVersion() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
kopsVersion, err := semver.Parse(kopsbase.KOPS_RELEASE_VERSION)
|
||||
if err != nil {
|
||||
klog.Warningf("unable to parse kops version %q", kopsVersion)
|
||||
} else {
|
||||
tooNewVersion := kopsVersion
|
||||
tooNewVersion.Minor += 1
|
||||
tooNewVersion.Pre = nil
|
||||
tooNewVersion.Build = nil
|
||||
if util.IsKubernetesGTE(tooNewVersion.String(), *parsed) {
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("%s\n", starline)
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("This version of kubernetes is not yet supported; upgrading kops is required\n")
|
||||
fmt.Printf("(you can bypass this check by exporting KOPS_RUN_TOO_NEW_VERSION)\n")
|
||||
fmt.Printf("\n")
|
||||
fmt.Printf("%s\n", starline)
|
||||
fmt.Printf("\n")
|
||||
if os.Getenv("KOPS_RUN_TOO_NEW_VERSION") == "" {
|
||||
return fmt.Errorf("kops upgrade is required")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !util.IsKubernetesGTE(OldestSupportedKubernetesVersion, *parsed) {
|
||||
fmt.Printf("This version of Kubernetes is no longer supported; upgrading Kubernetes is required\n")
|
||||
fmt.Printf("\n")
|
||||
|
|
|
|||
Loading…
Reference in New Issue