-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Remove viper from minikube and driver packages - part 1 #21683
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
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: nirs 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 |
/cc @ComradeProgrammer |
b5925b8
to
1a26ae8
Compare
/ok-to-test |
1a26ae8
to
cf26111
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.
thank you for doing this ! this is gonna make minikube development much safer (and less suprises)
/ok-to-test |
This comment has been minimized.
This comment has been minimized.
This comment was marked as outdated.
This comment was marked as outdated.
This comment has been minimized.
This comment has been minimized.
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.
we should make to document this in the contributors guide
to never make a viper call outside CMD packages
9daa62a
to
ec1ad26
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ec1ad26
to
0c44d92
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0c44d92
to
64e83d5
Compare
d40b4ed
to
33695fc
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This change introduce the basic infrastructure for passing command line options from the cmd/minikube/cmd package to other packages. The cmd/flags package provides the Options() function returning run.Options initialized using viper. This package keeps the constants for command line options (e.g. "interactive") that we want to share with various packages without accessing global state via viper. To use options in drivers code, include the options in the CommonDriver struct. The options will be initialized from the command line options when creating a driver. The basic idea is to create options in the command: options := flags.Options() And pass it to other packages, where code will use: if options.NonInteractive { Instead of: if viper.GetBool("interactive") { This is type safe and allows reliable parallel testing.
Some drivers need command line options since they need to pass command line options back to minikube firewall package. The way to pass command line options to the driver is via the NewDriver function, called by the registry Loader function. The registry Loader function is called by machine.LocalClient.Load, which is part of the limachine API interface, which is not part of minikube so we cannot change it. We pass the options to machine.NewAPIClient(), so the client can pass the options to Load(). Some drivers need to validate vment helper in the registry StatusChecker function, considering the --interactive and --download-only flags. So we pas the options to the StatusChecker function. This change create the options in most commands that call machine.NewAPIClient or registry StatusChecker function and pass the options down.
vment.ValidateHelper() accept now *run.Options and use options.NonInteractive to check if interaction is allowed. Update callers to pass options from the minikube command. Testing non-interactive mode: % sudo rm /etc/sudoers.d/vmnet-helper % sudo -k % out/minikube start -d krunkit --interactive=false 😄 minikube v1.37.0 on Darwin 26.0.1 (arm64) ✨ Using the krunkit (experimental) driver based on user configuration 🤷 Exiting due to PROVIDER_KRUNKIT_NOT_FOUND: The 'krunkit' provider was not found: exit status 1: sudo: a password is required 💡 Suggestion: Install and configure vment-helper 📘 Documentation: https://minikube.sigs.k8s.io/docs/reference/drivers/krunkit/ Testing interactive mode: % out/minikube start -d krunkit 😄 minikube v1.37.0 on Darwin 26.0.1 (arm64) 💡 Unable to run vmnet-helper without a password To configure vment-helper to run without a password, please check the documentation: https://github.com/nirs/vmnet-helper/#granting-permission-to-run-vmnet-helper Password: ✨ Using the krunkit (experimental) driver based on user configuration 👍 Starting "minikube" primary control-plane node in "minikube" cluster 🔥 Creating krunkit VM (CPUs=2, Memory=6144MB, Disk=20000MB) ... 🐳 Preparing Kubernetes v1.34.1 on Docker 28.4.0 ... 🔗 Configuring bridge CNI (Container Networking Interface) ... 🔎 Verifying Kubernetes components... ▪ Using image gcr.io/k8s-minikube/storage-provisioner:v5 🌟 Enabled addons: default-storageclass, storage-provisioner 🏄 Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
filewall.UnblockBootpd() accepts now *run.Options and use it to check if we can interact with the user. Update callers to pass options.
The notify helpers accept now *run.Options and use it to check if we can interact with the user. Modify callers to pass options using cmd/flags.Options().
Add run.Options.DownloadOnly option and replace viper.GetBool("download-only") calls in from minikube packages.
33695fc
to
1b58c48
Compare
@nirs: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. I understand the commands that are listed here. |
kvm2 driver with docker runtime
Times for minikube start: 41.7s 42.1s 45.9s 43.6s 44.7s Times for minikube ingress: 15.8s 16.4s 16.9s 15.8s 15.9s docker driver with docker runtime
Times for minikube start: 23.4s 22.7s 22.8s 25.4s 22.7s Times for minikube ingress: 12.7s 11.7s 13.7s 10.7s 10.7s docker driver with containerd runtime
Times for minikube ingress: 20.2s 20.1s 22.2s 21.1s 21.2s Times for minikube start: 23.2s 20.2s 20.4s 24.2s 20.1s |
Here are the number of top 10 failed tests in each environments with lowest flake rate.
Besides the following environments also have failed tests: To see the flake rates of all tests by environment, click here. |
Currently we use viper outside of cmd/minikube/cmd package in pkg/minikube/** and pkg/drivers/**. This introduce 2 issues:
This is the first part in removing viper calls outside of the cmd/minikube/cmd package.
Preparations
Removals
Part-of #21670