Documentation ¶
Index ¶
- Constants
- type CloudInitRunner
- type DockerImageMeta
- type ElementalPartitions
- func (ep ElementalPartitions) PartitionsByInstallOrder(extraPartitions PartitionList, excludes ...*Partition) PartitionList
- func (ep ElementalPartitions) PartitionsByMountPoint(descending bool, excludes ...*Partition) PartitionList
- func (ep *ElementalPartitions) SetDefaultLabels()
- func (ep *ElementalPartitions) SetFirmwarePartitions(firmware string, partTable string) error
- type EmptySpec
- type FS
- type HTTPClient
- type Image
- type ImageExtractor
- type ImageSource
- func (i *ImageSource) CustomUnmarshal(data interface{}) (bool, error)
- func (i ImageSource) IsDir() bool
- func (i ImageSource) IsDocker() bool
- func (i ImageSource) IsEmpty() bool
- func (i ImageSource) IsFile() bool
- func (i ImageSource) MarshalYAML() (interface{}, error)
- func (i ImageSource) String() string
- func (i *ImageSource) UnmarshalYAML(value *yaml.Node) error
- func (i ImageSource) Value() string
- type ImageState
- type InstallSpec
- func (i *InstallSpec) GetExtraPartitions() PartitionList
- func (i *InstallSpec) GetPartTable() string
- func (i *InstallSpec) GetPartitions() ElementalPartitions
- func (i *InstallSpec) GetTarget() string
- func (i *InstallSpec) Sanitize() error
- func (i *InstallSpec) ShouldReboot() bool
- func (i *InstallSpec) ShouldShutdown() bool
- type InstallState
- type InstallUkiSpec
- func (i *InstallUkiSpec) GetExtraPartitions() PartitionList
- func (i *InstallUkiSpec) GetPartTable() string
- func (i *InstallUkiSpec) GetPartitions() ElementalPartitions
- func (i *InstallUkiSpec) GetTarget() string
- func (i *InstallUkiSpec) Sanitize() error
- func (i *InstallUkiSpec) ShouldReboot() bool
- func (i *InstallUkiSpec) ShouldShutdown() bool
- type OCIImageExtractor
- type Partition
- type PartitionList
- type PartitionState
- type Platform
- type RealRunner
- func (r *RealRunner) GetLogger() *sdkTypes.KairosLogger
- func (r RealRunner) InitCmd(command string, args ...string) *exec.Cmd
- func (r RealRunner) Run(command string, args ...string) ([]byte, error)
- func (r RealRunner) RunCmd(cmd *exec.Cmd) ([]byte, error)
- func (r *RealRunner) SetLogger(logger *sdkTypes.KairosLogger)
- type RealSyscall
- type ResetSpec
- type ResetUkiSpec
- type Runner
- type SharedInstallSpec
- type SourceNotFound
- type Spec
- type SyscallInterface
- type UpgradeSpec
- type UpgradeUkiSpec
Constants ¶
const ( GPT = "gpt" BIOS = "bios" MSDOS = "msdos" EFI = "efi" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudInitRunner ¶
type DockerImageMeta ¶
type DockerImageMeta struct { Digest string `yaml:"digest,omitempty"` Size int64 `yaml:"size,omitempty"` }
DockerImageMeta represents metadata of a docker container image type
type ElementalPartitions ¶
type ElementalPartitions struct { BIOS *Partition `yaml:"-"` EFI *Partition `yaml:"-"` OEM *Partition `yaml:"oem,omitempty" mapstructure:"oem"` Recovery *Partition `yaml:"recovery,omitempty" mapstructure:"recovery"` State *Partition `yaml:"state,omitempty" mapstructure:"state"` Persistent *Partition `yaml:"persistent,omitempty" mapstructure:"persistent"` }
func NewElementalPartitionsFromList ¶
func NewElementalPartitionsFromList(pl PartitionList) ElementalPartitions
NewElementalPartitionsFromList fills an ElementalPartitions instance from given partitions list. First tries to match partitions by partition label, if not, it tries to match partitions by default filesystem label TODO find a way to map custom labels when partition labels are not available
func (ElementalPartitions) PartitionsByInstallOrder ¶
func (ep ElementalPartitions) PartitionsByInstallOrder(extraPartitions PartitionList, excludes ...*Partition) PartitionList
PartitionsByInstallOrder sorts partitions according to the default layout nil partitions are ignored partition with 0 size is set last
func (ElementalPartitions) PartitionsByMountPoint ¶
func (ep ElementalPartitions) PartitionsByMountPoint(descending bool, excludes ...*Partition) PartitionList
PartitionsByMountPoint sorts partitions according to its mountpoint, ignores nil partitions or partitions with an empty mountpoint
func (*ElementalPartitions) SetDefaultLabels ¶
func (ep *ElementalPartitions) SetDefaultLabels()
SetDefaultLabels sets the default labels for oem, state, persistent and recovery partitions.
func (*ElementalPartitions) SetFirmwarePartitions ¶
func (ep *ElementalPartitions) SetFirmwarePartitions(firmware string, partTable string) error
SetFirmwarePartitions sets firmware partitions for a given firmware and partition table type
type EmptySpec ¶
type EmptySpec struct { }
EmptySpec is an empty spec for places that may need to inject a spec but doent really have one associated like firstboot
func (*EmptySpec) ShouldReboot ¶
func (*EmptySpec) ShouldShutdown ¶
type FS ¶
type FS interface { Open(name string) (fs.File, error) Chmod(name string, mode os.FileMode) error Create(name string) (*os.File, error) Mkdir(name string, perm os.FileMode) error Stat(name string) (os.FileInfo, error) Lstat(name string) (os.FileInfo, error) RemoveAll(path string) error ReadFile(filename string) ([]byte, error) Readlink(name string) (string, error) RawPath(name string) (string, error) ReadDir(dirname string) ([]fs.DirEntry, error) Remove(name string) error OpenFile(name string, flag int, perm fs.FileMode) (*os.File, error) WriteFile(filename string, data []byte, perm os.FileMode) error }
type HTTPClient ¶
type HTTPClient interface {
GetURL(log sdkTypes.KairosLogger, url string, destination string) error
}
type Image ¶
type Image struct { File string `yaml:"-"` Label string `yaml:"label,omitempty" mapstructure:"label"` Size uint `yaml:"size,omitempty" mapstructure:"size"` FS string `yaml:"fs,omitempty" mapstructure:"fs"` Source *ImageSource `yaml:"uri,omitempty" mapstructure:"uri"` MountPoint string `yaml:"-"` LoopDevice string `yaml:"-"` }
Image struct represents a file system image with its commonly configurable values, size in MiB
type ImageExtractor ¶
type ImageSource ¶
type ImageSource struct {
// contains filtered or unexported fields
}
ImageSource represents the source from where an image is created for easy identification
func NewDirSrc ¶
func NewDirSrc(src string) *ImageSource
func NewDockerSrc ¶
func NewDockerSrc(src string) *ImageSource
func NewEmptySrc ¶
func NewEmptySrc() *ImageSource
func NewFileSrc ¶
func NewFileSrc(src string) *ImageSource
func NewSrcFromURI ¶
func NewSrcFromURI(uri string) (*ImageSource, error)
func (*ImageSource) CustomUnmarshal ¶
func (i *ImageSource) CustomUnmarshal(data interface{}) (bool, error)
func (ImageSource) IsDir ¶
func (i ImageSource) IsDir() bool
func (ImageSource) IsDocker ¶
func (i ImageSource) IsDocker() bool
func (ImageSource) IsEmpty ¶
func (i ImageSource) IsEmpty() bool
func (ImageSource) IsFile ¶
func (i ImageSource) IsFile() bool
func (ImageSource) MarshalYAML ¶
func (i ImageSource) MarshalYAML() (interface{}, error)
func (ImageSource) String ¶
func (i ImageSource) String() string
func (*ImageSource) UnmarshalYAML ¶
func (i *ImageSource) UnmarshalYAML(value *yaml.Node) error
func (ImageSource) Value ¶
func (i ImageSource) Value() string
type ImageState ¶
type ImageState struct { Source *ImageSource `yaml:"source,omitempty"` SourceMetadata interface{} `yaml:"source-metadata,omitempty"` Label string `yaml:"label,omitempty"` FS string `yaml:"fs,omitempty"` }
ImageState represents data of a deployed image
func (*ImageState) UnmarshalYAML ¶
func (i *ImageState) UnmarshalYAML(value *yaml.Node) error
type InstallSpec ¶
type InstallSpec struct { Target string `yaml:"device,omitempty" mapstructure:"device"` Firmware string `yaml:"firmware,omitempty" mapstructure:"firmware"` PartTable string `yaml:"part-table,omitempty" mapstructure:"part-table"` Partitions ElementalPartitions `yaml:"partitions,omitempty" mapstructure:"partitions"` ExtraPartitions PartitionList `yaml:"extra-partitions,omitempty" mapstructure:"extra-partitions"` NoFormat bool `yaml:"no-format,omitempty" mapstructure:"no-format"` Force bool `yaml:"force,omitempty" mapstructure:"force"` CloudInit []string `yaml:"cloud-init,omitempty" mapstructure:"cloud-init"` Iso string `yaml:"iso,omitempty" mapstructure:"iso"` GrubDefEntry string `yaml:"grub-entry-name,omitempty" mapstructure:"grub-entry-name"` Tty string `yaml:"tty,omitempty" mapstructure:"tty"` Reboot bool `yaml:"reboot,omitempty" mapstructure:"reboot"` PowerOff bool `yaml:"poweroff,omitempty" mapstructure:"poweroff"` ExtraDirsRootfs []string `yaml:"extra-dirs-rootfs,omitempty" mapstructure:"extra-dirs-rootfs"` Active Image `yaml:"system,omitempty" mapstructure:"system"` Recovery Image `yaml:"recovery-system,omitempty" mapstructure:"recovery-system"` Passive Image GrubConf string }
InstallSpec struct represents all the installation action details
func (*InstallSpec) GetExtraPartitions ¶
func (i *InstallSpec) GetExtraPartitions() PartitionList
func (*InstallSpec) GetPartTable ¶
func (i *InstallSpec) GetPartTable() string
func (*InstallSpec) GetPartitions ¶
func (i *InstallSpec) GetPartitions() ElementalPartitions
func (*InstallSpec) GetTarget ¶
func (i *InstallSpec) GetTarget() string
func (*InstallSpec) Sanitize ¶
func (i *InstallSpec) Sanitize() error
Sanitize checks the consistency of the struct, returns error if unsolvable inconsistencies are found
func (*InstallSpec) ShouldReboot ¶
func (i *InstallSpec) ShouldReboot() bool
func (*InstallSpec) ShouldShutdown ¶
func (i *InstallSpec) ShouldShutdown() bool
type InstallState ¶
type InstallState struct { Date string `yaml:"date,omitempty"` Partitions map[string]*PartitionState `yaml:",omitempty,inline"` }
InstallState tracks the installation data of the whole system
type InstallUkiSpec ¶
type InstallUkiSpec struct { Active Image `yaml:"system,omitempty" mapstructure:"system"` Target string `yaml:"device,omitempty" mapstructure:"device"` Reboot bool `yaml:"reboot,omitempty" mapstructure:"reboot"` PowerOff bool `yaml:"poweroff,omitempty" mapstructure:"poweroff"` Partitions ElementalPartitions `yaml:"partitions,omitempty" mapstructure:"partitions"` ExtraPartitions PartitionList `yaml:"extra-partitions,omitempty" mapstructure:"extra-partitions"` NoFormat bool `yaml:"no-format,omitempty" mapstructure:"no-format"` CloudInit []string `yaml:"cloud-init,omitempty" mapstructure:"cloud-init"` SkipEntries []string `yaml:"skip-entries,omitempty" mapstructure:"skip-entries"` }
func (*InstallUkiSpec) GetExtraPartitions ¶
func (i *InstallUkiSpec) GetExtraPartitions() PartitionList
func (*InstallUkiSpec) GetPartTable ¶
func (i *InstallUkiSpec) GetPartTable() string
func (*InstallUkiSpec) GetPartitions ¶
func (i *InstallUkiSpec) GetPartitions() ElementalPartitions
func (*InstallUkiSpec) GetTarget ¶
func (i *InstallUkiSpec) GetTarget() string
func (*InstallUkiSpec) Sanitize ¶
func (i *InstallUkiSpec) Sanitize() error
func (*InstallUkiSpec) ShouldReboot ¶
func (i *InstallUkiSpec) ShouldReboot() bool
func (*InstallUkiSpec) ShouldShutdown ¶
func (i *InstallUkiSpec) ShouldShutdown() bool
type OCIImageExtractor ¶
type OCIImageExtractor struct{}
func (OCIImageExtractor) ExtractImage ¶
func (e OCIImageExtractor) ExtractImage(imageRef, destination, platformRef string) error
func (OCIImageExtractor) GetOCIImageSize ¶
func (e OCIImageExtractor) GetOCIImageSize(imageRef, platformRef string) (int64, error)
type Partition ¶
type Partition struct { Name string `yaml:"-"` FilesystemLabel string `yaml:"label,omitempty" mapstructure:"label"` Size uint `yaml:"size,omitempty" mapstructure:"size"` FS string `yaml:"fs,omitempty" mapstrcuture:"fs"` Flags []string `yaml:"flags,omitempty" mapstrcuture:"flags"` MountPoint string `yaml:"-"` Path string `yaml:"-"` Disk string `yaml:"-"` }
Partition struct represents a partition with its commonly configurable values, size in MiB
type PartitionList ¶
type PartitionList []*Partition
func (PartitionList) GetByLabel ¶
func (pl PartitionList) GetByLabel(label string) *Partition
GetByLabel gets a partition by its label from the PartitionList
func (PartitionList) GetByName ¶
func (pl PartitionList) GetByName(name string) *Partition
GetByName gets a partitions by its name from the PartitionList
type PartitionState ¶
type PartitionState struct { FSLabel string `yaml:"label,omitempty"` Images map[string]*ImageState `yaml:",omitempty,inline"` }
PartitionState tracks installation data of a partition
type Platform ¶
func NewPlatform ¶
func NewPlatformFromArch ¶
func ParsePlatform ¶
func (*Platform) CustomUnmarshal ¶
func (Platform) MarshalYAML ¶
func (*Platform) UnmarshalYAML ¶
type RealRunner ¶
type RealRunner struct {
Logger *sdkTypes.KairosLogger
}
func (*RealRunner) GetLogger ¶
func (r *RealRunner) GetLogger() *sdkTypes.KairosLogger
func (*RealRunner) SetLogger ¶
func (r *RealRunner) SetLogger(logger *sdkTypes.KairosLogger)
type RealSyscall ¶
type RealSyscall struct{}
func (*RealSyscall) Chdir ¶
func (r *RealSyscall) Chdir(path string) error
func (*RealSyscall) Chroot ¶
func (r *RealSyscall) Chroot(path string) error
type ResetSpec ¶
type ResetSpec struct { FormatPersistent bool `yaml:"reset-persistent,omitempty" mapstructure:"reset-persistent"` FormatOEM bool `yaml:"reset-oem,omitempty" mapstructure:"reset-oem"` Reboot bool `yaml:"reboot,omitempty" mapstructure:"reboot"` PowerOff bool `yaml:"poweroff,omitempty" mapstructure:"poweroff"` GrubDefEntry string `yaml:"grub-entry-name,omitempty" mapstructure:"grub-entry-name"` Tty string `yaml:"tty,omitempty" mapstructure:"tty"` ExtraDirsRootfs []string `yaml:"extra-dirs-rootfs,omitempty" mapstructure:"extra-dirs-rootfs"` Active Image `yaml:"system,omitempty" mapstructure:"system"` Passive Image Partitions ElementalPartitions Target string Efi bool GrubConf string State *InstallState }
ResetSpec struct represents all the reset action details
func (*ResetSpec) Sanitize ¶
Sanitize checks the consistency of the struct, returns error if unsolvable inconsistencies are found
func (*ResetSpec) ShouldReboot ¶
func (*ResetSpec) ShouldShutdown ¶
type ResetUkiSpec ¶
type ResetUkiSpec struct { FormatPersistent bool `yaml:"reset-persistent,omitempty" mapstructure:"reset-persistent"` FormatOEM bool `yaml:"reset-oem,omitempty" mapstructure:"reset-oem"` Reboot bool `yaml:"reboot,omitempty" mapstructure:"reboot"` PowerOff bool `yaml:"poweroff,omitempty" mapstructure:"poweroff"` Partitions ElementalPartitions }
func (*ResetUkiSpec) Sanitize ¶
func (i *ResetUkiSpec) Sanitize() error
func (*ResetUkiSpec) ShouldReboot ¶
func (i *ResetUkiSpec) ShouldReboot() bool
func (*ResetUkiSpec) ShouldShutdown ¶
func (i *ResetUkiSpec) ShouldShutdown() bool
type SharedInstallSpec ¶
type SharedInstallSpec interface {}
SharedInstallSpec is the interface that Install specs need to implement
type SourceNotFound ¶
type SourceNotFound struct { }
SourceNotFound is the error to raise when we can't find a source for install/upgrade
func (*SourceNotFound) Error ¶
func (s *SourceNotFound) Error() string
type SyscallInterface ¶
type UpgradeSpec ¶
type UpgradeSpec struct { Entry string `yaml:"entry,omitempty" mapstructure:"entry"` Active Image `yaml:"system,omitempty" mapstructure:"system"` Recovery Image `yaml:"recovery-system,omitempty" mapstructure:"recovery-system"` GrubDefEntry string `yaml:"grub-entry-name,omitempty" mapstructure:"grub-entry-name"` Reboot bool `yaml:"reboot,omitempty" mapstructure:"reboot"` PowerOff bool `yaml:"poweroff,omitempty" mapstructure:"poweroff"` ExtraDirsRootfs []string `yaml:"extra-dirs-rootfs,omitempty" mapstructure:"extra-dirs-rootfs"` Passive Image Partitions ElementalPartitions State *InstallState }
func (*UpgradeSpec) RecoveryUpgrade ¶
func (u *UpgradeSpec) RecoveryUpgrade() bool
func (*UpgradeSpec) Sanitize ¶
func (u *UpgradeSpec) Sanitize() error
Sanitize checks the consistency of the struct, returns error if unsolvable inconsistencies are found
func (*UpgradeSpec) ShouldReboot ¶
func (u *UpgradeSpec) ShouldReboot() bool
func (*UpgradeSpec) ShouldShutdown ¶
func (u *UpgradeSpec) ShouldShutdown() bool
type UpgradeUkiSpec ¶
type UpgradeUkiSpec struct { Entry string `yaml:"entry,omitempty" mapstructure:"entry"` Active Image `yaml:"system,omitempty" mapstructure:"system"` Reboot bool `yaml:"reboot,omitempty" mapstructure:"reboot"` PowerOff bool `yaml:"poweroff,omitempty" mapstructure:"poweroff"` EfiPartition *Partition `yaml:"efi-partition,omitempty" mapstructure:"efi-partition"` }
func (*UpgradeUkiSpec) RecoveryUpgrade ¶ added in v2.7.13
func (i *UpgradeUkiSpec) RecoveryUpgrade() bool
func (*UpgradeUkiSpec) Sanitize ¶
func (i *UpgradeUkiSpec) Sanitize() error
func (*UpgradeUkiSpec) ShouldReboot ¶
func (i *UpgradeUkiSpec) ShouldReboot() bool
func (*UpgradeUkiSpec) ShouldShutdown ¶
func (i *UpgradeUkiSpec) ShouldShutdown() bool