lima

package
v0.68.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package lima handles generating Lima configuration files and managing VM lifecycle (create, start, stop, delete, status) on remote hosts.

Mount handling for the lima package: resolving the configured mount set, rendering it into lima.yaml, parsing it back, and producing a script to reconcile it on an existing VM.

Index

Constants

View Source
const (
	DefaultDockerVersion     = "29.5.2"
	DefaultContainerdVersion = "2.2.4"
)

DefaultDockerVersion and DefaultContainerdVersion pin the node container runtime when cluster.yaml (which is local, not in git) does not override them via docker.dockerVersion / docker.containerdVersion. They MUST be a mutually-compatible apt pair — docker-ce depends on a matching containerd.io — so bump them together. Pinning + holding them is what stops a node restart or unattended upgrade from pairing a v2.3 containerd with a v2.2 shim, which produces the "unsupported protocol" pod-sandbox failures. See GenerateConfig.

View Source
const DefaultMountType = "virtiofs"

DefaultMountType is the Lima file-sharing backend used for vmType "vz".

View Source
const NodeKeeperLabel = "io.devx.node-vm-keeper"

NodeKeeperLabel is the launchd label for the per-host VM keeper LaunchAgent.

View Source
const NodePackages = "curl open-iscsi nfs-common socat"

NodePackages are the apt packages installed on every Lima node during provisioning. socat is required for `kubectl port-forward` (and devx bridge) to carry traffic on Docker-runtime k3s nodes — without it the forward binds locally but connections fail with "socat not found". Keeping this list in one place lets both initial provisioning (GenerateConfig) and `devx cluster reconcile` install the exact same set on existing nodes.

Variables

This section is empty.

Functions

func MountsEqual added in v0.57.0

func MountsEqual(a, b []config.MountConfig) bool

MountsEqual reports whether two mount sets are equivalent. It is order- sensitive and normalizes an empty MountPoint to Location (since Lima treats an omitted mountPoint as equal to location).

func MountsRewriteScript added in v0.57.0

func MountsRewriteScript(vmName string, mounts []config.MountConfig) string

MountsRewriteScript returns a bash script that replaces the `mountType:` line and `mounts:` block in ~/.lima/<vmName>/lima.yaml with the rendered desired set, leaving all other keys untouched. It is base64-piped to the host to avoid quoting issues (see Provision). An empty mount set strips the block entirely. The mount type is always (re)set to DefaultMountType.

func ResolveMounts added in v0.57.0

func ResolveMounts(m []config.MountConfig) []config.MountConfig

ResolveMounts returns the effective mount set for the cluster:

nil   (mounts: key omitted) -> default: one writable mount of the host home dir ("~")
[]    (mounts: [])          -> opt out: no mounts
[...] (explicit entries)    -> used as-is

"~" is intentional: Lima expands it on the target host and mounts it at the same absolute path inside the guest, which is what makes Docker bind mounts of host paths resolve inside the VM.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles Lima VM operations on a remote host.

func NewManager

func NewManager(runner *remote.Runner, node config.NodeConfig) *Manager

NewManager creates a new Lima manager for the given host and node config.

func (*Manager) Destroy

func (m *Manager) Destroy(ctx context.Context) error

Destroy stops and deletes the Lima VM.

func (*Manager) GenerateConfig

func (m *Manager) GenerateConfig(socketPath string, docker config.DockerConfig, mounts []config.MountConfig) string

GenerateConfig returns the Lima YAML config for this node. mounts is the raw cluster mount set; it is resolved via ResolveMounts (nil -> default home mount, empty -> none).

func (*Manager) GetBridgedIP

func (m *Manager) GetBridgedIP(ctx context.Context) (string, error)

GetBridgedIP returns the bridged LAN IP address of the VM.

func (*Manager) InstallNodeKeeper added in v0.64.0

func (m *Manager) InstallNodeKeeper(ctx context.Context) error

InstallNodeKeeper installs the node-vm-keeper LaunchAgent on the remote Mac host so the Lima node VM self-recovers after a host reboot or sleep. It writes the keeper script and the LaunchAgent plist into the user's home (the plist auto-loads at the next GUI login; no launchctl bootstrap over SSH is required, which would fail without an Aqua session). Best-effort and idempotent.

func (*Manager) Provision

func (m *Manager) Provision(ctx context.Context, docker config.DockerConfig, mounts []config.MountConfig) error

Provision creates and starts the Lima VM on the remote host.

func (*Manager) Status

func (m *Manager) Status(ctx context.Context) (VMStatus, error)

Status returns the current VM status on the remote host.

type Spec added in v0.57.0

type Spec struct {
	CPUs   int
	Memory string
	Disk   string
	Mounts []config.MountConfig
}

Spec is the parsed, devx-managed subset of a live lima.yaml.

func ParseSpec added in v0.57.0

func ParseSpec(limaYAML string) (Spec, error)

ParseSpec extracts the devx-managed fields from a lima.yaml document.

type VMStatus

type VMStatus string

VMStatus represents the state of a Lima VM.

const (
	VMStatusRunning    VMStatus = "Running"
	VMStatusStopped    VMStatus = "Stopped"
	VMStatusNotCreated VMStatus = "NotCreated"
	VMStatusUnknown    VMStatus = "Unknown"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL