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 {
^
* krunkit: Add krunkit driver
krunkit is a tool to launch configurable virtual machines using the
libkrun platform, optimized for GPU accelerated virtual machines and AI
workloads on Apple silicon.
It is mostly compatible with vfkit; the driver is a simplified copy of
the vfkit driver. Unlike vfkit, krunkit is available only on Apple
silicon.
Changes compared to vfkit driver:
- krunkit requires unix socket for networking, so we must use
vment-helper.
- krunkit does not support HardStop, so we kill it using SIGKILL.
- We must enable vmnet offloading, required for krunkit.
- The code was simplified since vmnet-helper is always used
- Code was cleaned up to use .ResolveStorePath()
- Unused Upgrade() function was removed
- Types and functions that should not be public made private
We require krunkit 0.2.2, supporting --restul-uri=unix://.
* reason: Make vment-helper error driver agnostic
Previously it was used only for vfkit, so we suggested to fallback to
the `nat` network. This advice is not relevant to krunkit or to qemu
(which can also use vmnet-helper).
Change the error to recommend installing vment-helper. We need to think
how we can recommend other networks for vfkit and qemu. Another solution
is to create error for every driver+network combination but this seems
hard to manage.
* hack: Add krunkit integration test
This is the same way that we test vfkit. This test is not running in the
CI.
Issues:
- Need to install and configure vment-helper (requires root).
* site: Add krunkit driver documentation