We had similar code to check if image exists or not. Add
checkImageNotExists() helper and refactor listImages() helper to make it
easier to use.
listImages() fails the test so the caller do no not need to check for
errors. It returns list of images so the caller does not have to parse
the output.
When parsing the output of `minikube image ls` use scanner to split the
output to lines. Previously we search images in rr.Output() (formatted
message with contents of stdout and stderr) instead of
rr.Stdout.String(), which could lead to returning a wrong result.
We can pull unqualified image to docker:
kicbase/echo-server:latest
but the image is created with the fully qualified name:
docker.io/kicbase/echo-server:latest
Tagging works with the unqualified name, but when we load images to
minikube the we get the fully qualified name. Mixing unqualified and
qualified is confusing and make searching harder if we want to exact
matching.
The echoserver-arm:1.8 image is not an arm64 image:
% kubectl create deployment echoserver --image registry.k8s.io/echoserver-arm:1.8
deployment.apps/echoserver created
% kubectl logs deploy/echoserver
exec /usr/sbin/nginx: exec format error
% minikube ssh -- sudo nerdctl -n k8s.io image ls registry.k8s.io/echoserver-arm:1.8
REPOSITORY TAG IMAGE ID CREATED PLATFORM SIZE BLOB SIZE
registry.k8s.io/echoserver-arm 1.8 b33d4cdf6ed0 About a minute ago linux/amd64 90.1 MiB 43.2 MiB
Replace with kickbase/echo-server we used in other tests.
With this change ServerCmdConnect pass. The other test using the broken
arm image was not failing, maybe it was not checking the deployment
status properly.
Functional tests time reduced from 230 seconds to 200 seconds:
--- FAIL: TestFunctional (200.87s)
Replace 9p mounts with virtiofs for vfkit and krunkit. Testing shows
that virtiofs mount is 23 times faster with krunkit, and 8 times faster
with vfkit.
vfkit and krunkit support multiple virtiofs mounts but minikube
--mount-* flags are not ready for multiple mounts. We have the same
issue with KIC drivers, supporting multiple mounts but using only one.
We hope to improve this in the next release.
Example usage:
minikube start --mount-string ~/models:/mnt/models
The arguments are parsed and validated when configuring the driver, so
invalid arguments fail quickly without starting the driver. The
validated mounts are stored in the machine config:
$ jq '.Driver.VirtiofsMounts' < ~/.minikube/machines/minikube/config.json
[
{
"HostPath": "/Users/joe/models",
"GuestPath": "/mnt/models",
"Tag": "f845b54d-00e3-493d-9541-3b37490b96db"
}
]
Minikube generates a new random UUID for every virtiofs mount to
identify the file system inside the guest. In krunkit and vfkit, every
mount is add as:
--device virtio-fs,sharedDir=/host-path,mountTag=f845b54d-00e3-493d-9541-3b37490b96db
When the guest is started the shared directory is mounted via SSH using:
sudo mkdir -p /mnt/models
sudo mount -t virtiofs f845b54d-00e3-493d-9541-3b37490b96db /mnt/models
Example mount:
$ minikube ssh findmnt /mnt/models
TARGET SOURCE FSTYPE OPTIONS
/mnt/models f845b54d-00e3-493d-9541-3b37490b96db virtiofs rw,relatime
More work is needed to add VirtioFS to qemu. I'm starting with vfkit and
krunkit since they have identical interface (krunkit was designed as
drop-in replacement for vfkit).
* 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.