Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkg/payload/precondition/clusterversion/gianthop.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ func (p *GiantHop) Run(ctx context.Context, releaseContext precondition.ReleaseC
}

if targetVersion.Major > currentVersion.Major {
if targetVersion.Major == 5 && currentVersion.Major == 4 { // TODO: temporary access from v4 to 5.0, to be reverted once we are in v5 development
if targetVersion.Minor == 0 {
return nil
}
return &precondition.Error{
Reason: "MajorVersionUpdate",
Message: fmt.Sprintf("%s has a larger major version than the current target %s (%d > %d), and only updates within the current major version or to 5.0 are supported.", targetVersion, currentVersion, targetVersion.Major, currentVersion.Major),
Name: p.Name(),
}
}
return &precondition.Error{
Reason: "MajorVersionUpdate",
Message: fmt.Sprintf("%s has a larger major version than the current target %s (%d > %d), and only updates within the current major version are supported.", targetVersion, currentVersion, targetVersion.Major, currentVersion.Major),
Expand Down
32 changes: 32 additions & 0 deletions pkg/payload/precondition/clusterversion/gianthop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,38 @@ func TestGiantHopRun(t *testing.T) {
},
expected: "2.0.0 has a larger major version than the current target 1.0.0 (2 > 1), and only updates within the current major version are supported.",
},
{
name: "major version is 5.0",
clusterVersion: configv1.ClusterVersion{
Spec: configv1.ClusterVersionSpec{
DesiredUpdate: &configv1.Update{
Version: "5.0.0",
},
},
Status: configv1.ClusterVersionStatus{
Desired: configv1.Release{
Version: "4.0.0",
},
},
},
expected: "",
},
{
name: "major version is 5.1",
clusterVersion: configv1.ClusterVersion{
Spec: configv1.ClusterVersionSpec{
DesiredUpdate: &configv1.Update{
Version: "5.1.0",
},
},
Status: configv1.ClusterVersionStatus{
Desired: configv1.Release{
Version: "4.0.0",
},
},
},
expected: "5.1.0 has a larger major version than the current target 4.0.0 (5 > 4), and only updates within the current major version or to 5.0 are supported.",
},
{
name: "two minor versions",
clusterVersion: configv1.ClusterVersion{
Expand Down