Skip to content

Commit

Permalink
Use vfkit driver on darwin
Browse files Browse the repository at this point in the history
The new experimental vfkit driver[1] uses vfkit to start virtual
machines using Apple virtualisation framework when running on Apple
silicon.

This driver is not available in minikube release yet. To use it you need
to install vfkit and build minikube from the PR.

Example run:

    % drenv start envs/example.yaml
    2024-08-16 23:31:18,271 INFO    [example] Starting environment
    2024-08-16 23:31:18,315 INFO    [ex2] Starting minikube cluster
    2024-08-16 23:31:18,320 INFO    [ex1] Starting minikube cluster
    2024-08-16 23:31:42,219 INFO    [ex2] Cluster started in 23.90 seconds
    2024-08-16 23:31:42,219 INFO    [ex2/0] Running addons/example/start
    2024-08-16 23:31:49,781 INFO    [ex2/0] addons/example/start completed in 7.56 seconds
    2024-08-16 23:31:49,781 INFO    [ex2/0] Running addons/example/test
    2024-08-16 23:31:49,917 INFO    [ex2/0] addons/example/test completed in 0.14 seconds
    2024-08-16 23:31:50,937 INFO    [ex1] Cluster started in 32.62 seconds
    2024-08-16 23:31:50,937 INFO    [ex1/0] Running addons/example/start
    2024-08-16 23:31:58,453 INFO    [ex1/0] addons/example/start completed in 7.52 seconds
    2024-08-16 23:31:58,453 INFO    [ex1/0] Running addons/example/test
    2024-08-16 23:31:58,582 INFO    [ex1/0] addons/example/test completed in 0.13 seconds
    2024-08-16 23:31:58,583 INFO    [example] Environment started in 40.31 seconds

    % minikube profile list
    |---------|-----------|------------|----------------|------|---------|---------|-------|----------------|--------------------|
    | Profile | VM Driver |  Runtime   |       IP       | Port | Version | Status  | Nodes | Active Profile | Active Kubecontext |
    |---------|-----------|------------|----------------|------|---------|---------|-------|----------------|--------------------|
    | ex1     | vfkit     | containerd | 192.168.106.24 | 8443 | v1.31.0 | Running |     1 |                | *                  |
    | ex2     | vfkit     | containerd | 192.168.106.23 | 8443 | v1.31.0 | Running |     1 |                |                    |
    |---------|-----------|------------|----------------|------|---------|---------|-------|----------------|--------------------|

Issues:

- When terminating the process group, the vfkit process is terminated,
  and the vm is stopped. This should be fixed in minikube or vfkit by
  running the vfkit process in background or as a daemon.
  Fixed in my minikube fork: https://github.com/nirs/minikube/tree/vfkit-pg

- rook does not work on arm now, likely due to
  rook/rook#14502

- We don't have arm64 images for OCM. Can be solved by enabling Rosetta
  2. This supported in vfkit but not implemented yet in the vfkit driver.

- Nested virtualization requires M3 CPU, and is not implemented yet in
  vfkit, so testing kubevirt VMs is not possible on Apple silicon.

[1] kubernetes/minikube#19423
[2] https://github.com/crc-org/vfkit

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
  • Loading branch information
nirs committed Aug 16, 2024
1 parent 812721c commit 10c5a36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions test/drenv/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def main():
sys.exit(1)
finally:
shutdown_executors()
# XXX Does not work for vfkit driver
terminate_process_group()


Expand Down
4 changes: 2 additions & 2 deletions test/drenv/envfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
SHARED_NETWORK: {"x86_64": "default"},
},
"darwin": {
VM: {"x86_64": "hyperkit"},
VM: {"x86_64": "hyperkit", "arm64": "vfkit"},
CONTAINER: "podman",
SHARED_NETWORK: {"x86_64": ""},
SHARED_NETWORK: {"x86_64": "", "arm64": ""},
},
}

Expand Down

0 comments on commit 10c5a36

Please sign in to comment.