-
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
Add support for url describe command #2694
Add support for url describe command #2694
Conversation
Hi @jichenjc. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/ok-to-test |
@jichenjc Thanks for the PR. Please edit the description and link the issue with this PR. Also please add some steps for testing the PR. |
pkg/odo/cli/url/describe.go
Outdated
urls, err := url.List(o.Client, o.localConfigInfo, o.Component(), o.Application) | ||
if err != nil { | ||
return err | ||
} | ||
u, err := urls.Get(o.url) | ||
if err != nil { | ||
return err | ||
} |
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.
Since url describe
can take only one URL name as a parameter input, I don't think we need url.List() here. We have faced slowness because of listing when we didn't need it. Please write a generic Get function for URL and use the client to make a get call for a route. Also to find the state, please use the local Config.
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.
got it , will double check how to do this
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.
@mik-dass
um.. after double check , seems we have something like
clusterURL := getMachineReadableFormat(r)
which means we can't search in etcd directly, we need get back the data then do some transform and
this of course need list ,
I can change the function to Get() the compare in the new function but still need list
so don't know how much improvement we get can... so, still a O(n) search , not O(1)
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 you don't need a list. First write getRoute() function in occlient.go like https://github.com/openshift/odo/blob/master/pkg/occlient/occlient.go#L484 which returns the found route. Then write a Get() (don't use the existing one, it requires a list) function, call the getRoute() in occlient.go and transform the returned route to machine readable format using getMachineReadableFormat().
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.
ok, get your point, I will try the way you suggested, thanks!
pkg/odo/util/cmdutils.go
Outdated
@@ -136,7 +136,7 @@ func PrintComponentInfo(client *occlient.Client, currentComponentName string, co | |||
|
|||
// Gather the output | |||
for _, componentURL := range componentDesc.Spec.URL { | |||
url := urls.Get(componentURL) | |||
url, _ := urls.Get(componentURL) |
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.
please don't ignore the error. If the function returns a error, this might cause a panic as the returned URL will be empty.
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.
got it , thanks
Also please add some integration test for this feature |
2de037b
to
ed4ef79
Compare
ed4ef79
to
e97ca20
Compare
/retest |
c33e659
to
31ee7fa
Compare
Codecov Report
@@ Coverage Diff @@
## master #2694 +/- ##
==========================================
+ Coverage 43.13% 43.43% +0.29%
==========================================
Files 77 86 +9
Lines 7314 7978 +664
==========================================
+ Hits 3155 3465 +310
- Misses 3855 4173 +318
- Partials 304 340 +36
Continue to review full report at Codecov.
|
562ff77
to
95cceb4
Compare
95cceb4
to
eda9728
Compare
@@ -88,6 +88,21 @@ var _ = Describe("odo url command tests", func() { | |||
}) | |||
}) | |||
|
|||
Context("Describing urls", func() { | |||
It("should describe appropriate URLs and push message", func() { |
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.
please add some more cases with the various pushed states or maybe even add them here itself
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.
ok
eda9728
to
0414a79
Compare
0414a79
to
8a39bd6
Compare
This might not be that useful right now, as it is not providing any additional information compared to 👍 |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kadel 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 |
Integration test looks good to me |
What type of PR is this?
What does does this PR do / why we need it:
implemented this: I certainly can do further change on the output format, just submit
this for some comments
Which issue(s) this PR fixes:
Fixes #?
How to test changes / Special notes to the reviewer: