Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change upgrade path validation for 8.0 to only allow 7.17 #5261

Merged
merged 7 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
13 changes: 10 additions & 3 deletions pkg/controller/elasticsearch/validation/validations.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,11 +272,18 @@ func noDowngrades(current, proposed esv1.Elasticsearch) field.ErrorList {

func validUpgradePath(current, proposed esv1.Elasticsearch) field.ErrorList {
var errs field.ErrorList
currentVer, err := version.Parse(current.Spec.Version)
// if available use the status version which reflects the lowest version currently running in the cluster
currentVer, err := version.Parse(current.Status.Version)
if err != nil {
// this should not happen, since this is the already persisted version
errs = append(errs, field.Invalid(field.NewPath("spec").Child("version"), current.Spec.Version, parseStoredVersionErrMsg))
// let's swallow that error which could be caused because we do not have a version in status yet and fall back
// to the Spec version which is better than nothing
pebrc marked this conversation as resolved.
Show resolved Hide resolved
currentVer, err = version.Parse(current.Spec.Version)
if err != nil {
// this should not happen, since this is the already persisted version
errs = append(errs, field.Invalid(field.NewPath("spec").Child("version"), current.Spec.Version, parseStoredVersionErrMsg))
}
}

proposedVer, err := version.Parse(proposed.Spec.Version)
if err != nil {
errs = append(errs, field.Invalid(field.NewPath("spec").Child("version"), proposed.Spec.Version, parseVersionErrMsg))
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/elasticsearch/version/supported_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ func technicallySupportedVersions(v version.Version) *version.MinMaxVersion {
}
case 8:
return &version.MinMaxVersion{
// 7.4.0 is the lowest version that offers a direct upgrade path to 8.0
Min: version.MustParse("7.4.0"),
// 7.17.0 is the lowest version that offers a direct upgrade path to 8.0
Min: version.MinFor(7, 17, 0), // allow snapshot builds here for testing
Max: version.MustParse("8.99.99"),
}
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestSupportedVersions(t *testing.T) {
v: version.MustParse("8.0.0"),
},
supported: []version.Version{
version.MustParse("7.4.0"),
version.MustParse("7.17.0"),
pebrc marked this conversation as resolved.
Show resolved Hide resolved
version.MustParse("8.9.0"),
},
unsupported: []version.Version{
Expand Down