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
- func MountsEqual(a, b []config.MountConfig) bool
- func MountsRewriteScript(vmName string, mounts []config.MountConfig) string
- func ResolveMounts(m []config.MountConfig) []config.MountConfig
- type Manager
- func (m *Manager) Destroy(ctx context.Context) error
- func (m *Manager) GenerateConfig(socketPath string, dockerEnabled bool, mounts []config.MountConfig) string
- func (m *Manager) GetBridgedIP(ctx context.Context) (string, error)
- func (m *Manager) Provision(ctx context.Context, dockerEnabled bool, mounts []config.MountConfig) error
- func (m *Manager) Status(ctx context.Context) (VMStatus, error)
- type Spec
- type VMStatus
Constants ¶
const DefaultMountType = "virtiofs"
DefaultMountType is the Lima file-sharing backend used for vmType "vz".
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) GenerateConfig ¶
func (m *Manager) GenerateConfig(socketPath string, dockerEnabled bool, 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 ¶
GetBridgedIP returns the bridged LAN IP address of the VM.