limayaml

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2022 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Default9pSecurityModel   string = "mapped-xattr"
	Default9pProtocolVersion string = "9p2000.L"
	Default9pMsize           string = "128KiB"
	Default9pCacheForRO      string = "fscache"
	Default9pCacheForRW      string = "mmap"
)
View Source
const (
	X8664   Arch = "x86_64"
	AARCH64 Arch = "aarch64"
	RISCV64 Arch = "riscv64"

	REVSSHFS MountType = "reverse-sshfs"
	NINEP    MountType = "9p"
)
View Source
const (
	SFTPDriverBuiltin           = "builtin"
	SFTPDriverOpenSSHSFTPServer = "openssh-sftp-server"
)

Variables

This section is empty.

Functions

func Cname added in v0.8.3

func Cname(host string) string

func FillDefault

func FillDefault(y, d, o *LimaYAML, filePath string)

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.
  • DNS are picked from the highest priority where DNS is not empty.
  • CACertificates Files and Certs are uniquely appended

func FillPortForwardDefaults

func FillPortForwardDefaults(rule *PortForward, instDir string)

func HasHostCPU added in v0.11.1

func HasHostCPU() bool

func IsAccelOS added in v0.11.1

func IsAccelOS() bool

func IsNativeArch added in v0.8.3

func IsNativeArch(arch Arch) bool

func MACAddress

func MACAddress(uniqueID string) string

func Validate

func Validate(y LimaYAML, warn bool) error

Types

type Arch

type Arch = string

func NewArch added in v0.8.0

func NewArch(arch string) Arch

func ResolveArch added in v0.8.0

func ResolveArch(s *string) Arch

type CACertificates added in v0.10.0

type CACertificates struct {
	RemoveDefaults *bool    `yaml:"removeDefaults,omitempty" json:"removeDefaults,omitempty"` // default: false
	Files          []string `yaml:"files,omitempty" json:"files,omitempty"`
	Certs          []string `yaml:"certs,omitempty" json:"certs,omitempty"`
}

type Containerd

type Containerd struct {
	System   *bool  `yaml:"system,omitempty" json:"system,omitempty"`     // default: false
	User     *bool  `yaml:"user,omitempty" json:"user,omitempty"`         // default: true
	Archives []File `yaml:"archives,omitempty" json:"archives,omitempty"` // default: see defaultContainerdArchives
}

type File

type File struct {
	Location string        `yaml:"location" json:"location"` // REQUIRED
	Arch     Arch          `yaml:"arch,omitempty" json:"arch,omitempty"`
	Digest   digest.Digest `yaml:"digest,omitempty" json:"digest,omitempty"`
}

type Firmware

type Firmware struct {
	// LegacyBIOS disables UEFI if set.
	// LegacyBIOS is ignored for aarch64.
	LegacyBIOS *bool `yaml:"legacyBIOS,omitempty" json:"legacyBIOS,omitempty"`
}

type HostResolver added in v0.8.1

type HostResolver struct {
	Enabled *bool             `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	IPv6    *bool             `yaml:"ipv6,omitempty" json:"ipv6,omitempty"`
	Hosts   map[string]string `yaml:"hosts,omitempty" json:"hosts,omitempty"`
}

type Image added in v0.11.0

type Image struct {
	File   `yaml:",inline"`
	Kernel *Kernel `yaml:"kernel,omitempty" json:"kernel,omitempty"`
	Initrd *File   `yaml:"initrd,omitempty" json:"initrd,omitempty"`
}

type Kernel added in v0.11.0

type Kernel struct {
	File    `yaml:",inline"`
	Cmdline string `yaml:"cmdline,omitempty" json:"cmdline,omitempty"`
}

type LimaYAML

type LimaYAML struct {
	Arch              *Arch             `yaml:"arch,omitempty" json:"arch,omitempty"`
	Images            []Image           `yaml:"images" json:"images"` // REQUIRED
	CPUType           map[Arch]string   `yaml:"cpuType,omitempty" json:"cpuType,omitempty"`
	CPUs              *int              `yaml:"cpus,omitempty" json:"cpus,omitempty"`
	Memory            *string           `yaml:"memory,omitempty" json:"memory,omitempty"` // go-units.RAMInBytes
	Disk              *string           `yaml:"disk,omitempty" json:"disk,omitempty"`     // go-units.RAMInBytes
	Mounts            []Mount           `yaml:"mounts,omitempty" json:"mounts,omitempty"`
	MountType         *MountType        `yaml:"mountType,omitempty" json:"mountType,omitempty"`
	SSH               SSH               `yaml:"ssh,omitempty" json:"ssh,omitempty"` // REQUIRED (FIXME)
	Firmware          Firmware          `yaml:"firmware,omitempty" json:"firmware,omitempty"`
	Video             Video             `yaml:"video,omitempty" json:"video,omitempty"`
	Provision         []Provision       `yaml:"provision,omitempty" json:"provision,omitempty"`
	Containerd        Containerd        `yaml:"containerd,omitempty" json:"containerd,omitempty"`
	Probes            []Probe           `yaml:"probes,omitempty" json:"probes,omitempty"`
	PortForwards      []PortForward     `yaml:"portForwards,omitempty" json:"portForwards,omitempty"`
	Message           string            `yaml:"message,omitempty" json:"message,omitempty"`
	Networks          []Network         `yaml:"networks,omitempty" json:"networks,omitempty"`
	Network           NetworkDeprecated `yaml:"network,omitempty" json:"network,omitempty"` // DEPRECATED, use `networks` instead
	Env               map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
	DNS               []net.IP          `yaml:"dns,omitempty" json:"dns,omitempty"`
	HostResolver      HostResolver      `yaml:"hostResolver,omitempty" json:"hostResolver,omitempty"`
	UseHostResolver   *bool             `yaml:"useHostResolver,omitempty" json:"useHostResolver,omitempty"` // DEPRECATED, use `HostResolver.Enabled` instead
	PropagateProxyEnv *bool             `yaml:"propagateProxyEnv,omitempty" json:"propagateProxyEnv,omitempty"`
	CACertificates    CACertificates    `yaml:"caCerts,omitempty" json:"caCerts,omitempty"`
}

func Load

func Load(b []byte, filePath string) (*LimaYAML, error)

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

Load does not validate. Use Validate for validation.

type Mount

type Mount struct {
	Location   string `yaml:"location" json:"location"` // REQUIRED
	MountPoint string `yaml:"mountPoint,omitempty" json:"mountPoint,omitempty"`
	Writable   *bool  `yaml:"writable,omitempty" json:"writable,omitempty"`
	SSHFS      SSHFS  `yaml:"sshfs,omitempty" json:"sshfs,omitempty"`
	NineP      NineP  `yaml:"9p,omitempty" json:"9p,omitempty"`
}

type MountType added in v0.10.0

type MountType = string

type Network

type Network struct {
	// `Lima` and `VNL` are mutually exclusive; exactly one is required
	Lima string `yaml:"lima,omitempty" json:"lima,omitempty"`
	// VNL is a Virtual Network Locator (https://github.com/rd235/vdeplug4/commit/089984200f447abb0e825eb45548b781ba1ebccd).
	// On macOS, only VDE2-compatible form (optionally with vde:// prefix) is supported.
	VNL        string `yaml:"vnl,omitempty" json:"vnl,omitempty"`
	SwitchPort uint16 `yaml:"switchPort,omitempty" json:"switchPort,omitempty"` // VDE Switch port, not TCP/UDP port (only used by VDE networking)
	MACAddress string `yaml:"macAddress,omitempty" json:"macAddress,omitempty"`
	Interface  string `yaml:"interface,omitempty" json:"interface,omitempty"`
}

type NetworkDeprecated added in v0.7.0

type NetworkDeprecated struct {
	VDEDeprecated []VDEDeprecated `yaml:"vde,omitempty" json:"vde,omitempty"`
	// contains filtered or unexported fields
}

type NineP added in v0.10.0

type NineP struct {
	SecurityModel   *string `yaml:"securityModel,omitempty" json:"securityModel,omitempty"`
	ProtocolVersion *string `yaml:"protocolVersion,omitempty" json:"protocolVersion,omitempty"`
	Msize           *string `yaml:"msize,omitempty" json:"msize,omitempty"`
	Cache           *string `yaml:"cache,omitempty" json:"cache,omitempty"`
}

type PortForward

type PortForward struct {
	GuestIPMustBeZero bool   `yaml:"guestIPMustBeZero,omitempty" json:"guestIPMustBeZero,omitempty"`
	GuestIP           net.IP `yaml:"guestIP,omitempty" json:"guestIP,omitempty"`
	GuestPort         int    `yaml:"guestPort,omitempty" json:"guestPort,omitempty"`
	GuestPortRange    [2]int `yaml:"guestPortRange,omitempty" json:"guestPortRange,omitempty"`
	GuestSocket       string `yaml:"guestSocket,omitempty" json:"guestSocket,omitempty"`
	HostIP            net.IP `yaml:"hostIP,omitempty" json:"hostIP,omitempty"`
	HostPort          int    `yaml:"hostPort,omitempty" json:"hostPort,omitempty"`
	HostPortRange     [2]int `yaml:"hostPortRange,omitempty" json:"hostPortRange,omitempty"`
	HostSocket        string `yaml:"hostSocket,omitempty" json:"hostSocket,omitempty"`
	Proto             Proto  `yaml:"proto,omitempty" json:"proto,omitempty"`
	Reverse           bool   `yaml:"reverse,omitempty" json:"reverse,omitempty"`
	Ignore            bool   `yaml:"ignore,omitempty" json:"ignore,omitempty"`
}

type Probe

type Probe struct {
	Mode        ProbeMode // default: "readiness"
	Description string
	Script      string
	Hint        string
}

type ProbeMode

type ProbeMode = string
const (
	ProbeModeReadiness ProbeMode = "readiness"
)

type Proto

type Proto = string
const (
	TCP Proto = "tcp"
)

type Provision

type Provision struct {
	Mode   ProvisionMode `yaml:"mode" json:"mode"` // default: "system"
	Script string        `yaml:"script" json:"script"`
}

type ProvisionMode

type ProvisionMode = string
const (
	ProvisionModeSystem ProvisionMode = "system"
	ProvisionModeUser   ProvisionMode = "user"
)

type SFTPDriver added in v0.10.0

type SFTPDriver = string

type SSH

type SSH struct {
	LocalPort *int `yaml:"localPort,omitempty" json:"localPort,omitempty"`

	// LoadDotSSHPubKeys loads ~/.ssh/*.pub in addition to $LIMA_HOME/_config/user.pub .
	LoadDotSSHPubKeys *bool `yaml:"loadDotSSHPubKeys,omitempty" json:"loadDotSSHPubKeys,omitempty"` // default: true
	ForwardAgent      *bool `yaml:"forwardAgent,omitempty" json:"forwardAgent,omitempty"`           // default: false
	ForwardX11        *bool `yaml:"forwardX11,omitempty" json:"forwardX11,omitempty"`               // default: false
	ForwardX11Trusted *bool `yaml:"forwardX11Trusted,omitempty" json:"forwardX11Trusted,omitempty"` // default: false
}

type SSHFS added in v0.8.1

type SSHFS struct {
	Cache          *bool       `yaml:"cache,omitempty" json:"cache,omitempty"`
	FollowSymlinks *bool       `yaml:"followSymlinks,omitempty" json:"followSymlinks,omitempty"`
	SFTPDriver     *SFTPDriver `yaml:"sftpDriver,omitempty" json:"sftpDriver,omitempty"`
}

type VDEDeprecated added in v0.7.0

type VDEDeprecated struct {
	VNL        string `yaml:"vnl,omitempty" json:"vnl,omitempty"`
	SwitchPort uint16 `yaml:"switchPort,omitempty" json:"switchPort,omitempty"` // VDE Switch port, not TCP/UDP port
	MACAddress string `yaml:"macAddress,omitempty" json:"macAddress,omitempty"`
	Name       string `yaml:"name,omitempty" json:"name,omitempty"`
}

type Video

type Video struct {
	// Display is a QEMU display string
	Display *string `yaml:"display,omitempty" json:"display,omitempty"`
}

Jump to

Keyboard shortcuts

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