diff --git a/examples/default.yaml b/examples/default.yaml index c1674d3e759f..36d5f15f6af8 100644 --- a/examples/default.yaml +++ b/examples/default.yaml @@ -56,7 +56,7 @@ mounts: - location: "~" # Configure the mountPoint inside the guest. # 🟢 Builtin default: value of location - mountPoint: null + mountPoint: "" # CAUTION: `writable` SHOULD be false for the home directory. # Setting `writable` to true is possible, but untested and dangerous. # 🟢 Builtin default: false @@ -254,11 +254,11 @@ containerd: # Setting of instructions is supported like this: "qemu64,+ssse3". cpuType: # 🟢 Builtin default: "cortex-a72" (or "host" when running on aarch64 host) - aarch64: null + aarch64: "" # 🟢 Builtin default: "cortex-a7" (or "host" when running on armv7l host) - armv7l: null + armv7l: "" # 🟢 Builtin default: "qemu64" (or "host,-pdpe1gb" when running on x86_64 host) - x86_64: null + x86_64: "" rosetta: # Enable Rosetta for Linux (EXPERIMENTAL). diff --git a/pkg/limayaml/limayaml.go b/pkg/limayaml/limayaml.go index 189175aee4f8..2018fc34a505 100644 --- a/pkg/limayaml/limayaml.go +++ b/pkg/limayaml/limayaml.go @@ -7,41 +7,41 @@ import ( ) type LimaYAML struct { - VMType *VMType `yaml:"vmType,omitempty" json:"vmType,omitempty"` - OS *OS `yaml:"os,omitempty" json:"os,omitempty"` - Arch *Arch `yaml:"arch,omitempty" json:"arch,omitempty"` + VMType *VMType `yaml:"vmType,omitempty" json:"vmType,omitempty" jsonschema:"nullable"` + OS *OS `yaml:"os,omitempty" json:"os,omitempty" jsonschema:"nullable"` + Arch *Arch `yaml:"arch,omitempty" json:"arch,omitempty" jsonschema:"nullable"` 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 - AdditionalDisks []Disk `yaml:"additionalDisks,omitempty" json:"additionalDisks,omitempty"` + CPUs *int `yaml:"cpus,omitempty" json:"cpus,omitempty" jsonschema:"nullable"` + Memory *string `yaml:"memory,omitempty" json:"memory,omitempty" jsonschema:"nullable"` // go-units.RAMInBytes + Disk *string `yaml:"disk,omitempty" json:"disk,omitempty" jsonschema:"nullable"` // go-units.RAMInBytes + AdditionalDisks []Disk `yaml:"additionalDisks,omitempty" json:"additionalDisks,omitempty" jsonschema:"nullable"` // commented out Mounts []Mount `yaml:"mounts,omitempty" json:"mounts,omitempty"` - MountType *MountType `yaml:"mountType,omitempty" json:"mountType,omitempty"` - MountInotify *bool `yaml:"mountInotify,omitempty" json:"mountInotify,omitempty"` + MountType *MountType `yaml:"mountType,omitempty" json:"mountType,omitempty" jsonschema:"nullable"` + MountInotify *bool `yaml:"mountInotify,omitempty" json:"mountInotify,omitempty" jsonschema:"nullable"` SSH SSH `yaml:"ssh,omitempty" json:"ssh,omitempty"` // REQUIRED (FIXME) Firmware Firmware `yaml:"firmware,omitempty" json:"firmware,omitempty"` Audio Audio `yaml:"audio,omitempty" json:"audio,omitempty"` Video Video `yaml:"video,omitempty" json:"video,omitempty"` Provision []Provision `yaml:"provision,omitempty" json:"provision,omitempty"` - UpgradePackages *bool `yaml:"upgradePackages,omitempty" json:"upgradePackages,omitempty"` + UpgradePackages *bool `yaml:"upgradePackages,omitempty" json:"upgradePackages,omitempty" jsonschema:"nullable"` Containerd Containerd `yaml:"containerd,omitempty" json:"containerd,omitempty"` - GuestInstallPrefix *string `yaml:"guestInstallPrefix,omitempty" json:"guestInstallPrefix,omitempty"` + GuestInstallPrefix *string `yaml:"guestInstallPrefix,omitempty" json:"guestInstallPrefix,omitempty" jsonschema:"nullable"` Probes []Probe `yaml:"probes,omitempty" json:"probes,omitempty"` PortForwards []PortForward `yaml:"portForwards,omitempty" json:"portForwards,omitempty"` CopyToHost []CopyToHost `yaml:"copyToHost,omitempty" json:"copyToHost,omitempty"` Message string `yaml:"message,omitempty" json:"message,omitempty"` - Networks []Network `yaml:"networks,omitempty" json:"networks,omitempty"` + Networks []Network `yaml:"networks,omitempty" json:"networks,omitempty" jsonschema:"nullable"` // commented out // `network` was deprecated in Lima v0.7.0, removed in Lima v0.14.0. 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` was deprecated in Lima v0.8.1, removed in Lima v0.14.0. Use `hostResolver.enabled` instead. - PropagateProxyEnv *bool `yaml:"propagateProxyEnv,omitempty" json:"propagateProxyEnv,omitempty"` + PropagateProxyEnv *bool `yaml:"propagateProxyEnv,omitempty" json:"propagateProxyEnv,omitempty" jsonschema:"nullable"` CACertificates CACertificates `yaml:"caCerts,omitempty" json:"caCerts,omitempty"` Rosetta Rosetta `yaml:"rosetta,omitempty" json:"rosetta,omitempty"` - Plain *bool `yaml:"plain,omitempty" json:"plain,omitempty"` - TimeZone *string `yaml:"timezone,omitempty" json:"timezone,omitempty"` + Plain *bool `yaml:"plain,omitempty" json:"plain,omitempty" jsonschema:"nullable"` + TimeZone *string `yaml:"timezone,omitempty" json:"timezone,omitempty" jsonschema:"nullable"` } type ( @@ -70,8 +70,8 @@ const ( ) type Rosetta struct { - Enabled *bool `yaml:"enabled" json:"enabled"` - BinFmt *bool `yaml:"binfmt" json:"binfmt"` + Enabled *bool `yaml:"enabled" json:"enabled" jsonschema:"nullable"` + BinFmt *bool `yaml:"binfmt" json:"binfmt" jsonschema:"nullable"` } type File struct { @@ -106,7 +106,7 @@ type Disk struct { 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"` + Writable *bool `yaml:"writable,omitempty" json:"writable,omitempty" jsonschema:"nullable"` SSHFS SSHFS `yaml:"sshfs,omitempty" json:"sshfs,omitempty"` NineP NineP `yaml:"9p,omitempty" json:"9p,omitempty"` Virtiofs Virtiofs `yaml:"virtiofs,omitempty" json:"virtiofs,omitempty"` @@ -120,16 +120,16 @@ const ( ) 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"` + Cache *bool `yaml:"cache,omitempty" json:"cache,omitempty" jsonschema:"nullable"` + FollowSymlinks *bool `yaml:"followSymlinks,omitempty" json:"followSymlinks,omitempty" jsonschema:"nullable"` + SFTPDriver *SFTPDriver `yaml:"sftpDriver,omitempty" json:"sftpDriver,omitempty" jsonschema:"nullable"` } 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"` + SecurityModel *string `yaml:"securityModel,omitempty" json:"securityModel,omitempty" jsonschema:"nullable"` + ProtocolVersion *string `yaml:"protocolVersion,omitempty" json:"protocolVersion,omitempty" jsonschema:"nullable"` + Msize *string `yaml:"msize,omitempty" json:"msize,omitempty" jsonschema:"nullable"` + Cache *string `yaml:"cache,omitempty" json:"cache,omitempty" jsonschema:"nullable"` } type Virtiofs struct { @@ -140,16 +140,16 @@ 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 + LoadDotSSHPubKeys *bool `yaml:"loadDotSSHPubKeys,omitempty" json:"loadDotSSHPubKeys,omitempty" jsonschema:"nullable"` // default: true + ForwardAgent *bool `yaml:"forwardAgent,omitempty" json:"forwardAgent,omitempty" jsonschema:"nullable"` // default: false + ForwardX11 *bool `yaml:"forwardX11,omitempty" json:"forwardX11,omitempty" jsonschema:"nullable"` // default: false + ForwardX11Trusted *bool `yaml:"forwardX11Trusted,omitempty" json:"forwardX11Trusted,omitempty" jsonschema:"nullable"` // default: false } type Firmware struct { // LegacyBIOS disables UEFI if set. // LegacyBIOS is ignored for aarch64. - LegacyBIOS *bool `yaml:"legacyBIOS,omitempty" json:"legacyBIOS,omitempty"` + LegacyBIOS *bool `yaml:"legacyBIOS,omitempty" json:"legacyBIOS,omitempty" jsonschema:"nullable"` // Images specify UEFI images (edk2-aarch64-code.fd.gz). // Defaults to built-in UEFI. @@ -158,17 +158,17 @@ type Firmware struct { type Audio struct { // Device is a QEMU audiodev string - Device *string `yaml:"device,omitempty" json:"device,omitempty"` + Device *string `yaml:"device,omitempty" json:"device,omitempty" jsonschema:"nullable"` } type VNCOptions struct { - Display *string `yaml:"display,omitempty" json:"display,omitempty"` + Display *string `yaml:"display,omitempty" json:"display,omitempty" jsonschema:"nullable"` } type Video struct { // Display is a QEMU display string - Display *string `yaml:"display,omitempty" json:"display,omitempty"` - VNC VNCOptions `yaml:"vnc" json:"vnc"` + Display *string `yaml:"display,omitempty" json:"display,omitempty" jsonschema:"nullable"` + VNC VNCOptions `yaml:"vnc,omitempty" json:"vnc,omitempty"` } type ProvisionMode = string @@ -181,15 +181,15 @@ const ( ) type Provision struct { - Mode ProvisionMode `yaml:"mode" json:"mode"` // default: "system" + Mode ProvisionMode `yaml:"mode,omitempty" json:"mode,omitempty" jsonschema:"default=system"` SkipDefaultDependencyResolution *bool `yaml:"skipDefaultDependencyResolution,omitempty" json:"skipDefaultDependencyResolution,omitempty"` Script string `yaml:"script" json:"script"` } 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 + System *bool `yaml:"system,omitempty" json:"system,omitempty" jsonschema:"nullable"` // default: false + User *bool `yaml:"user,omitempty" json:"user,omitempty" jsonschema:"nullable"` // default: true + Archives []File `yaml:"archives,omitempty" json:"archives,omitempty"` // default: see defaultContainerdArchives } type ProbeMode = string @@ -199,10 +199,10 @@ const ( ) type Probe struct { - Mode ProbeMode // default: "readiness" - Description string - Script string - Hint string + Mode ProbeMode `yaml:"mode,omitempty" json:"mode,omitempty" jsonschema:"default=readiness"` + Description string `yaml:"description,omitempty" json:"description,omitempty"` + Script string `yaml:"script,omitempty" json:"script,omitempty"` + Hint string `yaml:"hint,omitempty" json:"hint,omitempty"` } type Proto = string @@ -250,15 +250,15 @@ type Network struct { } 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"` + Enabled *bool `yaml:"enabled,omitempty" json:"enabled,omitempty" jsonschema:"nullable"` + IPv6 *bool `yaml:"ipv6,omitempty" json:"ipv6,omitempty" jsonschema:"nullable"` + Hosts map[string]string `yaml:"hosts,omitempty" json:"hosts,omitempty" jsonschema:"nullable"` } 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"` + RemoveDefaults *bool `yaml:"removeDefaults,omitempty" json:"removeDefaults,omitempty" jsonschema:"nullable"` // default: false + Files []string `yaml:"files,omitempty" json:"files,omitempty" jsonschema:"nullable"` + Certs []string `yaml:"certs,omitempty" json:"certs,omitempty" jsonschema:"nullable"` } // DEPRECATED types below