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 1970466: Console's OperatorHub leads users to unrelated install plan, if subscription does not have its own #9256

Conversation

kdoberst
Copy link
Contributor

Related to Bug 1970466

When viewing an operator's detail information, a message is shown if the installed CSV(startingCSV) is not found instead of displaying that the operator has been installed.

Bug 1970466

As coded, if a yaml contains an unknown starting CSV, when calling useK8sWatchResource, the name key is set to undefined. This causes usek8sWatchResource to return a perviously installed operator to be returned causing incorrect information to be shown.

@openshift-ci openshift-ci bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Jun 15, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 15, 2021

@kdoberst: This pull request references Bugzilla bug 1970466, which is invalid:

  • expected the bug to target the "4.9.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:

[WIP] Bug 1970466: Console's OperatorHub leads users to unrelated install plan, if subscription does not have its own

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
Copy link
Contributor

openshift-ci bot commented Jun 15, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: kdoberst
To complete the pull request process, please assign spadgett after the PR has been reviewed.
You can assign the PR to them by writing /assign @spadgett in a comment when ready.

The full list of commands accepted by this bot can be found 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 openshift-ci bot added component/olm Related to OLM kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated labels Jun 15, 2021
@kdoberst
Copy link
Contributor Author

/bugzilla refresh

@openshift-ci openshift-ci bot added bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. and removed bugzilla/invalid-bug Indicates that a referenced Bugzilla bug is invalid for the branch this PR is targeting. labels Jun 15, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 15, 2021

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

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.9.0) matches configured target release for branch (4.9.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @yapei

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 openshift-ci bot requested a review from yapei June 15, 2021 14:47
@kdoberst
Copy link
Contributor Author

@openshift/team-ux-leads. Can you please take a look at this PR? There is a new message that is introduced as part of this PR and looking for feedback.

/assign @openshift/team-ux-leads

@kdoberst
Copy link
Contributor Author

/assign @openshift/team-ux-leads

@kdoberst kdoberst changed the title [WIP] Bug 1970466: Console's OperatorHub leads users to unrelated install plan, if subscription does not have its own Bug 1970466: Console's OperatorHub leads users to unrelated install plan, if subscription does not have its own Jun 22, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 22, 2021
@kdoberst
Copy link
Contributor Author

/retest


if (!subscription?.status?.installedCSV) {
return (
<HintBlock className="co-catalog-page__hint" title="Operator Not Yet Installed">
Copy link
Member

Choose a reason for hiding this comment

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

Hey, Kim. We might look at the messaging here. It's odd to see an "Uninstall" button on the same page with "Operator Not Yet Installed." Is the operator is still installing or installation failed? Is there something in the Subscription resource that will let us give a more specific status to the user?

cc @tlwu2013

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 didn't see anything in the subscription resource that would indicate that the CSV hasn't been found vs a failure, but I can look again.

I would love some suggestions on what the UI should respond with installedCSV is undefined or missing. I just went with what was suggested in the bug.

Copy link
Member

Choose a reason for hiding this comment

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

Looking below, I see we try to fallback to the Subscription link when there's no CSV. I think that's the intended behavior, and I'd do that for this case as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here is where this bug gets kind of weird. On line 71, installedCSV is created by passing information.

 const [installedCSV] = useK8sWatchResource<ClusterServiceVersionKind>({
    kind: referenceForModel(ClusterServiceVersionModel),
    name: subscription?.status?.installedCSV,
    namespace: subscription?.metadata?.namespace,
    isList: false,
    namespaced: true,
  });

In the case described in the bug, subscription.staus.insatlledCSV is actually undefined, but a item is returned from useK8sWatchResource. So the logic used below on line 88:

 const to = installedCSV
    ? `${nsPath}/clusterserviceversions/${installedCSV?.metadata?.name ?? ''}`
    : `${nsPath}/subscriptions/${subscription.metadata.name ?? ''}`;

Would always return true. What is actually happening is that the results from the useK8sWatchResource appears to return information on another installed operator where there was a valid CSV.

The only piece of data that I could find to indicate this situation where need information is known except a valid CSV is checking for subscription?.status?.installedCSV.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh weird. I'm seeing this too. We probably need to beef that logic up a bit more.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think Sam is right and #9346 does cover this case (since it overrides the install hint block), but I'll double check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @rebeccaalpert for taking a look.

Copy link
Member

Choose a reason for hiding this comment

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

Hi @kdoberst! I think I might have written that, good catch. We probably need to add a condition there to make sure that nothing gets passed into useK8sWatchResource if subscription.status.installedCSV is empty. Something like:

 const [installedCSV] = useK8sWatchResource<ClusterServiceVersionKind>( 
   subscription?.status?.installedCSV ? {
     kind: referenceForModel(ClusterServiceVersionModel),
     name: subscription?.status?.installedCSV,
     namespace: subscription?.metadata?.namespace,
     isList: false,
     namespaced: true,
   } : null);

Copy link
Contributor

Choose a reason for hiding this comment

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

@kdoberst - I tried the subscription YAML update in https://bugzilla.redhat.com/show_bug.cgi?id=1970466 against my PR and it doesn't trigger the new "isInstalling" hint block from what I can tell. I also wasn't seeing the error though. Did you use a different YAML to test it?

@spadgett
Copy link
Member

I think this bug is superseded by story https://issues.redhat.com/browse/CONSOLE-2805, which will add an "Installing" status to OperatorHub.

cc @rebeccaalpert

@itsptk
Copy link

itsptk commented Jun 29, 2021

Agreed that this would probably be replaced by CONSOLE-2805, which has UX design: https://docs.google.com/document/d/1_YylQbRfFO0CI5Lmf9UDOHuIeOULHBY3vicI1x_RE38/edit

cc @tlwu2013

@spadgett
Copy link
Member

spadgett commented Jul 6, 2021

Closing in favor of #9346

@spadgett spadgett closed this Jul 6, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 6, 2021

@kdoberst: This pull request references Bugzilla bug 1970466. The bug has been updated to no longer refer to the pull request using the external bug tracker. All external bug links have been closed. The bug has been moved to the NEW state.

In response to this:

Bug 1970466: Console's OperatorHub leads users to unrelated install plan, if subscription does not have its own

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla/severity-medium Referenced Bugzilla bug's severity is medium for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/olm Related to OLM kind/i18n Indicates issue or PR relates to internationalization or has content that needs to be translated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants