From a9983ecc07dcd798f693f7f51e44f14b60405c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Tue, 30 Apr 2024 11:47:01 +0200 Subject: [PATCH] Improve the limayaml and default.yaml syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Anders F Björklund --- examples/default.yaml | 6 +++--- pkg/limayaml/limayaml.go | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/default.yaml b/examples/default.yaml index c1674d3e759f..40a43fa04b7c 100644 --- a/examples/default.yaml +++ b/examples/default.yaml @@ -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..0eee9387450c 100644 --- a/pkg/limayaml/limayaml.go +++ b/pkg/limayaml/limayaml.go @@ -7,14 +7,14 @@ 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 + 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"` Mounts []Mount `yaml:"mounts,omitempty" json:"mounts,omitempty"` MountType *MountType `yaml:"mountType,omitempty" json:"mountType,omitempty"` @@ -181,7 +181,7 @@ 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"` } @@ -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