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

MGMT-16332: fix issue validating pre-release versions #5837

Merged
merged 1 commit into from
Dec 21, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/operators/lvm/lvm_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (o *operator) ValidateCluster(_ context.Context, cluster *common.Cluster) (
if err != nil {
return api.ValidationResult{Status: api.Failure, ValidationId: o.GetHostValidationID(), Reasons: []string{err.Error()}}, nil
}
if ocpVersion.LessThan(minOpenshiftVersionForLvm) {
if ok, _ := common.BaseVersionLessThan(minOpenshiftVersionForLvm.String(), ocpVersion.String()); ok {
message := fmt.Sprintf("Logical Volume Manager is only supported for openshift versions %s and above", o.config.LvmMinOpenshiftVersion)
return api.ValidationResult{Status: api.Failure, ValidationId: o.GetClusterValidationID(), Reasons: []string{message}}, nil
}
Expand All @@ -94,7 +94,7 @@ func (o *operator) ValidateCluster(_ context.Context, cluster *common.Cluster) (
if err != nil {
return api.ValidationResult{Status: api.Failure, ValidationId: o.GetHostValidationID(), Reasons: []string{err.Error()}}, nil
}
if ocpVersion.LessThan(minOpenshiftVersionForMultiNodeSupport) && !common.IsSingleNodeCluster(cluster) {
if ok, _ := common.BaseVersionLessThan(minOpenshiftVersionForMultiNodeSupport.String(), ocpVersion.String()); ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check about being SNO disappeared, is that intended?

IIUC in this case SNO with version greater than minimum for multi node would pass

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no need for it - was redandent
there is an if statement before

if common.IsSingleNodeCluster(cluster) {
minOpenshiftVersionForLvm, err := version.NewVersion(o.config.LvmMinOpenshiftVersion)
if err != nil {
return api.ValidationResult{Status: api.Failure, ValidationId: o.GetHostValidationID(), Reasons: []string{err.Error()}}, nil
}
if ok, _ := common.BaseVersionLessThan(minOpenshiftVersionForLvm.String(), ocpVersion.String()); ok {

message := fmt.Sprintf("Logical Volume Manager is only supported for highly available openshift with version %s or above",
minOpenshiftVersionForMultiNodeSupport.String())
return api.ValidationResult{Status: api.Failure, ValidationId: o.GetClusterValidationID(), Reasons: []string{message}}, nil
Expand Down
8 changes: 8 additions & 0 deletions internal/operators/lvm/lvm_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ var _ = Describe("Lvm Operator", func() {
&common.Cluster{Cluster: models.Cluster{HighAvailabilityMode: &fullHaMode, Hosts: []*models.Host{hostWithSufficientResources, hostWithSufficientResources}, OpenshiftVersion: operator.config.LvmMinMultiNodeSupportVersion}},
api.ValidationResult{Status: api.Success, ValidationId: operator.GetHostValidationID()},
),
table.Entry("High Availability Mode Full with pre-release version",
&common.Cluster{Cluster: models.Cluster{HighAvailabilityMode: &fullHaMode, Hosts: []*models.Host{hostWithSufficientResources, hostWithSufficientResources}, OpenshiftVersion: "4.15.0-rc0"}},
api.ValidationResult{Status: api.Success, ValidationId: operator.GetHostValidationID()},
),
table.Entry("High Availability Mode Full with higher than LvmMinMultiNodeSupportVersion",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add SNO with openshift version > LvmMinMultiNodeSupportVersion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already there - the naming is a big confusing

noneHaMode := models.ClusterHighAvailabilityModeNone

table.Entry("High Availability Mode None and Openshift version less than minimal",
&common.Cluster{Cluster: models.Cluster{HighAvailabilityMode: &noneHaMode, Hosts: []*models.Host{hostWithSufficientResources}, OpenshiftVersion: "4.10.0"}},
api.ValidationResult{Status: api.Failure, ValidationId: operator.GetHostValidationID(), Reasons: []string{"Logical Volume Manager is only supported for openshift versions 4.11.0 and above"}},
),
table.Entry("High Availability Mode None and Openshift version more than minimal",
&common.Cluster{Cluster: models.Cluster{HighAvailabilityMode: &noneHaMode, Hosts: []*models.Host{hostWithSufficientResources}, OpenshiftVersion: operator.config.LvmMinOpenshiftVersion}},
api.ValidationResult{Status: api.Success, ValidationId: operator.GetHostValidationID()},
),

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep sorry I've missed it 😓

&common.Cluster{Cluster: models.Cluster{HighAvailabilityMode: &fullHaMode, Hosts: []*models.Host{hostWithSufficientResources, hostWithSufficientResources}, OpenshiftVersion: "4.15.7"}},
api.ValidationResult{Status: api.Success, ValidationId: operator.GetHostValidationID()},
),
table.Entry("High Availability Mode Full and Openshift version less than LvmMinMultiNodeSupportVersion",
&common.Cluster{Cluster: models.Cluster{HighAvailabilityMode: &fullHaMode, Hosts: []*models.Host{hostWithSufficientResources}, OpenshiftVersion: "4.14.0"}},
api.ValidationResult{Status: api.Failure, ValidationId: operator.GetHostValidationID(), Reasons: []string{"Logical Volume Manager is only supported for highly available openshift with version 4.15.0 or above"}},
Expand Down