-
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
add --watch flag for minikube status with optional interval duration #9487
Conversation
Hi @prezha. 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. |
Travis tests have failedHey @prezha, 1st Buildmake test
TravisBuddy Request Identifier: 6a745c80-1187-11eb-bfd1-1f84b849c73d |
Can one of the admins verify this patch? |
/ok-to-test |
kvm2 Driver |
cmd/minikube/cmd/status.go
Outdated
if !watch { | ||
os.Exit(exitCode(statuses)) | ||
} | ||
time.Sleep(1 * time.Second) |
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.
how about making this configureable ?
like --watch-interval with a default value of 1 second?
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.
like the idea!
and instead of adding a separate flag, would we want just to expand the --watch
flag to also support an optional value (defaulting to 1 sec)? ie
-w, --watch duration[=1s] Continuously listing/getting the status with optional interval duration. (default 1s)
so, eg, -w=5s
would sleep for 5 sec between consecutive polls
i've made changes to the pr according to this proposal - please have a look and share your thoughts
kvm2 Driver Times for Minikube (PR 9487): 60.4s 61.5s 59.9s Averages Time Per Log
docker Driver Times for Minikube (PR 9487): 28.8s 28.1s 28.5s 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.
I think the functionality we want is:
- If --watch isn't set, then only print status once
- If --watch is set, then print status at the given duration
Right now, it looks to me like we default to printing every second.
cmd/minikube/cmd/status.go
Outdated
@@ -203,59 +204,63 @@ var statusCmd = &cobra.Command{ | |||
cname := ClusterFlagValue() | |||
api, cc := mustload.Partial(cname) | |||
|
|||
var statuses []*Status | |||
for { | |||
var statuses []*Status |
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.
Could you move all of the code in the for loop into a separate function? That would make this more readable.
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.
@priyawadhwa i've moved the code to a separate func writeStatusesAtInterval
, please have a look
@priyawadhwa thank you for your comment - would you say that the proposal above is in line with that or you think it should be a separate flag? |
@prezha yes, I agree with your proposal. If something like, |
yes, that is the idea, thank you for confirming |
kvm2 Driver Times for Minikube (PR 9487): 55.6s 54.1s 53.6s Averages Time Per Log
docker Driver Times for Minikube (PR 9487): 26.7s 27.5s 27.2s Averages Time Per Log
|
b6c384e
to
58dbc5c
Compare
Travis tests have failedHey @prezha, 1st Buildmake test
TravisBuddy Request Identifier: cca02ca0-2158-11eb-a04c-b76cbd6ddda3 |
58dbc5c
to
7cc4676
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.
looks good I have a suggestion that only for the --watch flag we set the log file size maximum to be 10 MB
that will prevent the user's machine tmp dir be filled up with a huge log dir
thanks @medyagh for your review and |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: medyagh, prezha 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 |
fixes: #9468
add
minikube status --watch[=duration]
(-w
) flag that will produce continuous output waiting for a specified duration (defaulting to 1 sec) between each pollexample output