-
Notifications
You must be signed in to change notification settings - Fork 244
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
Refactor catalog code #2133
Refactor catalog code #2133
Conversation
1be1dcb
to
86f12f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly comments. Not sure if they would end up having to make changes to the code.
|
||
clusterServiceClasses, err := getClusterCatalogServices(client) | ||
if err != nil { | ||
return ServiceTypeList{}, errors.Wrapf(err, "unable to get cluster serviceClassExternalName") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Is there some typo in this error message?
- Also, the error message (in its current form) seems likely to confuse the CLI user instead of help them understand what failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No typo, this is from previous code.
|
||
classes, err := client.GetClusterServiceClasses() | ||
if err != nil { | ||
return nil, errors.Wrap(err, "unable to get cluster service classes") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this error message going to show up when odo catalog list services
fails? I'm kind of confused as to what a cluster service class
means and am wondering if the users might end up in similar situation as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope this is normal. This was from previous code.
} | ||
|
||
// ServiceType ... | ||
type ServiceType struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as ComponentType
. Why not just Service
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also about the // ServiceType ...
would having more info in the comment help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discussed with @kadel and ServiceType and Component Type is a better fit than just Service and Component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more info in the comment?
if len(unsupCatalogList) != 0 { | ||
fmt.Fprintln(w, "OpenShift Components:") | ||
o.printCatalogList(w, unsupCatalogList) | ||
w.Flush() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this output expected:
$ ./odo catalog list components
OpenShift Components:
NAME PROJECT TAGS
dotnet openshift 2.0,latest
httpd openshift 2.4,latest
nginx openshift 1.10,1.12,1.8,latest
nodejs openshift 10,6,8,8-RHOAR,latest
perl openshift 5.24,5.26,latest
php openshift 7.0,7.1,latest
python openshift 2.7,3.5,3.6,latest
ruby openshift 2.3,2.4,2.5,latest
wildfly openshift 10.0,10.1,11.0,12.0,13.0,8.1,9.0,latest
I was expecting list of supported & unsupported catalog components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is because of #2129. you can use the PSI cluster which should show you supported and unsupported
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to check aginst PSI cluster? If I check against any other cluster, it won't show what's supported and what's not? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upstream images vs downstream images. and we have PR which will resolve it - #2129
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
upstream images have different repositories and do observe that the above list doesn't even mention java
, this is because due to licensing upstream okd cannot have java shipped in it.
And as per nodejs images, the repository urls for component image streams are different between upstream and downstream openshift.
We added the downstream images in supported
list. but forgot to add the upstream
images.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this is not in scope of this PR and hence can be done on a separate issue related to "improving catalog component output"
@dharmit WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing the hold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsupported is an ambiguous term which could be taken by the user as that they cannot even use odo with their cluster.
The current output in my opinion effective and actually adapts to this scenario well.
How we can say that on one cluster we officially support the image, and on the other one we don't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this is not in scope of this PR and hence can be done on a separate issue related to "improving catalog component output"
@dharmit WDYT?
Yes, but this is still an issue that needs to be fixed. @dharmit can you open a new issue for this?
This is a bug that needs to be fixed. Good job noticing it @dharmit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
86f12f0
to
97b1157
Compare
97b1157
to
a292ad6
Compare
acf1c98
to
abd0c22
Compare
are all the comments addressed @cdrage? |
@girishramnani yes, I marked them all as resolved. Please do another review @girishramnani @dharmit @amitkrout |
abd0c22
to
e2eb5b0
Compare
} | ||
|
||
// ServiceSpec is the spec for ServiceType | ||
type ServiceSpec struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ServiceTypeSpec
then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ServiceSpec seems okay for now as discussed with @kadel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fine by me then
/hold Till we reach a conclusion on #2133 (comment). I'm fine being wrong about it but just want to make sure that something's not wrong. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see some minimal changes in the test files which looks good me, however i am not adding any label to it because i am not confident on rest of the code changes.
I would expect review from reviewer in the list
/hold cancel |
#2133 (comment) should be fixed outside of this PR as it's unrelated to the JSON support in this PR, correct? It seems like a bug fix that needs to be fixed separately. |
yes this fix should be outside of the PR |
I agree that this should be fixed outside this PR. The "hold" was only meant to reach a mutual conclusion on the topic and understand if the absence of "Unsupported" image is a problem or not. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: girishramnani 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 |
/hold I had a lot of comments, and want to have one more look before this gets merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a few places, you forgot to fill information for APIVersion
.
No other blockers.
The above issue made me think. Wouldn't it be more convenient to have functions that instantiate the structs? For example, NewComponentType
that would return an instance of a new ComponentType
with all MetaType
fields filled. Then you would be able to fill those values just once in one commonplace.
It is up to you whatever you want to do this or not. I think that it would make it more maintainable. But it is up to you @cdrage
e2eb5b0
to
ed8a5f6
Compare
Thanks @kadel For now I'll put off with adding a new function until I start implementing other components of return ComponentTypeList{
TypeMeta: metav1.TypeMeta{
Kind: "ComponentTypeList",
APIVersion: "odo.openshift.io/v1alpha1",
},
Items: catalogList,
}, nil I'd like to however find a way to create a universal output with a standard |
ed8a5f6
to
34a8384
Compare
/test v4.2-e2e-scenarios |
This PR: - Changes how we use `odo catalog list services` (using ServiceTypeList and ServiceType) - Changes how we use `odo catalog list components (using ComponentTypeList and ComponentType) - Refactors the code from occlient.go and puts it inside of catalog/catalog.go - Changes how to we output services by using `ServiceTypeList` - Changes the API structure of `odo catalog list services` To test: ```sh odo catalog list services odo catalog list components ``` See below for an example of the updated json: ```json { "kind": "ServiceTypeList", "apiVersion": "odo.openshift.io/v1alpha1", "metadata": { "creationTimestamp": null }, "items": [ { "kind": "ServiceType", "metadata": { "name": "cakephp-mysql-persistent", "creationTimestamp": null }, "spec": { "hidden": false, "planList": [ "default" ] } }, { "kind": "ServiceType", "metadata": { "name": "dancer-mysql-persistent", "creationTimestamp": null }, "spec": { "hidden": false, "planList": [ "default" ] } }, } } ```
34a8384
to
fcff75f
Compare
/retest
|
/hold cancel |
@amitkrout I don't understand what could be the reason of failure here:
/test v4.2-e2e-scenarios |
This PR:
odo catalog list services
(using ServiceTypeListand ServiceType)
ComponentTypeList and ComponentType)
catalog/catalog.go
ServiceTypeList
odo catalog list services
To test:
See below for an example of the updated json: