driverlima

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: MIT Imports: 15 Imported by: 0

README

driver-lima

Kutti driver for Lima

Go Report Card PkgGoDev GitHub release (latest by date)

Images

This driver depends on qcow2 images published via the kuttiproject/driver-lima-images repository. The details of the driver-to-VM interface are documented there.

The releases of that repository are the default source for this driver. The list of available/deprecated images and the images themselves are published there. The releases of that repository follow the major and minor versions of this repository, but sometimes may lag by one version. The ImagesVersion constant specifies the version of the images repository that is used by a particular version of this driver.

Apple Silicon Mac Only

This driver only works on macOS running on Apple silicon.

Documentation

Overview

Package driverlima implements a kutti driver for lima. It uses the limactl CLI to talk to lima.

For cluster networking, it uses the lima user-v2 network.

For nodes, it creates virtual machines from pre-built "cloud" images, maintained by the companion driver-lima-images project. These images are directly passed to lima for caching/VM disk creation.

Thus, the driver itself only downloads the list of available images from the URL pointed to by the ImagesSourceURL variable.

Index

Constants

View Source
const ImagesVersion = "0.1"

ImagesVersion defines the image repository version for the current version of the driver.

Variables

View Source
var ImagesSourceURL = "https://github.com/kuttiproject/driver-lima-images/releases/download/v" + ImagesVersion + "/" + imagesConfigFile

ImagesSourceURL is the location where the master list of images can be found

Functions

This section is empty.

Types

type Driver

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

Driver implements the drivercore.Driver interface for Lima.

func (*Driver) DeleteMachine

func (vd *Driver) DeleteMachine(machinename string, clustername string) error

DeleteMachine deletes a Machine in a cluster.

func (*Driver) DeleteNetwork

func (vd *Driver) DeleteNetwork(clustername string) error

DeleteNetwork deletes the Network for a cluster.

func (*Driver) Description

func (vd *Driver) Description() string

Description returns "Kutti driver for Lima"

func (*Driver) Error

func (vd *Driver) Error() string

Error returns the last error reported by the Driver.

func (*Driver) GetImage

func (vd *Driver) GetImage(k8sversion string) (drivercore.Image, error)

GetImage returns an image corresponding to a Kubernetes version, or an error.

func (*Driver) GetMachine

func (vd *Driver) GetMachine(machinename string, clustername string) (drivercore.Machine, error)

GetMachine returns a Machine in a cluster.

func (*Driver) K8sVersions

func (vd *Driver) K8sVersions() []string

K8sVersions returns all Kubernetes versions currently supported by kutti.

func (*Driver) ListImages

func (vd *Driver) ListImages() ([]drivercore.Image, error)

ListImages lists the currently available Images.

func (*Driver) Name

func (vd *Driver) Name() string

Name returns "lima"

func (*Driver) NewMachine

func (vd *Driver) NewMachine(machinename string, clustername string, k8sversion string) (drivercore.Machine, error)

NewMachine creates a new Machine in a cluster, usually using an Image for the supplied Kubernetes version.

func (*Driver) NewNetwork

func (vd *Driver) NewNetwork(clustername string) (drivercore.Network, error)

NewNetwork creates a new Network for a cluster.

func (*Driver) QualifiedMachineName

func (vd *Driver) QualifiedMachineName(machinename string, clustername string) string

QualifiedMachineName returns a unique name for a Machine in a cluster. This name is usually used internally by a Driver.

func (*Driver) QualifiedNetworkName

func (vd *Driver) QualifiedNetworkName(clustername string) string

QualifiedNetworkName returns a unique Network name for a cluster.

func (*Driver) Status

func (vd *Driver) Status() string

Status returns the current status of the Driver.

func (*Driver) UpdateImageList

func (vd *Driver) UpdateImageList() error

UpdateImageList fetches the latest list of Images from a driver-defined source, and stores it locally.

func (*Driver) UsesNATNetworking

func (vd *Driver) UsesNATNetworking() bool

UsesNATNetworking returns true. This driver uses port forwarding, though not user-defined.

func (*Driver) UsesPerClusterNetworking

func (vd *Driver) UsesPerClusterNetworking() bool

UsesPerClusterNetworking returns false. This driver uses the Lima "user-v2" network for all clusters.

func (*Driver) ValidK8sVersion

func (vd *Driver) ValidK8sVersion(k8sversion string) bool

ValidK8sVersion returns true if the specified Kubernetes version is available.

type Image

type Image struct {
	ImageK8sVersion string
	// imageChecksum   string
	ImageSourceURL  string
	ImageStatus     drivercore.ImageStatus
	ImageDeprecated bool
}

func (*Image) Deprecated

func (i *Image) Deprecated() bool

Deprecated returns true if the image is no longer supported.

func (*Image) Fetch

func (i *Image) Fetch() error

Fetch downloads the image from the driver repository into the local cache. The lima driver does not download or cache the image; lima itself does that. So, Fetch silently continues if called.

func (*Image) FetchWithProgress

func (i *Image) FetchWithProgress(progress func(current int64, total int64)) error

FetchWithProgress downloads the image from the driver repository into the local cache, and reports progress via the supplied callback. The callback reports current and total in bytes. The lima driver does not download or cache the image; lima itself does that. So, FetchWithProgress silently continues if called.

func (*Image) FromFile

func (i *Image) FromFile(filepath string) error

FromFile imports the image from the local filesystem into the local cache. The lima driver does not download or cache the image; lima itself does that. So, FromFile silently continues if called.

func (*Image) K8sVersion

func (i *Image) K8sVersion() string

K8sVersion returns the version of Kubernetes components in the image.

func (*Image) PurgeLocal

func (i *Image) PurgeLocal() error

PurgeLocal removes the image from the local cache. The lima driver does not download or cache the image; lima itself does that. So, PurgeLocal silently continues if called.

func (*Image) Status

func (i *Image) Status() drivercore.ImageStatus

Status can be Notdownloaded, Downloaded or Unknown.

type Machine

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

func (*Machine) Error

func (m *Machine) Error() string

Error returns the last error caused when manipulating this machine. A valid value can be expected only when Status() returns drivercore.MachineStatusError.

func (*Machine) ExecuteCommand

func (m *Machine) ExecuteCommand(command drivercore.PredefinedCommand, params ...string) error

ExecuteCommand executes the specified predefined operation.

func (*Machine) ForceStop

func (m *Machine) ForceStop() error

ForceStop stops a Machine forcibly. This operation should set the status to drivercore.MachineStatusStopped.

func (*Machine) ForwardPort

func (m *Machine) ForwardPort(hostport int, machineport int) error

ForwardPort creates a rule to forward the specified Machine port to the specified physical host port.

func (*Machine) ForwardSSHPort

func (m *Machine) ForwardSSHPort(hostport int) error

ForwardSSHPort forwards the SSH port of this Machine to the specified physical host port.

func (*Machine) IPAddress

func (m *Machine) IPAddress() string

IPAddress returns the current IP Address of this Machine. A valid value can be expected only when Status() returns drivercore.MachineStatusRunning.

func (*Machine) ImplementsCommand

func (m *Machine) ImplementsCommand(command drivercore.PredefinedCommand) bool

ImplementsCommand returns true if the driver implements the specified predefined operation.

func (*Machine) Name

func (m *Machine) Name() string

Name is the name of the machine. The operating system hostname should match this.

func (*Machine) SSHAddress

func (m *Machine) SSHAddress() string

SSHAddress returns the host address and port number to SSH into this Machine. For drivers that use NAT netwoking, the host address will be 'localhost'.

func (*Machine) Start

func (m *Machine) Start() error

Start starts a Machine. Note that a Machine may not be ready for further operations at the end of this, and therefore its status may not change immediately. See WaitForStateChange().

func (*Machine) Status

func (m *Machine) Status() drivercore.MachineStatus

Status can be drivercore.MachineStatusRunning, drivercore.MachineStatusStopped drivercore.MachineStatusUnknown or drivercore.MachineStatusError.

func (*Machine) Stop

func (m *Machine) Stop() error

Stop stops a Machine. Note that a Machine may not be ready for further operations at the end of this, and therefore its status will not change immediately. See WaitForStateChange().

func (*Machine) UnforwardPort

func (m *Machine) UnforwardPort(machineport int) error

UnforwardPort removes the rule which forwarded the specified Machine port.

func (*Machine) WaitForStateChange

func (m *Machine) WaitForStateChange(timeoutinseconds int)

WaitForStateChange waits the specified number of seconds, or until the Machine status changes. WaitForStateChange should be called after calls to Start() or Stop(), before any other operation. It should not be called _before_ Stop(). The lima driver silently ignores WaitForStateChanged.

Jump to

Keyboard shortcuts

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