Skip to content

Commit

Permalink
fix: cluster upgrade patch version check error (#477)
Browse files Browse the repository at this point in the history
Signed-off-by: xu.jingwen <xu.jingwen@99cloud.net>

Signed-off-by: xu.jingwen <xu.jingwen@99cloud.net>
  • Loading branch information
Xvv-v committed Dec 8, 2022
1 parent 776fba6 commit dc4100f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/cli/cluster/cluster_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (c *ClusterUpgradeOpts) Validates() error {
}
clu := clusterList.Items[0]
if c.Version <= clu.KubernetesVersion {
return fmt.Errorf("your current version [%s] <= the version [%s] you specify", clu.KubernetesVersion, c.Version)
return fmt.Errorf("your current version [%s] is lower than the version [%s] you specify", clu.KubernetesVersion, c.Version)
}

return c.checkVersionSpan(&clu)
Expand Down Expand Up @@ -160,7 +160,7 @@ func (c *ClusterUpgradeOpts) checkVersionExist() error {
func (c *ClusterUpgradeOpts) checkVersionSpan(clu *corev1.Cluster) error {
currentVersion := strings.Split(clu.KubernetesVersion[1:], ".")
targetVersion := strings.Split(c.Version[1:], ".")
for index := 0; index < len(targetVersion); index++ {
for index := 0; index < len(targetVersion)-1; index++ {
a, err := strconv.Atoi(targetVersion[index])
if err != nil {
return err
Expand Down

0 comments on commit dc4100f

Please sign in to comment.