-
Notifications
You must be signed in to change notification settings - Fork 66
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
[release-4.12] OCPBUGS-14260: Check for minimum OCP version #1644
[release-4.12] OCPBUGS-14260: Check for minimum OCP version #1644
Conversation
@aravindhp: This pull request references Jira Issue OCPBUGS-14260, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Skipping CI for Draft Pull Request. |
/approve cancel |
@aravindhp: This pull request references Jira Issue OCPBUGS-14260, which is invalid:
Comment In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/label jira/valid-bug This bug only affects OCP 4.12 / WMCO 7.0.1 |
/test gcp-e2e-operator |
/jira refresh |
@aravindhp: This pull request references Jira Issue OCPBUGS-14260, which is invalid:
Comment Retaining the jira/valid-bug label as it was manually added. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/test gcp-e2e-operator |
/test gcp-e2e-operator |
/test gcp-e2e-operator |
/test unit |
// minOpenShiftVersion is the minimum required OCP version due to https://issues.redhat.com/browse/OCPBUGS-4862. | ||
// Without this fix, BYOH node upgrades will fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: could call out this is the min required OCP version within 4.12.z
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are in the release-4.12
branch. Do we really need to call this out?
pkg/cluster/config.go
Outdated
var openShiftVersion string | ||
for _, update := range clusterVersion.Status.History { | ||
if update.State == oconfig.CompletedUpdate { | ||
// obtain the version from the last completed update | ||
openShiftVersion = update.Version | ||
break | ||
} | ||
} | ||
return openShiftVersion, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't checking if the version is missing, I suggest doing this instead:
var openShiftVersion string
for _, update := range clusterVersion.Status.History {
if update.State == oconfig.CompletedUpdate {
// obtain the version from the last completed update
return update.Version
}
}
return "", fmt.Errorf("no completed updated was found")
pkg/cluster/config.go
Outdated
if len(openShiftVersion) == 0 { | ||
return fmt.Errorf("cluster version not set") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this check, it would be more comprehensive to add the v prefix and then use semver.isValid to check that the version is formatted properly.
Alternatively you could do this within getOpenShiftVersion
, renaming it to getOpenShiftSemver
. That way it is guaranteed that getOpenShiftSemver
is returning a valid semver, and the code within this function doesn't need to be as defensive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getOpenShiftSemver
would be overloading a function and is not a good pattern. I prefer to keep the validation in one spot and making code more defensive is fine.
pkg/cluster/config_test.go
Outdated
if (err != nil) != tt.wantErr { | ||
assert.Errorf(t, err, "error = %v, wantErr %v", err, tt.wantErr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you need to do something like this to check if theres an error when we want it, and not when don't?
assert.Equal(t,( err != nil ), tt.wantErr)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually has the same effect but I like you version better.
/retitle OCPBUGS-14260: Check for minimum OCP version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review, @sebsoto. I have addressed your comments.
// minOpenShiftVersion is the minimum required OCP version due to https://issues.redhat.com/browse/OCPBUGS-4862. | ||
// Without this fix, BYOH node upgrades will fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are in the release-4.12
branch. Do we really need to call this out?
pkg/cluster/config.go
Outdated
if len(openShiftVersion) == 0 { | ||
return fmt.Errorf("cluster version not set") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getOpenShiftSemver
would be overloading a function and is not a good pattern. I prefer to keep the validation in one spot and making code more defensive is fine.
pkg/cluster/config_test.go
Outdated
if (err != nil) != tt.wantErr { | ||
assert.Errorf(t, err, "error = %v, wantErr %v", err, tt.wantErr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually has the same effect but I like you version better.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sebsoto The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than commit message
's/fixed an issue where
deletion of a BYOH node objected/fixed an issue where
deletion of a BYOH node object/'
https://issues.redhat.com/browse/OCPBUGS-4862 fixed an issue where deletion of a BYOH node object resulted in it hanging in the "Ready,SchedulingDisabled" state. This was fixed in OCP 4.12.3 and as a result any WMCO upgrades from 7.0.1 needs to be on versions greater than that. Otherwise BYOH node upgrades will fail and could potentially cause workload disruptions. To prevent that from happening stop WMCO 7.1.0 from running if the OCP version is below 4.12.3. This check is ignored in CI runs as CI clusters do not advertise Z streams.
@aravindhp: This pull request references Jira Issue OCPBUGS-14260, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. Retaining the jira/valid-bug label as it was manually added. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@alinaryan fixed. |
/lgtm |
/retitle [release-4.12] OCPBUGS-14260: Check for minimum OCP version |
/retest-required DaemonSet scale down failure in e2e-aws-upgrade |
/retest-required
🤷🏽♂️ |
@aravindhp: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
cfb3eef
into
openshift:release-4.12
@aravindhp: Jira Issue OCPBUGS-14260: All pull requests linked via external trackers have merged: Jira Issue OCPBUGS-14260 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
OCPBUGS-4862 fixed an issue where deletion of a BYOH node object resulted in it hanging in the
Ready,SchedulingDisabled
state. This was fixed in OCP 4.12.3 and as a result any WMCO upgrades from 7.0.1 needs to be on versions greater than that. Otherwise BYOH node upgrades will fail and could potentially cause workload disruptions. To prevent that from happening stop WMCO 7.1.0 from running if the OCP version is below 4.12.3.Fixes OCPBUGS-14260