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

Implement scheduled stop on windows #9689

Merged
merged 17 commits into from
Nov 18, 2020

Conversation

priyawadhwa
Copy link

@priyawadhwa priyawadhwa commented Nov 12, 2020

Implements scheduled stop on windows.

This PR creates a minikube-scheduled-stop systemd service which is responsible for shutting down minikube from within. When a user runs:

minikube stop --schedule 2m

then minikube will:

  1. Set an env variable SLEEP=120 via an environment file only the systemd service has access to
  2. Starts the minikube-scheduled-stop systemd service

The systemd service reads the value of SLEEP and sleeps that amount of time. It then powers off minikube from within.

Cancelling old scheduled stops is as simple as running sudo systemctl stop minikube-scheduled-stop within minikube.

Tested the integration test on our windows instance with hyperv and docker and it passes.

Part of #9271

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 12, 2020
@priyawadhwa
Copy link
Author

/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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 12, 2020
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 12, 2020
@minikube-pr-bot
Copy link

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

@priyawadhwa priyawadhwa changed the title Implement scheduled stop on windows with kic Implement scheduled stop on windowss Nov 13, 2020
@priyawadhwa priyawadhwa changed the title Implement scheduled stop on windowss Implement scheduled stop on windows Nov 13, 2020
@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 55.7s 54.3s 52.2s
Average time for minikube: 54.1s

Times for Minikube (PR 9689): 53.3s 54.8s 58.7s
Average time for Minikube (PR 9689): 55.6s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9689) |
+--------------------------------+----------+--------------------+
| * minikube v1.14.2 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,    | 31.5s    | 32.2s              |
| Memory=3700MB, Disk=20000MB)   |          |                    |
| ...                            |          |                    |
| * Preparing Kubernetes v1.19.2 | 20.7s    | 21.7s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.3s     | 1.4s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.4s     | 0.3s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 0.0s               |
|   - Want kubectl v1.19.2? 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: 28.6s 27.0s 27.4s
Average time for minikube: 27.7s

Times for Minikube (PR 9689): 30.1s 28.0s 27.9s
Average time for Minikube (PR 9689): 28.7s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9689) |
+--------------------------------+----------+--------------------+
| * minikube v1.14.2 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.6s     | 8.5s               |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.19.2 | 17.5s    | 18.7s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.1s     | 1.0s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 0.0s               |
|   - Want kubectl v1.19.2? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 58.5s 54.5s 55.6s
Average time for minikube: 56.2s

Times for Minikube (PR 9689): 55.6s 53.0s 54.4s
Average time for Minikube (PR 9689): 54.3s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9689) |
+--------------------------------+----------+--------------------+
| * minikube v1.14.2 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,    | 32.5s    | 31.1s              |
| Memory=3700MB, Disk=20000MB)   |          |                    |
| ...                            |          |                    |
| * Preparing Kubernetes v1.19.2 | 21.8s    | 21.6s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.4s     | 1.5s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.4s     | 0.1s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 0.0s               |
|   - Want kubectl v1.19.2? 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: 27.4s 27.6s 28.0s
Average time for minikube: 27.6s

Times for Minikube (PR 9689): 28.4s 27.4s 26.7s
Average time for Minikube (PR 9689): 27.5s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9689) |
+--------------------------------+----------+--------------------+
| * minikube v1.14.2 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.9s     | 8.8s               |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.19.2 | 17.3s    | 17.3s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.1s     | 1.0s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 0.0s               |
|   - Want kubectl v1.19.2? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 58.1s 55.3s 54.4s
Average time for minikube: 56.0s

Times for Minikube (PR 9689): 52.4s 55.2s 58.3s
Average time for Minikube (PR 9689): 55.3s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9689) |
+--------------------------------+----------+--------------------+
| * minikube v1.14.2 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,    | 32.3s    | 33.1s              |
| Memory=3700MB, Disk=20000MB)   |          |                    |
| ...                            |          |                    |
| * Preparing Kubernetes v1.19.2 | 22.0s    | 20.6s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.4s     | 1.4s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 0.1s               |
|   - Want kubectl v1.19.2? 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: 28.6s 28.3s 28.3s
Average time for minikube: 28.4s

Times for Minikube (PR 9689): 27.2s 27.3s 27.5s
Average time for Minikube (PR 9689): 27.3s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9689) |
+--------------------------------+----------+--------------------+
| * minikube v1.14.2 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.9s     | 8.7s               |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.19.2 | 18.1s    | 17.1s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.0s     | 1.1s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 0.0s               |
|   - Want kubectl v1.19.2? Try  |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| cluster and "default"          |          |                    |
| namespace by default           |          |                    |
+--------------------------------+----------+--------------------+

@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 59.7s 59.4s 55.6s
Average time for minikube: 58.2s

Times for Minikube (PR 9689): 23.3s 56.5s 54.2s
Average time for Minikube (PR 9689): 44.7s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9689) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.0 on Debian   | 0.0s     |                    |
|                           9.11 |          |                    |
| * Using the kvm2 driver based  | 0.0s     | 0.0s               |
| on user configuration          |          |                    |
| * Downloading driver           | 1.8s     |                    |
| docker-machine-driver-kvm2:    |          |                    |
| * Starting control plane node  | 0.0s     | 0.0s               |
| minikube in cluster minikube   |          |                    |
| * Creating kvm2 VM (CPUs=2,    | 32.9s    | 21.0s              |
| Memory=3700MB, Disk=20000MB)   |          |                    |
| ...                            |          |                    |
| * Preparing Kubernetes v1.19.4 | 22.4s    |                    |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.6s     | 1.5s               |
| components...                  |          |                    |
| * Enabled addons:              | 1.4s     |                    |
| default-storageclass,          |          |                    |
| storage-provisioner            |          |                    |
|                                | 0.2s     | 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.0s 26.5s 27.9s
Average time for minikube: 27.8s

Times for Minikube (PR 9689): 26.6s 28.2s 27.3s
Average time for Minikube (PR 9689): 27.3s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9689) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.0 on Debian   | 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.7s     | 8.5s               |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.19.4 | 17.7s    |                    |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.0s     | 1.0s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| storage-provisioner,           |          |                    |
| default-storageclass           |          |                    |
|                                | 0.0s     | 17.5s              |
|   - 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           |          |                    |
+--------------------------------+----------+--------------------+

@priyawadhwa
Copy link
Author

TODO: build ISO/kicbase as a snapshot version and test with those

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 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.

approve with required testing upgrading k8s version

pkg/minikube/schedule/daemonize_windows.go Show resolved Hide resolved
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [medyagh,priyawadhwa]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@priyawadhwa
Copy link
Author

@medyagh tested with k8s version upgrade, this still works as expected

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 17, 2020
@priyawadhwa priyawadhwa mentioned this pull request Nov 17, 2020
4 tasks
@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 60.4s 56.0s 54.2s
Average time for minikube: 56.9s

Times for Minikube (PR 9689): 58.8s 57.3s 55.1s
Average time for Minikube (PR 9689): 57.1s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9689) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 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,    | 33.1s    | 32.1s              |
| Memory=3700MB, Disk=20000MB)   |          |                    |
| ...                            |          |                    |
| * Preparing Kubernetes v1.19.4 | 22.1s    | 22.0s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.5s     | 1.9s               |
| components...                  |          |                    |
| * Enabled addons:              | 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           |          |                    |
+--------------------------------+----------+--------------------+

docker Driver
Times for minikube: 28.7s 28.2s 28.3s
Average time for minikube: 28.4s

Times for Minikube (PR 9689): 29.4s 27.9s 26.7s
Average time for Minikube (PR 9689): 28.0s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9689) |
+--------------------------------+----------+--------------------+
| * minikube v1.15.1 on Debian   | 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.9s     | 8.8s               |
| (CPUs=2, Memory=3700MB) ...    |          |                    |
| * Preparing Kubernetes v1.19.4 | 17.9s    | 17.8s              |
| on Docker 19.03.13 ...         |          |                    |
| * Verifying Kubernetes         | 1.1s     | 1.0s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.1s     | 0.1s               |
| default-storageclass,          |          |                    |
| storage-provisioner            |          |                    |
|                                | 0.1s     | 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           |          |                    |
+--------------------------------+----------+--------------------+

@priyawadhwa priyawadhwa merged commit 1d37a91 into kubernetes:master Nov 18, 2020
@priyawadhwa priyawadhwa deleted the ss-windows branch November 18, 2020 01:56
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants