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

Add operators status to Dashboards #3755

Merged
merged 1 commit into from Jan 16, 2020

Conversation

rawagner
Copy link
Contributor

depends on #3754

operators_status

operators_status_deg

@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. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. component/ceph Related to ceph-storage-plugin component/core Related to console core functionality component/dashboard Related to dashboard component/kubevirt Related to kubevirt-plugin component/metal3 Related to metal3-plugin component/noobaa Related to noobaa-storage-plugin component/olm Related to OLM component/sdk Related to console-plugin-sdk component/shared Related to console-shared labels Dec 11, 2019
@rawagner rawagner force-pushed the operators_status branch 2 times, most recently from 9f20b2f to e90f256 Compare December 11, 2019 16:20
Copy link
Contributor

@andybraren andybraren left a comment

Choose a reason for hiding this comment

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

Looking awesome to me. 🎉

I notice that "InstallSucceeded" matches what appears in the Installed Operators List page, but the Details page for a given operator/CSV shows the status as "Succeeded" instead.

I'd probably expect/prefer to see "Succeeded" in this popover, but I'm not sure which one is correct. Is one coming from status.reason and the other from status.phase in the CSV? FYI @itsptk

}) => (
<>
<div className="co-operator-section">
Operators extend Kubernetes with additional custom resources to manage applications
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Operators extend Kubernetes with additional custom resources to manage applications
Operators extend OpenShift with additional custom resources to manage applications.

Added a period and switched to "OpenShift". We might want to validate the language here with an SME.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link

@itsptk itsptk left a comment

Choose a reason for hiding this comment

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

@dmesser @tlwu2013 I spoke with @alecmerdler and he mentioned we are transforming this CSV status in the Installed Operator details to show as just "Succeeded." Could that be appropriate here as well? This is a roll-up status of all the CSVs' statuses for an operator across namespaces, showing the "worst" status.

@rawagner rawagner force-pushed the operators_status branch 3 times, most recently from f0a4be6 to d924a91 Compare December 12, 2019 09:04
@rawagner
Copy link
Contributor Author

rawagner commented Dec 12, 2019

Updated operator status to read from status.phase instead of status.reason
operators_succeeded

operators_installed_succeeded

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 12, 2019
@itsptk
Copy link

itsptk commented Dec 12, 2019

Updated operator status to read from status.phase instead of status.reason

I think my inclination would be to continue to gather the operator status from reason and just transform the string in the status card (similar to the installed operator details.) Changing where this status is gathered from is a bigger change and would need more consideration.

@rawagner
Copy link
Contributor Author

Updated operator status to read from status.phase instead of status.reason

I think my inclination would be to continue to gather the operator status from reason and just transform the string in the status card (similar to the installed operator details.) Changing where this status is gathered from is a bigger change and would need more consideration.

CSV details page is using status.phase https://github.com/openshift/console/blob/master/frontend/packages/operator-lifecycle-manager/src/components/clusterserviceversion.tsx#L714 and CSV list page status.reason. So which one is correct/better ?

@andybraren
Copy link
Contributor

CSV details page is using status.phase https://github.com/openshift/console/blob/master/frontend/packages/operator-lifecycle-manager/src/components/clusterserviceversion.tsx#L714 and CSV list page status.reason. So which one is correct/better ?

@dmesser @tlwu2013?

@andybraren
Copy link
Contributor

For the "Degraded" and "Upgrading" sublabels, would we be able to show a count of how many are degraded/upgrading like 2 Degraded or 7 Upgrading?

@andybraren
Copy link
Contributor

@rawagner I shared the original design at a UX meeting earlier today and got some great feedback about the all-okay state. I haven't gotten feedback on this design tweak yet, but here it is for reference:

concept-operator-status

Instead of showing the first 5 alphabetical operators that are all "Succeeded" in each section (which is somewhat arbitrary, distracting, and doesn't confirm that all the other operators are healthy) we'd show a collapsed "All succeeded" (or whatever it ends up being) status with the same "View all" link on the left.

Sorry for the mid-PR change, just trying to keep up with you. 🙂

@itsptk
Copy link

itsptk commented Dec 13, 2019

Spoke with @tlwu2013 , we agreed that this popover should be using status.phase, since thats what the user would see in the the operator details if they clicked the operator name in popover. We didn't want to change the operator list view status at this time, as that is being actively reworked in https://jira.coreos.com/browse/PD-275

@rawagner rawagner force-pushed the operators_status branch 8 times, most recently from 62fc88d to 910a506 Compare January 13, 2020 09:15

/**
* Link to all resources page.
* If not provided than list page of first resource from resources prop is used.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* If not provided than list page of first resource from resources prop is used.
* If not provided then a list page of first resource from resources prop is used.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

/**
* Link to all resources page.
* If not provided than list page of first resource from resources prop is used.
* */
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* */
*/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

const operatorStatuses = getOperatorsWithStatuses(resources);
const sortedOperatorStatuses = getMostImportantStatuses(operatorStatuses)
.sort((a, b) => a.operators[0].metadata.name.localeCompare(b.operators[0].metadata.name))
.slice(0, 5);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we limiting displayed operator statuses to a total of 5 by design?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, max 5 is by design

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, thinking about this again, maybe we should reconsider and show all degraded/failed operators in the popover rather than just the first alphabetical 5 (which is arbitrary). I think that would be more useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, limit is now removed

) : (
!operatorsHealthy &&
sortedOperatorStatuses.map((operatorStatus) => (
<AsyncComponent
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

operators: [],
};
}
const operatorsByStatus: { [key: string]: OperatorStatusWithResources<R> } = operators.reduce<{
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 the alternative way, which types the accumulator value

const operatorsByStatus = operators.reduce(
  (acc, o) => {
    // ..
  },
  {} as { [key: string]: OperatorStatusWithResources<R> },
);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

doing

{} as { [key: string]: OperatorStatusWithResources<R> }

throws error

Type assertion on object literals is forbidden, use a type annotation instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is that an ESLint rule? It shouldn't do any harm on empty objects 😃 oh 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.

yes, eslint rule eslint(@typescript-eslint/no-object-literal-type-assertion) :)

},
};

type HealthStateMappingKeys = Exclude<keyof typeof HealthState, 'LOADING'>;
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

],
getOperatorsWithStatuses: getClusterServiceVersionsWithStatuses,
operatorRowLoader: () =>
import(
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's stay consistent in how we use dynamic imports within this specific module:

loader: async () =>
  (await import('./components/dashboard/csv-status' /* webpackChunkName: "csv-dashboard-status" */))
    .default,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

status: {
installedCSV: getName(csv),
},
} as any); // 'as any' to supress typescript error caused by lodash;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we use generic type params when calling _.find function? Using as any is discouraged.

/>
);
})
.reverse();
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the intention behind reversing the sections array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we want to have CSV operators before Cluster operators thus we need to reverse the order of extensions (cluster operators are contributed by console app, CSV by operator-lifecycle). We can improve that later on if we will have any more complex cases, like including some extensions before/after others (similar to nav items) but reverse is enough for now

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it better then to explicitly sort the extensions in a way that Cluster operators come before any other ones?

Copy link
Contributor

Choose a reason for hiding this comment

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

A better solution IMO is to add e.g. priority property to allow sorting extensions in a specific way when they are consumed.

For now, I'm OK with a simple reverse.

export type AsyncComponentProps = {
loader: () => Promise<React.ComponentType>;
LoadingComponent?: React.ReactNode;
} & any;
Copy link
Contributor

Choose a reason for hiding this comment

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

We can improve that later, but I'd encourage not to use type Foo = xxx & any in new code, just like with as any type cast.

@rawagner rawagner force-pushed the operators_status branch 2 times, most recently from 8e33ab1 to f8b9b47 Compare January 15, 2020 13:15
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 15, 2020
@openshift-ci-robot openshift-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jan 15, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 15, 2020
@vojtechszocs
Copy link
Contributor

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jeff-phillips-18, rawagner, vojtechszocs

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

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. component/ceph Related to ceph-storage-plugin component/core Related to console core functionality component/dashboard Related to dashboard component/kubevirt Related to kubevirt-plugin component/metal3 Related to metal3-plugin component/noobaa Related to noobaa-storage-plugin component/olm Related to OLM component/sdk Related to console-plugin-sdk component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants