Skip to content

Conversation

@jtomasek
Copy link

@jtomasek jtomasek commented Sep 2, 2019

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:

  • enable dashboard extension items required prop to be `string | string[]'

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. component/core Related to console core functionality component/metal3 Related to metal3-plugin component/sdk Related to console-plugin-sdk component/shared Related to console-shared size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 2, 2019
@jtomasek
Copy link
Author

jtomasek commented Sep 2, 2019

/assign @vojtechszocs

Copy link
Contributor

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.

Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor

@vojtechszocs vojtechszocs left a 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.

Copy link
Contributor

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'))

Copy link
Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

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);
    }
  );

Copy link
Author

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.

Copy link
Contributor

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 extension

Copy link
Author

Choose a reason for hiding this comment

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

Done

@vojtechszocs
Copy link
Contributor

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.

@openshift-ci-robot openshift-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. component/ceph Related to ceph-storage-plugin component/noobaa Related to noobaa-storage-plugin size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Sep 5, 2019
@jtomasek jtomasek changed the title [WIP] Detect baremetal platform Bug 1748219: Detect baremetal platform Sep 5, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 5, 2019
@openshift-ci-robot
Copy link
Contributor

@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.

Details

In response to this:

Bug 1748219: Detect baremetal platform

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.

@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Sep 5, 2019
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
@vojtechszocs
Copy link
Contributor

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 5, 2019
@openshift-ci-robot
Copy link
Contributor

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 5, 2019
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit e5d4972 into openshift:master Sep 5, 2019
@openshift-ci-robot
Copy link
Contributor

@jtomasek: All pull requests linked via external trackers have merged. Bugzilla bug 1748219 has been moved to the MODIFIED state.

Details

In response to this:

Bug 1748219: Detect baremetal platform

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.

@jtomasek jtomasek deleted the detect-baremetal-platform branch September 6, 2019 05:11
@spadgett spadgett added this to the v4.2 milestone Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/ceph Related to ceph-storage-plugin component/core Related to console core functionality component/metal3 Related to metal3-plugin component/noobaa Related to noobaa-storage-plugin component/sdk Related to console-plugin-sdk component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants