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

Bug 1801584: Fixed Inconsistency in kebab and actions menu for storage cluster #4352

Merged
merged 1 commit into from Feb 26, 2020

Conversation

gnehapk
Copy link
Contributor

@gnehapk gnehapk commented Feb 18, 2020

fixed-incosistency

@openshift-ci-robot
Copy link
Contributor

@gnehapk: This pull request references Bugzilla bug 1801584, which is invalid:

  • expected the bug to target the "4.4.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 1801584: Fixed Inconsistency in kebab and actions menu for storage cluster

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 bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 18, 2020
@openshift-ci-robot openshift-ci-robot added the component/olm Related to OLM label Feb 18, 2020
@gnehapk
Copy link
Contributor Author

gnehapk commented Feb 18, 2020

@spadgett Please review.

@gnehapk
Copy link
Contributor Author

gnehapk commented Feb 18, 2020

/test e2e-gcp-console
/test analyze

@gnehapk
Copy link
Contributor Author

gnehapk commented Feb 19, 2020

/bugzilla refresh

@openshift-ci-robot
Copy link
Contributor

@gnehapk: This pull request references Bugzilla bug 1801584, which is invalid:

  • expected the bug to target the "4.5.0" release, but it targets "4.4.0" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/bugzilla refresh

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.

@gnehapk
Copy link
Contributor Author

gnehapk commented Feb 19, 2020

/bugzilla refresh

@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 Feb 19, 2020
@openshift-ci-robot
Copy link
Contributor

@gnehapk: This pull request references Bugzilla bug 1801584, 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.

In response to this:

/bugzilla refresh

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 removed the bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. label Feb 19, 2020
Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

Can you give more detail about what was happening previously to cause the bug? It's hard to suggest a good solution since the function doesn't have types.

@@ -64,12 +64,19 @@ const csvName = () =>
);

const getActions = (selectedObj: any) => {
let group = '';

if (selectedObj.apiVersion.includes('/')) {
Copy link
Member

Choose a reason for hiding this comment

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

We shouldn't be doing any parsing of the apiVersion string here. All of that logic is already handled elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order to verify the group, I have passed the kindObj<k8sKind> from here which does not have apiVersion as a property. Hence, I need to do these changes to get the group.

line basically checks whether the actions(from the ClusterServiceVersionAction extension) need to be added or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As the checks have been added here only, hence I have also used the method to do so.

Copy link
Member

Choose a reason for hiding this comment

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

You should rename the parameter and the type. It's no longer a k8s object. I'd suggest model: K8sKind

Why does the kind object not have an api version property? It should.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, are we somethings passing a k8s object and sometimes a model? That's not a good pattern. We should always pass the same type to this function and not attempt to do any detection.

Copy link
Contributor

@afreen23 afreen23 Feb 25, 2020

Choose a reason for hiding this comment

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

I see for having the CSV action enabled, we need to match kind and apigroup (apigroup because of this).
The getActions(selectedObj) is called twice: for Kebab actions and menu actions.
For Kebab Actions what we are passing is a k8sResource but for menuActions a string

When rather passing K8sKind object (instead of model ref string) to getActions call, it can show CSV actions, only if we drill down the right apiversion to this format "group/version".

One approach i can think of:

groupVersionFor(apiVersionForModel(selectedObj)).group === action.properties.apiGroup

@gnehapk @spadgett ^^

Copy link
Member

Choose a reason for hiding this comment

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

We should always pass the model to this method. We shouldn't sometimes pass the model and sometimes pass an instance. We have the model in both contexts already.

Copy link
Contributor

Choose a reason for hiding this comment

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

@spadgett thanks for the inputs, any pointers on the models for kebabactions ? The OperandTableRowProps seems to provide only a k8sresource.

Or one more thing we can do if you consider:

Just passing kind and apigroup in the getActions function only.

const getActions = ({kind, apiGroup}) => {
....

Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

I think the simplest thing to do is to change getActions to take a referene

const getActions = (reference: K8sResourceKindReference) => {

and pass it

        <ResourceKebab actions={getActions(referenceFor(obj)} kind={referenceFor(obj)} resource={obj} />

and

    menuActions={getActions(props.modelRef)}

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed 👍

if (selectedObj.apiVersion.includes('/')) {
group = groupVersionFor(selectedObj.apiVersion).group;
} else {
group = selectedObj.apiGroup;
Copy link
Member

Choose a reason for hiding this comment

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

What is selectedObj? k8s resources don't have this field.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have passed the kindObj<k8sKind> from here which does not have apiVersion as a property but have apiGroup in order to get the group.

@@ -64,12 +64,19 @@ const csvName = () =>
);

const getActions = (selectedObj: any) => {
Copy link
Member

Choose a reason for hiding this comment

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

Not new, but we should have a type other than any here. It's hard to recommend a fix since it's unclear what kind of obj this is.

@gnehapk
Copy link
Contributor Author

gnehapk commented Feb 20, 2020

@spadgett All the actions that are present inside the kebab menu for storagecluster i.e.
storagecluster-kebab-menu

are not there in the storage cluster details view(by clicking the storage cluster name's link from above)

storagecluster-details-page

These changes target this bug. Hope this explains.

@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 25, 2020

@gnehapk: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/verify f4b7d0f link /test verify

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@gnehapk
Copy link
Contributor Author

gnehapk commented Feb 26, 2020

/assign @spadgett

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 26, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gnehapk, spadgett

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 /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 Feb 26, 2020
@openshift-merge-robot openshift-merge-robot merged commit edd00c2 into openshift:master Feb 26, 2020
@openshift-ci-robot
Copy link
Contributor

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

In response to this:

Bug 1801584: Fixed Inconsistency in kebab and actions menu for storage cluster

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.

@spadgett spadgett added this to the v4.5 milestone Feb 28, 2020
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/olm Related to OLM lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants