-
Notifications
You must be signed in to change notification settings - Fork 667
Bug 1748219: Detect baremetal platform #2558
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
Bug 1748219: Detect baremetal platform #2558
Conversation
|
/assign @vojtechszocs |
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 would be better to just go with required: string[] IMO.
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.
actually, nevermind. For 4.3 we will have proper plugin gating and using string | string[] will result in smaller change
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.
I'd prefer string | string[] here to minimize changes in specific plugins.
vojtechszocs
left a comment
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.
@jtomasek LGTM overall, please check my inline comments.
frontend/public/actions/features.ts
Outdated
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.
Maybe I'm missing something, but shouldn't we set the flag like this?
(infra: K8sResourceKind) => dispatch(setFlag(FLAGS.BAREMETAL, getInfrastructurePlatform(infra) === 'BareMetal'))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.
Done
frontend/public/actions/features.ts
Outdated
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 seems that existing detectFoo functions pass success and error handlers as part of then invocation.
Suggested change:
const detectBaremetalPlatform = dispatch => k8sGet(InfrastructureModel, 'cluster')
.then(
(infra: K8sResourceKind) => {
dispatch(setFlag(FLAGS.BAREMETAL, getInfrastructurePlatform(infra) === 'BareMetal'))
},
(err) => {
_.get(err, 'response.status') === 404
? dispatch(setFlag(FLAGS.BAREMETAL, false))
: handleError(err, FLAGS.BAREMETAL, dispatch, detectBaremetalPlatform);
}
);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.
I believe that handling errors using onRejected instead of using catch is often considered anti-pattern as using catch will also catch the errors occurring during onFulfilled.
I've aligned the code to other 'detect' functions though.
frontend/public/actions/features.ts
Outdated
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.
Please add a TODO comment above this line:
// TODO(vojtech): move this flag definition to metal3-plugin via ActionFeatureFlag extensionThere 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.
Done
|
For better consistency, whenever we add new shared selectors, we should also update existing code to use them instead of repeating similar code across multiple places. This can be done as a follow-up, of course. |
|
@jtomasek: This pull request references Bugzilla bug 1748219, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn 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. |
Since the baremetal operator CRD can be installed on non baremetal cluster, this change introduces additional baremetal platform detection by checking the infrastructure.cluster platform which is used to enable metal3-plugin https://bugzilla.redhat.com/show_bug.cgi?id=1748219
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jtomasek, vojtechszocs The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
@jtomasek: All pull requests linked via external trackers have merged. Bugzilla bug 1748219 has been moved to the MODIFIED state. DetailsIn 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. |
Since the baremetal operator CRD can be installed on non baremetal
cluster, this change introduces additional baremetal platform detection
by checking the infrastructure.cluster platform which is used to enable
metal3-plugin
https://bugzilla.redhat.com/show_bug.cgi?id=1748219
TODO:
requiredprop to be `string | string[]'