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 operator resources to the application list #1591

Merged
merged 2 commits into from
Mar 18, 2020
Merged

Add operator resources to the application list #1591

merged 2 commits into from
Mar 18, 2020

Conversation

andresmgot
Copy link
Contributor

@andresmgot andresmgot commented Mar 17, 2020

Description of the change

Include the Operator instances in the Application list view:

Screenshot from 2020-03-17 19-11-11

In order to obtain the resources of a namespace:

  1. We get the ClusterResourceVersions available in that namespace.
  2. Extract the owned CustomResources that the CSV defines.
    3. Since the apiVersion of the CR is not included in the CSV, we need to obtain that information querying the K8s API for the CR APIGroup.
  3. Once we have the CustomResource name, namespace and apiVersion, we can query all the resources available.

Applicable issues

return async dispatch => {
dispatch(requestCSVs());
try {
const csvs = await Operators.getCSVs(namespace);
const sortedCSVs = csvs.sort((o1, o2) => (o1.metadata.name > o2.metadata.name ? 1 : -1));
dispatch(receiveCSVs(sortedCSVs));
return csvs;
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be returning sortedCSVs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right, in this case is not relevant but yes, we can use sortedCSVs

const name = parsedCRD[0];
const group = parsedCRD.slice(1).join(".");
try {
const resourceGroup = await Kube.getAPIGroup(group);
Copy link
Contributor

Choose a reason for hiding this comment

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

That is unexpected, that the extra request is required (you'd think the resource group would be available on the csv, but shrug)

Copy link
Contributor Author

@andresmgot andresmgot Mar 18, 2020

Choose a reason for hiding this comment

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

yes, it was a bit frustrating when I realized that info is missing from the CSV...
wait, double checking, there is actually a version field that can be used as groupVersion 🤦‍♂️

icon={icon}
info={`${resource.kind} v${csv?.spec.version || "-"}`}
tag1Content={resource.metadata.namespace}
tag2Content="operator"
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed in the screenshot, that we have this "operator" tag for operators, but none for charts. Wondering if rather than adding a tag, we could/should differentiate some other way. Not sure how though - the tag is fine for now.

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, for the moment this tag is used for the charts to specify the status of the release (deployed/failed/...) but we need a better way of differentiating between charts or operators

@andresmgot andresmgot merged commit abff101 into master Mar 18, 2020
@andresmgot andresmgot deleted the crList branch April 7, 2020 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants