* test: Add findmnt package
When testing mounts we can use findmnt --json output to parse the output
cleanly. The package provides only ParseOutput() now, but it can be
extended later to run the findmnt command.
* test: Support virtiofs mounts
Use findmnt command to get the mounted filesystem details cleanly.
We use the actual mount fstype instead of driver name check so we can
switch drivers to virtiofs without changing the test.
For virtiofs mount we skip options validation since we don't support
setting virtiofs options yet, and the options are not the same as 9p
options.
For 9p mounts the uid= and gid= flags were fixed to match the real flags
(dfltuid=,dfltgid=). The issue was hidden by imprecise string matching.
The --mount-string argument defaults to `/Users` on darwin, and
homedir.Homedir() on other platforms (e.g. $HOME on unix).
This is wrong in many ways:
- `/Users` is not HOME on darwin (the right path is `/Users/$USER`).
Using the default mount we cannot access anything inside the guest in
the user home directory. We can access the special `/Users/Shared`
directory, but this should not be a default mount.
- Mounting the user home directory inside the guest in read-write mode
is a horrible default. This exposes the users private keys in .ssh/ to
the guest, any sensitive files in the user home directory, and allows
the guest to change any file on the host.
- Using the `--mount` option mount the default mount directory silently.
This is unexpected, surprising, and not documented in the minikube
handbook[1].
Example access to user private key from the guest with the default
mount:
$ minikube start --mount
$ minikube ssh cat /minikube-host/.ssh/id_ed25519
-----BEGIN OPENSSH PRIVATE KEY-----
...
-----END OPENSSH PRIVATE KEY-----
Fixed by removing the default mount directory and changing mount logic
to check for non-empty mount-string instead of the mount flag.
The mount flag is kept for backward compatibility, but its value is
ignored. In the next release we want to use this flag for supporting
multiple mounts.
Example usage before:
minikube start --mount --mount-string ~/models:/mnt/models
Example usage after:
minikube start --mount-string ~/models:/mnt/models
Breaking changes:
User depending the default mount will have to replace the command:
minikube start --mount
With:
minikube start --mount-string $HOME:/minikube-host
[1] https://minikube.sigs.k8s.io/docs/handbook/mount/
Move all files and packages which are not a driver to the drivers/common
package. This helps to understand the structure of the code.
While moving, move the iso_test.iso into testdata/test.iso to separate
code and test data.
While fixing the test iso path fix few bugs in the tests using wrong iso
path. The test failed because the iso path was wrong instead of issue
with source or destination path.
New directory structure:
% tree -L1 pkg/drivers
pkg/drivers
├── common
├── hyperkit
├── kic
├── krunkit
├── kvm
├── none
├── qemu
├── ssh
└── vfkit
getWindowsVolumeNameCmd uses the deprecated wmic.exe.
See https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmic for
details.
Replace the implementation with a call to the Powershell equivalent.
Look in path and system environment vars to locate Powershell.
Improve Powershell discovery
* remove omitnew line
* add new option to hide after spin
* refactor to use new return hideAfterSpin
* add new line by default only when not spinining and delegate spinner newline to spinner code
* add new func for ouptputing with spinner and pass fdwriter directly to the spininer func
* fix unit test
* fix lint for krunkit
* add comment and context
* use different spinning progress bar for sub steps
* make func private
* making more spinning icons
* integration test dont expect sub steps to be visible
* fix unit test and comment why
* change sub step spining icon not to be a progressbar
* pass the filewriter to the spinner library for the spinning steps
* copy licenses to gh assests as well
* download licneses from github
* try head first to make code more simple
* remove debug
* fix extra dash
* create license directory if doesnt exist
* Apply suggestion from prezha
* Apply suggestion from prezha
* Apply suggestion from prezha
* Apply suggestion from prezha
* iso: Enable VirtioFS for x86_64 and aarch64
The Virtio Filesystem[1] allows guests to mount file systems from the
host.
Testing with krunkit show 10 times faster read throughput:
minikube krunkit - 9p:
$ time cp /mnt/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model
real 0m34.330s
user 0m0.019s
sys 0m1.959s
podman krunkit - virtiofs:
$ time cp /Users/nir/Downloads/models/mistral-7b-instruct-v0.2.Q4_K_M.gguf model
real 0m3.245s
user 0m0.006s
sys 0m1.035s
We must have virtiofs for playing with AI workload in krunkit. It can be
nice improvment for vfkti and qemu, and should be available in ohter
hypervisors.
[1] https://virtio-fs.gitlab.io/index.html
* Updating ISO to v1.36.0-1753487480-21147
---------
Co-authored-by: minikube-bot <minikube-bot@google.com>
I don't know why the linter did not complain in the CI, but running
locally revealed few issues:
% golangci-lint run ./pkg/drivers/krunkit
pkg/drivers/krunkit/krunkit.go:537:34: importShadow: shadow of
imported from 'github.com/docker/machine/libmachine/state' package
'state' (gocritic)
func (d *Driver) setKrunkitState(state string) error {
^
pkg/drivers/krunkit/krunkit.go:341:9: unnecessary-format:
unnecessary use of formatting function "fmt.Errorf", you can replace
it with "errors.New" (revive)
return fmt.Errorf("hosts without a driver cannot start docker")
^
pkg/drivers/krunkit/krunkit.go:345:9: unnecessary-format:
unnecessary use of formatting function "fmt.Errorf", you can replace
it with "errors.New" (revive)
return fmt.Errorf("hosts without a driver cannot stop docker")
^
pkg/drivers/krunkit/krunkit.go:444:18: func (*Driver).logfilePath is
unused (unused)
func (d *Driver) logfilePath() string {
^