limayaml

package
v2.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 38 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// Default9pSecurityModel is "none" for supporting symlinks
	// https://gitlab.com/qemu-project/qemu/-/issues/173
	Default9pSecurityModel   string = "none"
	Default9pProtocolVersion string = "9p2000.L"
	Default9pMsize           string = "128KiB"
	Default9pCacheForRO      string = "fscache"
	Default9pCacheForRW      string = "mmap"

	DefaultVirtiofsQueueSize int = 1024
)
View Source
const DefaultDiskFSType = "ext4"

DefaultDiskFSType is the filesystem an additional disk is formatted with when `additionalDisks[].fsType` is not set. It must match the default applied by boot.Linux/05-lima-disks.sh.

Variables

View Source
var (
	IPv4loopback1 = net.IPv4(127, 0, 0, 1)
)
View Source
var SupportedWindowsShells = []string{"cmd.exe", "powershell.exe", "pwsh.exe"}

Functions

func Convert

func Convert(x, y any, comment string) error

Convert converts from x to y, using YAML. If x is nil, then y is left unmodified.

func DiskFSLabel added in v2.3.0

func DiskFSLabel(name string) string

DiskFSLabel returns the filesystem label that an additional disk named name is formatted with, before any filesystem-specific truncation.

func ExistingLimaVersion

func ExistingLimaVersion(instDir string) string

ExistingLimaVersion returns the version that created the instance, the empty string for instances created before Lima v0.20 (which have no recorded version), or the current version when the instance doesn't exist yet.

func FSLabelMaxLen added in v2.3.0

func FSLabelMaxLen(fsType string) int

FSLabelMaxLen returns the maximum filesystem label length, in bytes, accepted by fsType, or 0 if Lima does not know that limit.

mkfs enforces the limit differently depending on the filesystem: mkfs.ext4 truncates an over-long label silently, while mkfs.xfs rejects it outright. Lima therefore clamps the label in boot.Linux/05-lima-disks.sh, and the limits here must stay in sync with the ones in that script. For an fsType not listed here, the limit (and even whether mkfs.$fsType accepts a label at all) is unknown, so the boot script omits the label rather than guess.

This affects the label only. Lima does not identify a disk by its label, so a name too long to fit is not an error.

func FillCopyToHostDefaults

func FillCopyToHostDefaults(rule *limatype.CopyToHost, instDir string, user limatype.User, param map[string]string)

func FillDefault

func FillDefault(ctx context.Context, y, d, o *limatype.LimaYAML, filePath string, warn bool)

FillDefault updates undefined fields in y with defaults from d (or built-in default), and overwrites with values from o. Both d and o may be empty.

Maps (`Env`) are being merged: first populated from d, overwritten by y, and again overwritten by o. Slices (e.g. `Mounts`, `Provision`) are appended, starting with o, followed by y, and finally d. This makes sure o takes priority over y over d, in cases it matters (e.g. `PortForwards`, where the first matching rule terminates the search).

Exceptions:

  • Mounts are appended in d, y, o order, but "merged" when the Location matches a previous entry; the highest priority Writable setting wins.
  • Networks are appended in d, y, o order
  • DNS are picked from the highest priority where DNS is not empty.
  • CACertificates Files and Certs are uniquely appended in d, y, o order

func FillPortForwardDefaults

func FillPortForwardDefaults(rule *limatype.PortForward, instDir string, user limatype.User, param map[string]string)

func FirstUsernetIndex

func FirstUsernetIndex(l *limatype.LimaYAML) int

FirstUsernetIndex gets the index of first usernet network under l.Network[]. Returns -1 if no usernet network found.

func HostLoopbackEnabled added in v2.3.0

func HostLoopbackEnabled(l *limatype.LimaYAML) bool

HostLoopbackEnabled returns whether the guest may reach the host's loopback services via `host.lima.internal`. A nil value is treated as true, which is the builtin default.

func HostResolverEnabled added in v2.3.0

func HostResolverEnabled(l *limatype.LimaYAML) bool

func IsExistingInstanceDir

func IsExistingInstanceDir(dir string) bool

func IsSupportedWindowsShell added in v2.2.0

func IsSupportedWindowsShell(shell string) bool

func Load

func Load(ctx context.Context, b []byte, filePath string) (*limatype.LimaYAML, error)

Load loads the yaml and fulfills unspecified fields with the default values.

Load does not validate. Use Validate for validation.

func LoadWithWarnings

func LoadWithWarnings(ctx context.Context, b []byte, filePath string) (*limatype.LimaYAML, error)

LoadWithWarnings will call FillDefaults with warnings enabled (e.g. when the username is not valid on Linux and must be replaced by "Lima"). It is called when creating or editing an instance.

func MACAddress

func MACAddress(uniqueID string) string

func Marshal

func Marshal(y *limatype.LimaYAML, stream bool) ([]byte, error)

Marshal the struct as a YAML document, optionally as a stream.

func MountTag added in v2.1.0

func MountTag(location, mountPoint string) string

MountTag generates a stable mount tag from location and mountPoint. Both paths are hashed to handle the same location mounted to multiple mount points.

func ResolveArch

func ResolveArch(s *string) limatype.Arch

func ResolveOS

func ResolveOS(s *string) limatype.OS

func Unmarshal

func Unmarshal(data []byte, y *limatype.LimaYAML, comment string) error

func Validate

func Validate(y *limatype.LimaYAML, warn bool) error

func ValidateAgainstLatestConfig

func ValidateAgainstLatestConfig(ctx context.Context, yNew, yLatest []byte) error

ValidateAgainstLatestConfig validates the values between the latest YAML and the updated(New) YAML. This validates configuration rules that disallow certain changes, such as shrinking the disk.

Types

type ContainerdYAML

type ContainerdYAML struct {
	Archives []limatype.File
}

Jump to

Keyboard shortcuts

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