-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Prevent minikube from crashing if namespace or service doesn't exist #5844
Conversation
Welcome @rajula96reddy! |
Hi @rajula96reddy. Thanks for your PR. I'm waiting for a kubernetes 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. |
Can one of the admins verify this patch? |
Codecov Report
@@ Coverage Diff @@
## master #5844 +/- ##
==========================================
- Coverage 37.01% 36.98% -0.03%
==========================================
Files 144 144
Lines 9010 9019 +9
==========================================
+ Hits 3335 3336 +1
- Misses 5253 5260 +7
- Partials 422 423 +1
|
/assign @medyagh |
@rajula96reddy welcome to contributing to minikube ! thank you for making such a quick PR ! the PR looks good just small request.
how about making the format a bit nicer ? and get rid of the temporary error to the end user ? they don't need to see the temp error. here is an example of using a template with exit minikube/cmd/minikube/cmd/start.go Line 1035 in 134182f
|
Hey! Thank you for your feedback. I will try to improve the format as suggested. |
FYI I created a new issue, #5846 |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: rajula96reddy 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 |
Hey @medyagh! I formatted the error. Let me know what you think about it? Also, I was trying to test my change and wanted to test the below case minikube/pkg/minikube/service/service.go Lines 282 to 285 in 134182f
But I wasn't able to reach this statement, as it was either getting caught in the earlier check or it is not throwing any error at all. Any idea, how to reach this statement? I have also noticed that if minikube is not running,
Is this behavior expected? |
/ok-to-test |
Error: building minikube at head: updating minikube master branch: running [git pull origin master] in /home/performance-monitor/minikube: |
@rajula96reddy I just wanted to see if you still have any questions on how to handle this PR ? |
All Times Minikube (PR 5844): [ 123.180857 122.815112 118.334852] Average minikube: 115.663436 Averages Time Per Log
|
@rajula96reddy yes you could include this in this pr |
Here is an example of using error types https://blog.golang.org/error-handling-and-go |
@rajula96reddy are you still working on 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.
see comments
cmd/minikube/cmd/service.go
Outdated
@@ -77,6 +77,10 @@ var serviceCmd = &cobra.Command{ | |||
|
|||
urls, err := service.WaitForService(api, namespace, svc, serviceURLTemplate, serviceURLMode, https, wait, interval) | |||
if err != nil { | |||
if err.Error() == "Service not found in namespace" { |
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.
Can you make this error a type ? Instead of string
And than have a functional called
IsErrorrSVCNotFound(err)
?
@@ -77,6 +77,10 @@ var serviceCmd = &cobra.Command{ | |||
|
|||
urls, err := service.WaitForService(api, namespace, svc, serviceURLTemplate, serviceURLMode, https, wait, interval) |
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.
because getting list of ALL services is a very quick call,
First, get a list of services and then check if the service is in that list , if there isnt return quick,
then Seconly if the service exist, then wait for the service to be up !
@rajula96reddy are you still working on this ? |
All Times minikube: [ 100.438152 95.368815 92.722641] Average minikube: 96.176536 Averages Time Per Log
|
@rajula96reddy please check the unit test failures https://travis-ci.org/kubernetes/minikube/builds/640656004?utm_source=github_status&utm_medium=notification |
@medyagh Sorry for that. Let me check the test failures. Thanks! |
All Times Minikube (PR 5844): [ 97.375983 95.940267 96.675498] Average minikube: 98.558162 Averages Time Per Log
|
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.
Looks ready to merge other than one nit.
All Times minikube: [ 96.702800 94.278517 90.986860] Average minikube: 93.989392 Averages Time Per Log
|
@rajula96reddy we could merge this if u could please rebase |
45fb308
to
3ffdaf3
Compare
@medyagh Thanks for the feedback. I rebased as requested. Can you please confirm the same & proceed accordingly? Thanks! |
Thank you! |
Fixes issue #5836
Old behavior
New behaviour
PS: Hey! This is my first contribution to K8s 🎉. Pardon me if there are any blunders 😅