limayaml

package
v2.0.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: Apache-2.0 Imports: 39 Imported by: 0

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
)

Variables

View Source
var (
	IPv4loopback1 = net.IPv4(127, 0, 0, 1)
)

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 ExistingLimaVersion

func ExistingLimaVersion(instDir string) string

ExistingLimaVersion returns empty if the instance was created with Lima prior to v0.20.

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 IsExistingInstanceDir

func IsExistingInstanceDir(dir string) bool

func IsNativeArch

func IsNativeArch(arch limatype.Arch) 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 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