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

feat(minikube) display scheduledstop status in minikube status #9793

Merged

Conversation

tharun208
Copy link
Contributor

@tharun208 tharun208 commented Nov 27, 2020

Signed-off-by: Tharun rajendrantharun@live.com

Updated minikube status command to show scheduledStop time

Fixes #9731

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Nov 27, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @tharun208. 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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 27, 2020
@tharun208 tharun208 marked this pull request as draft November 27, 2020 18:29
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 27, 2020
@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@tharun208 tharun208 force-pushed the feat/show_scheduled_stop_status branch from bb0a58f to 07083d4 Compare November 27, 2020 21:01
@tharun208 tharun208 marked this pull request as ready for review November 28, 2020 04:49
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 28, 2020
Copy link
Member

@medyagh medyagh left a comment

Choose a reason for hiding this comment

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

do u mind adding before/after this PR status output ?

in both cases when it is scheduled and not scheduled

Copy link

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

Thank you for taking this issue on! Left a few comments, please let me know if you have any questions.

cmd/minikube/cmd/status.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/status.go Outdated Show resolved Hide resolved
cmd/minikube/cmd/status.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 2, 2020
@tharun208 tharun208 force-pushed the feat/show_scheduled_stop_status branch from 0a54a21 to 5f5fcf2 Compare December 2, 2020 12:12
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 2, 2020
Copy link

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

Thanks for the update, left a suggestion,

cmd/minikube/cmd/status.go Outdated Show resolved Hide resolved
@tharun208 tharun208 force-pushed the feat/show_scheduled_stop_status branch from 5f5fcf2 to 9381646 Compare December 3, 2020 06:15
@tharun208
Copy link
Contributor Author

@priyawadhwa It is working as expected. I will now add a check-in int tests for this and also change the format of the string representation

Copy link

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

An integration test would be great!

Could you also provide the output of:

minikube start
minikube stop --schedule 2m
minikube status
minikube status --output json --layout cluster

cmd/minikube/cmd/status.go Outdated Show resolved Hide resolved
@priyawadhwa
Copy link

priyawadhwa commented Dec 3, 2020

Instead of writing a new test, you can actually just add a check for minikube status in this integration test:

func TestScheduledStopUnix(t *testing.T) {

which basically just makes sure that TimeToStop is set after this block of code runs:

stopMinikube(ctx, t, profile, []string{"--schedule", "5m"})
pid := checkPID(t, profile)
if !processRunning(t, pid) {
t.Fatalf("process %v is not running", pid)
}

@tharun208
Copy link
Contributor Author

minikube status --output json --layout cluster

Screen Shot 2020-12-04 at 1 01 57 PM

@priyawadhwa
Copy link

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 4, 2020
@minikube-pr-bot
Copy link

kvm2 Driver
error collecting results for kvm2 driver: timing run 0 with Minikube (PR 9793): timing cmd: [/home/performance-monitor/.minikube/minikube-binaries/9793/minikube start --driver=kvm2]: starting cmd: fork/exec /home/performance-monitor/.minikube/minikube-binaries/9793/minikube: exec format error
docker Driver
error collecting results for docker driver: timing run 0 with Minikube (PR 9793): timing cmd: [/home/performance-monitor/.minikube/minikube-binaries/9793/minikube start --driver=docker]: starting cmd: fork/exec /home/performance-monitor/.minikube/minikube-binaries/9793/minikube: exec format error

Copy link

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

Thank you for your changes! I tested locally and it's really close, just a couple more suggestions and we should be ready to merge :)

cmd/minikube/cmd/status.go Outdated Show resolved Hide resolved
test/integration/scheduled_stop_test.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 5, 2020
@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 67.3s 63.8s 62.2s
Average time for minikube: 64.4s

Times for Minikube (PR 9793): 62.9s 65.8s 65.5s
Average time for Minikube (PR 9793): 64.7s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9793) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 0.1s     | 0.0s               |
|                           9.11 |          |                    |
| * Using the kvm2 driver based  | 0.0s     | 0.0s               |
| on user configuration          |          |                    |
| * Starting control plane node  | 0.0s     | 0.0s               |
| minikube in cluster minikube   |          |                    |
| * Creating kvm2 VM (CPUs=2,    | 39.1s    | 38.1s              |
| Memory=3700MB, Disk=20000MB)   |          |                    |
| ...                            |          |                    |
| * Preparing Kubernetes v1.19.4 | 23.1s    | 24.3s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.7s     | 1.7s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.2s     |                    |
| default-storageclass,          |          |                    |
| storage-provisioner            |          |                    |
|                                | 0.6s     | 0.0s               |
|   - Want kubectl v1.19.4? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

docker Driver
Times for minikube: 29.4s 28.8s 28.8s
Average time for minikube: 29.0s

Times for Minikube (PR 9793): 29.3s 30.4s 31.7s
Average time for Minikube (PR 9793): 30.5s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9793) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 0.2s     | 0.2s               |
|                           9.11 |          |                    |
| * Using the docker driver      | 0.1s     | 0.1s               |
| based on user configuration    |          |                    |
| * Starting control plane node  | 0.1s     | 0.1s               |
| minikube in cluster minikube   |          |                    |
| * Creating docker container    | 9.1s     | 9.2s               |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.19.4 | 18.2s    | 19.3s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.2s     | 1.3s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| default-storageclass,          |          |                    |
| storage-provisioner            |          |                    |
|                                | 0.0s     | 0.0s               |
|   - Want kubectl v1.19.4? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

@tharun208 tharun208 force-pushed the feat/show_scheduled_stop_status branch from 97af926 to d6a49a5 Compare December 5, 2020 09:20
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 5, 2020
Signed-off-by: Tharun <rajendrantharun@live.com>
@tharun208 tharun208 force-pushed the feat/show_scheduled_stop_status branch from d6a49a5 to c51a204 Compare December 5, 2020 09:22
@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 65.8s 63.6s 66.0s
Average time for minikube: 65.1s

Times for Minikube (PR 9793): 63.4s 65.6s 64.4s
Average time for Minikube (PR 9793): 64.4s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9793) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 0.0s     | 0.0s               |
|                           9.11 |          |                    |
| * Using the kvm2 driver based  | 0.0s     | 0.0s               |
| on user configuration          |          |                    |
| * Starting control plane node  | 0.0s     | 0.0s               |
| minikube in cluster minikube   |          |                    |
| * Creating kvm2 VM (CPUs=2,    | 38.4s    | 38.0s              |
| Memory=3700MB, Disk=20000MB)   |          |                    |
| ...                            |          |                    |
| * Preparing Kubernetes v1.19.4 | 24.2s    | 24.2s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.8s     | 1.7s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.7s     | 0.3s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 0.0s               |
|   - Want kubectl v1.19.4? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

docker Driver
Times for minikube: 30.7s 28.6s 28.1s
Average time for minikube: 29.1s

Times for Minikube (PR 9793): 29.3s 27.6s 30.4s
Average time for Minikube (PR 9793): 29.1s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9793) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 0.2s     | 0.2s               |
|                           9.11 |          |                    |
| * Using the docker driver      | 0.1s     | 0.1s               |
| based on user configuration    |          |                    |
| * Starting control plane node  | 0.1s     | 0.1s               |
| minikube in cluster minikube   |          |                    |
| * Creating docker container    | 8.8s     | 9.1s               |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.19.4 | 18.7s    | 18.4s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.2s     | 1.2s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 0.0s               |
|   - Want kubectl v1.19.4? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

Signed-off-by: Tharun <rajendrantharun@live.com>
@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 67.4s 66.8s 64.0s
Average time for minikube: 66.1s

Times for Minikube (PR 9793): 64.7s 65.9s 63.1s
Average time for Minikube (PR 9793): 64.6s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9793) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 0.0s     | 0.0s               |
|                           9.11 |          |                    |
| * Using the kvm2 driver based  | 0.0s     | 0.0s               |
| on user configuration          |          |                    |
| * Starting control plane node  | 0.0s     | 0.0s               |
| minikube in cluster minikube   |          |                    |
| * Creating kvm2 VM (CPUs=2,    | 39.4s    | 38.2s              |
| Memory=3700MB, Disk=20000MB)   |          |                    |
| ...                            |          |                    |
| * Preparing Kubernetes v1.19.4 | 24.3s    | 23.8s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.8s     | 1.9s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.6s     | 0.4s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.4s     | 0.0s               |
|   - Want kubectl v1.19.4? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

docker Driver
Times for minikube: 30.8s 31.5s 30.5s
Average time for minikube: 30.9s

Times for Minikube (PR 9793): 30.4s 32.1s 29.8s
Average time for Minikube (PR 9793): 30.8s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9793) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 0.2s     | 0.2s               |
|                           9.11 |          |                    |
| * Using the docker driver      | 0.1s     | 0.1s               |
| based on user configuration    |          |                    |
| * Starting control plane node  | 0.1s     | 0.1s               |
| minikube in cluster minikube   |          |                    |
| * Creating docker container    | 9.6s     | 9.2s               |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.19.4 | 19.6s    | 19.6s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.3s     | 1.3s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.4s               |
| default-storageclass,          |          |                    |
| storage-provisioner            |          |                    |
|                                | 0.1s     | 0.0s               |
|   - Want kubectl v1.19.4? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

Copy link

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

Thank you! This is looking really good, just one more comment.

@@ -84,6 +87,8 @@ func TestScheduledStopUnix(t *testing.T) {

// schedule a stop for 5 min from now and make sure PID is created
stopMinikube(ctx, t, profile, []string{"--schedule", "5m"})
// make sure timeToStop is present in status
ensureMinikubeStatus(ctx, t, profile, "TimeToStop", "3m")

Choose a reason for hiding this comment

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

I see that you had to change to using strings.Contains in the ensureMinikubeStatus function, since we can't know what the exact value of TimeToStop will be. Instead of doing a contains, which could potentially fail, I would just check that TimeToStop is a valid duration < 5m.

Then we can also revert back to making sure got == wantStatus in the ensureMinikubeStatus function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, can we pull this check to a seperate function or modify the comparison based on the key value to the ensureMinikubeStatus itself ?.

Choose a reason for hiding this comment

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

Let's do a separate function

Signed-off-by: Tharun <rajendrantharun@live.com>
@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 66.7s 63.1s 62.9s
Average time for minikube: 64.3s

Times for Minikube (PR 9793): 62.3s 62.9s 63.4s
Average time for Minikube (PR 9793): 62.9s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9793) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 0.0s     | 0.0s               |
|                           9.11 |          |                    |
| * Using the kvm2 driver based  | 0.0s     | 0.0s               |
| on user configuration          |          |                    |
| * Starting control plane node  | 0.0s     | 0.0s               |
| minikube in cluster minikube   |          |                    |
| * Creating kvm2 VM (CPUs=2,    | 38.7s    | 37.5s              |
| Memory=3700MB, Disk=20000MB)   |          |                    |
| ...                            |          |                    |
| * Preparing Kubernetes v1.19.4 | 23.6s    | 23.3s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.7s     | 1.7s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 0.0s               |
|   - Want kubectl v1.19.4? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

docker Driver
Times for minikube: 29.5s 32.6s 28.8s
Average time for minikube: 30.3s

Times for Minikube (PR 9793): 28.5s 30.2s 29.0s
Average time for Minikube (PR 9793): 29.2s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9793) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 0.2s     | 0.2s               |
|                           9.11 |          |                    |
| * Using the docker driver      | 0.1s     | 0.1s               |
| based on user configuration    |          |                    |
| * Starting control plane node  | 0.1s     | 0.1s               |
| minikube in cluster minikube   |          |                    |
| * Creating docker container    | 9.1s     | 8.9s               |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.19.4 | 19.6s    | 18.7s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.1s     | 1.2s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 0.1s               |
|   - Want kubectl v1.19.4? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

Copy link

@priyawadhwa priyawadhwa left a comment

Choose a reason for hiding this comment

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

Looks good, thank you so much for contributing this feature!

@priyawadhwa priyawadhwa merged commit 83f9bd1 into kubernetes:master Dec 8, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: priyawadhwa, tharun208

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 8, 2020
@tharun208 tharun208 deleted the feat/show_scheduled_stop_status branch December 8, 2020 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

minikube status should show existing scheduled stops and time left
6 participants