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

Disable base image flag for vm drivers #9300

Merged

Conversation

ilya-zuyev
Copy link
Contributor

Disallow --base-image flag when a KIC driver is used

This PR fixes #8891.

If --base-image flag is passed for the start command and the active driver, passed through command line args or minikube config file is KIC, i.e. 'docker' or 'podman' an error message is displayed and minikube exits

izuyev@izuyev-macbookpro --- z/minikube ‹gh8891_forbid_base_image_for_vm_drivers› » minikube start --base-image=local/kicbase:v0.0.10-snapshot --driver hyperkit                                                                                          1 ↵
* minikube v1.13.1 on Darwin 10.15.6
* Using the hyperkit driver based on user configuration

X Exiting due to MK_USAGE: flag --base-image is not available for driver 'hyperkit'. Did you mean to use 'docker' or 'podman' driver instead?
Please use --iso-url flag to configure VM based drivers

@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 Sep 22, 2020
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please sign in with your organization's credentials at https://identity.linuxfoundation.org/projects/cncf to be authorized.
  • If you have done the above and are still having issues with the CLA being reported as unsigned, please log a ticket with the Linux Foundation Helpdesk: https://support.linuxfoundation.org/
  • Should you encounter any issues with the Linux Foundation Helpdesk, send a message to the backup e-mail support address at: [email protected]

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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Sep 22, 2020
@k8s-ci-robot
Copy link
Contributor

Welcome @ilya-zuyev!

It looks like this is your first PR to kubernetes/minikube 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/minikube has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 22, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @ilya-zuyev. 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 22, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ilya-zuyev
To complete the pull request process, please assign afbjorklund
You can assign the PR to them by writing /assign @afbjorklund in a comment when ready.

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

@minikube-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@ilya-zuyev ilya-zuyev marked this pull request as ready for review September 22, 2020 17:18
@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 Sep 22, 2020
@ilya-zuyev ilya-zuyev changed the title 8891 forbid base image for vm drivers Disable base image flag for vm drivers Sep 22, 2020
@medyagh
Copy link
Member

medyagh commented Sep 22, 2020

thank you @ilya-zuyev for this PR, please make sure to sign CNCF here https://identity.linuxfoundation.org/projects/cncf

@ilya-zuyev
Copy link
Contributor Author

I signed it

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Sep 22, 2020
@ilya-zuyev
Copy link
Contributor Author

^ following instructions from https://identity.linuxfoundation.org/projects/cncf to activate CNCF CLA

@ilya-zuyev
Copy link
Contributor Author

thank you @ilya-zuyev for this PR, please make sure to sign CNCF here https://identity.linuxfoundation.org/projects/cncf

@medyagh Done! Thanks for the link

@medyagh
Copy link
Member

medyagh commented Sep 22, 2020

/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 Sep 22, 2020
@minikube-pr-bot
Copy link

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

cmd/minikube/cmd/start.go Outdated Show resolved Hide resolved
}
func validBaseImageFlag(baseImageFlagSet bool, driver string) bool {
if baseImageFlagSet {
return registry.IsKIC(driver)
Copy link
Member

Choose a reason for hiding this comment

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

to make sure we cover Baremetal (none driver)
it is better we check using IsVM here https://github.com/medyagh/minikube/blob/107eb57a110a4a650fc125401719b51e6eccf111/pkg/minikube/driver/driver.go#L105

driver.IsVM(drver)

@@ -1185,6 +1191,31 @@ func validateKubernetesVersion(old *config.ClusterConfig) {
}
}

// validateBaseImage checks that --base-image is not passed if the drive being in use is KIC (docker/podman)
// if so, the function exits the process
func validateBaseImage(imageFlag *pflag.Flag, driver string) {
Copy link
Member

Choose a reason for hiding this comment

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

to avoid confusion with driver package consider using a shorter variable name for driver, such as drv

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch! fixed.

@medyagh
Copy link
Member

medyagh commented Sep 22, 2020

thanks for the unit tests :)

@codecov-commenter
Copy link

Codecov Report

Merging #9300 into master will decrease coverage by 0.04%.
The diff coverage is 7.14%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9300      +/-   ##
==========================================
- Coverage   29.51%   29.47%   -0.05%     
==========================================
  Files         170      170              
  Lines       10307    10325      +18     
==========================================
+ Hits         3042     3043       +1     
- Misses       6842     6859      +17     
  Partials      423      423              
Impacted Files Coverage Δ
cmd/minikube/cmd/start.go 9.65% <7.14%> (-0.06%) ⬇️
cmd/minikube/cmd/update-context.go 0.00% <0.00%> (ø)

@minikube-pr-bot
Copy link

kvm2 Driver
Times for minikube: 62.5s 64.4s 62.0s
Average time for minikube: 63.0s

Times for Minikube (PR 9300): 64.1s 67.4s 61.8s
Average time for Minikube (PR 9300): 64.4s

Averages Time Per Log

+--------------------------------+----------+--------------------+
|              LOG               | MINIKUBE | MINIKUBE (PR 9300) |
+--------------------------------+----------+--------------------+
| * minikube v1.13.1 on Debian   | 0.1s     | 0.1s               |
|                           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,    | 36.3s    | 37.1s              |
| Memory=3700MB, Disk=20000MB)   |          |                    |
| ...                            |          |                    |
| * Preparing Kubernetes v1.19.2 | 24.1s    | 24.8s              |
| on Docker 19.03.12 ...         |          |                    |
| * Verifying Kubernetes         | 1.7s     | 1.7s               |
| components...                  |          |                    |
| * Enabled addons:              | 0.8s     | 0.7s               |
| default-storageclass,          |          |                    |
| storage-provisioner            |          |                    |
|                                | 0.0s     | 0.0s               |
| * Want kubectl v1.19.2? Try    |          |                    |
| 'minikube kubectl -- get pods  |          |                    |
| -A'                            |          |                    |
| * Done! kubectl is now         |          |                    |
| configured to use "minikube"   |          |                    |
| by default                     |          |                    |
+--------------------------------+----------+--------------------+

docker Driver
Times for minikube: 31.6s 30.1s 30.2s
Average time for minikube: 30.7s

Times for Minikube (PR 9300): 31.7s 30.5s 28.9s
Average time for Minikube (PR 9300): 30.4s

Averages Time Per Log

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

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.

looks good to me, thank you for the PR and the unit test !

@medyagh medyagh merged commit 07642cd into kubernetes:master Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

don't allow --base-image flag to be set for VM drivers
6 participants