-
Notifications
You must be signed in to change notification settings - Fork 5k
vmnet: Improve --network vmnet-shared validation #20689
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
base: master
Are you sure you want to change the base?
Conversation
Hi @nirs. 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-sigs/prow repository. |
Can one of the admins verify this patch? |
8d56032
to
871b3a7
Compare
@medyagh please review |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: medyagh, nirs 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 |
/ok-to-test |
Previously we did not check that the helper can run with the --close-from=4 option, so the command could succeed when incorrect sudoers configuration. For example a user with liberal NOPASSWD rule, but without the closefrom_override option. When the check failed, we log unhelpful log: libmachine: Failed to run vmnet-helper: %!w(*exec.ExitError=&{0x14000135e30 [115 117 100 111 58 32 97 ... 101 100 10]}) And we returned a bool, so the caller could not tell if the helper is not installed or not configured properly. Fix by: - Rename vment.HelperAvaialble to vment.ValidateHelper - Return an error describing the issue, that can be handled with errors.Is() - Include ExitError.Stderr in the error. This includes helpful error messages from sudo. - Add new reason.NotConfiguredVmnetHelper error - Improve validation when vment.ValidateHelper() succeeded Example error flow - vment-helper not installed: % minikube start --driver vfkit --network vmnet-shared 😄 minikube v1.35.0 on Darwin 15.4.1 (arm64) ✨ Using the vfkit (experimental) driver based on user configuration E0502 00:57:51.009031 19098 start_flags.go:524] Failed to validate "vmnet-shared" network: stat /opt/vmnet-helper/bin/vmnet-helper: no such file or directory 🙈 Exiting due to NOT_FOUND_VMNET_HELPER: 💡 Suggestion: vmnet-helper was not found on the system, resolve by: Option 1) Installing vment-helper: https://github.com/nirs/vmnet-helper#installation Option 2) Using the nat network: minikube start<no value> --driver vfkit --network nat If resolved the issue by installing vmnet-helper but I did not configured the sudoers rule: % minikube start --driver vfkit --network vmnet-shared 😄 minikube v1.35.0 on Darwin 15.4.1 (arm64) ✨ Using the vfkit (experimental) driver based on user configuration E0502 00:59:03.501549 19127 start_flags.go:524] Failed to validate "vmnet-shared" network: failed to run vmnet-helper via sudo: exit status 1: sudo: you are not permitted to use the -C option 🙈 Exiting due to NOT_CONFIGURED_VMNET_HELPER: 💡 Suggestion: vmnet-helper is not configured correctly. Please install a vmnnet-helper sudoers rule using these instructions: https://github.com/nirs/vmnet-helper#granting-permission-to-run-vmnet-helper After installing the sudoers rule, minikube could start with --network vmnet-shared. In the log we can see: % minikube logs | grep vmnet-helper I0502 01:29:55.500206 22131 main.go:141] libmachine: Validated vmnet-helper version "v0.5.0" I0502 01:29:56.218530 22131 main.go:141] libmachine: Started vmnet-helper (pid=22138)
871b3a7
to
e11541b
Compare
kvm2 driver with docker runtime
Times for minikube start: 52.9s 51.1s 56.7s 50.6s 53.3s Times for minikube ingress: 19.5s 16.0s 19.0s 18.5s 15.1s docker driver with docker runtime
Times for minikube (PR 20689) start: 23.4s 23.5s 22.7s 23.3s 23.4s Times for minikube ingress: 12.3s 13.8s 13.3s 12.2s 12.8s docker driver with containerd runtime
Times for minikube start: 25.2s 23.9s 21.6s 21.3s 20.4s Times for minikube ingress: 23.2s 39.3s 39.2s 22.7s 39.8s |
Previously we did not check that the helper can run with the --close-from=4 option, so the command could succeed when incorrect sudoers configuration. For example a user with liberal NOPASSWD rule, but without the closefrom_override option.
When the check failed, we log unhelpful log:
And we returned a bool, so the caller could not tell if the helper is not installed or not configured properly.
Fix by:
Example error flow - vment-helper not installed:
If resolved the issue by installing vmnet-helper but I did not configured the sudoers rule:
After installing the sudoers rule, minikube could start with --network
vmnet-shared. In the log we can see: