Documentation
¶
Index ¶
- Constants
- func CheckDiskDevice(s *sys.System, d *Deployment) error
- func CheckSourceOS(_ *sys.System, d *Deployment) error
- func LiveKernelCmdline(label string) string
- func Merge(dst, src *Deployment) error
- type BootConfig
- type Deployment
- func (d Deployment) BaseKernelCmdline() string
- func (d Deployment) DeepCopy() (*Deployment, error)
- func (d Deployment) GetEfiDisk() *Disk
- func (d Deployment) GetEfiPartition() *Partition
- func (d Deployment) GetRecoveryPartition() *Partition
- func (d Deployment) GetSystemDisk() *Disk
- func (d Deployment) GetSystemLabel() string
- func (d Deployment) GetSystemPartition() *Partition
- func (d *Deployment) IsFipsEnabled() bool
- func (d Deployment) RecoveryKernelCmdline() string
- func (d *Deployment) Sanitize(s *sys.System, excludeChecks ...SanitizeDeployment) error
- func (d *Deployment) WriteDeploymentFile(s *sys.System, root string) error
- type Disk
- type FileSystem
- type FirmwareConfig
- type ImageSource
- func (i ImageSource) GetDigest() string
- func (i ImageSource) IsDir() bool
- func (i ImageSource) IsEmpty() bool
- func (i ImageSource) IsOCI() bool
- func (i ImageSource) IsRaw() bool
- func (i ImageSource) IsTar() bool
- func (i ImageSource) MarshalYAML() (any, error)
- func (i *ImageSource) SetDigest(digest string)
- func (i ImageSource) String() string
- func (i ImageSource) URI() string
- func (i *ImageSource) UnmarshalYAML(data *yaml.Node) (err error)
- type ImageSrcType
- type LiveInstaller
- type MiB
- type Opt
- type PartRole
- type Partition
- type Partitions
- type RWVolume
- type RWVolumes
- type SanitizeDeployment
- type SecurityConfig
- type SnapshotterConfig
Constants ¶
const ( EfiLabel = "EFI" EfiMnt = "/boot" EfiSize MiB = 1024 RecoveryLabel = "RECOVERY" RecoverySize = 0 RecoveryMark = "elm.recovery" ResetMark = "elm.reset" SystemLabel = "SYSTEM" SystemMnt = "/" AllAvailableSize MiB = 0 ConfigLabel = "ignition" ConfigMnt = "/run/elemental/firstboot" Unknown = "unknown" )
Variables ¶
This section is empty.
Functions ¶
func CheckDiskDevice ¶
func CheckDiskDevice(s *sys.System, d *Deployment) error
CheckDiskDevice ensures the device is defined and it exists
func CheckSourceOS ¶
func CheckSourceOS(_ *sys.System, d *Deployment) error
CheckSourceOS ensures the deployment includes an OS image
func LiveKernelCmdline ¶
LiveKernelCmdline returns the default kernel command line to live boot with the givel label
func Merge ¶
func Merge(dst, src *Deployment) error
Merge applies non zero values of the source deployment to the destination deployment. The list of disks and partitions are merged by order. For instance, first source partition is merged with first destination partition. If source disks or partitions list is longer than the destination one, any overflow item is appended.
Other slice types in Deployment are simply replaced, not merged.
Types ¶
type BootConfig ¶
type Deployment ¶
type Deployment struct {
SourceOS *ImageSource `yaml:"sourceOS"`
Disks []*Disk `yaml:"disks"`
Firmware *FirmwareConfig `yaml:"firmware"`
BootConfig *BootConfig `yaml:"bootloader"`
Security *SecurityConfig `yaml:"security"`
Snapshotter *SnapshotterConfig `yaml:"snapshotter"`
OverlayTree *ImageSource `yaml:"overlayTree,omitempty"`
CfgScript string `yaml:"configScript,omitempty"`
Installer LiveInstaller `yaml:"installer,omitempty"`
}
func DefaultDeployment ¶
func DefaultDeployment() *Deployment
DefaultDeployment returns the simplest deployment setup in a single disk including only EFI and System partitions
func New ¶
func New(opts ...Opt) *Deployment
New returns a new deployment based on the default setup with the given options applied on top.
func Parse ¶
func Parse(s *sys.System, root string) (*Deployment, error)
Parse reads a deployment yaml file from the given root and returns a Deployment object
func (Deployment) BaseKernelCmdline ¶
func (d Deployment) BaseKernelCmdline() string
BaseKernelCmdline returns the base kernel command line for the current deployment
func (Deployment) DeepCopy ¶
func (d Deployment) DeepCopy() (*Deployment, error)
DeepCopy returns deep copy of the current Deployment object. Note the deep copy is based on yaml.Marshal and yaml.Unmarshal, hence it is subject to the defined marshalling behavior with custom marshallers and type decorators.
func (Deployment) GetEfiDisk ¶
func (d Deployment) GetEfiDisk() *Disk
GetSystemDisk gets the disk data including the system partition. returns nil if not found
func (Deployment) GetEfiPartition ¶
func (d Deployment) GetEfiPartition() *Partition
GetEfiPartition gets the data of the EFI partition. returns nil if not found
func (Deployment) GetRecoveryPartition ¶
func (d Deployment) GetRecoveryPartition() *Partition
GetRecoveryPartition gets the data of the recovery partition. returns nil if not found
func (Deployment) GetSystemDisk ¶
func (d Deployment) GetSystemDisk() *Disk
GetSystemDisk gets the disk data including the system partition. returns nil if not found
func (Deployment) GetSystemLabel ¶
func (d Deployment) GetSystemLabel() string
GetSystemLabel returns the label of the system partition, returns empty string if no label or system partition defined
func (Deployment) GetSystemPartition ¶
func (d Deployment) GetSystemPartition() *Partition
GetSystemPartition returns the system partition from the disk. returns nil if not found.
func (*Deployment) IsFipsEnabled ¶
func (d *Deployment) IsFipsEnabled() bool
IsFipsEnabled returns true if FIPS is enabled for the deployment, otherwise false.
func (Deployment) RecoveryKernelCmdline ¶
func (d Deployment) RecoveryKernelCmdline() string
RecoveryKernelCmdline returns the base kernel command line for the current deployment
func (*Deployment) Sanitize ¶
func (d *Deployment) Sanitize(s *sys.System, excludeChecks ...SanitizeDeployment) error
Sanitize checks the consistency of the current Disk structure. ExcludeChecks parameter is used to disable any given SanitizeDeployment method. Only public sanitizers can be disabled from other packages.
func (*Deployment) WriteDeploymentFile ¶
func (d *Deployment) WriteDeploymentFile(s *sys.System, root string) error
WriteDeploymentFile serialized the Deployment variable into a file. As part of the serialization it omits runtime information such as device paths, overlay and config script paths.
type Disk ¶
type Disk struct {
Device string `yaml:"target,omitempty"`
Partitions Partitions `yaml:"partitions"`
}
func (Disk) GetSystemPartition ¶
GetSystemPartition returns the system partition from the disk. returns nil if not found.
type FileSystem ¶
type FileSystem int
const ( Btrfs FileSystem = iota + 1 Ext2 Ext4 XFS VFat )
func ParseFileSystem ¶
func ParseFileSystem(f string) (FileSystem, error)
func (FileSystem) MarshalYAML ¶
func (f FileSystem) MarshalYAML() (any, error)
func (FileSystem) String ¶
func (f FileSystem) String() string
func (*FileSystem) UnmarshalYAML ¶
func (f *FileSystem) UnmarshalYAML(data *yaml.Node) (err error)
type FirmwareConfig ¶
type FirmwareConfig struct {
BootEntries []*firmware.EfiBootEntry `yaml:"entries"`
}
type ImageSource ¶
type ImageSource struct {
// contains filtered or unexported fields
}
func NewDirSrc ¶
func NewDirSrc(src string) *ImageSource
func NewEmptySrc ¶
func NewEmptySrc() *ImageSource
func NewOCISrc ¶
func NewOCISrc(src string) *ImageSource
func NewRawSrc ¶
func NewRawSrc(src string) *ImageSource
func NewSrcFromURI ¶
func NewSrcFromURI(uri string) (*ImageSource, error)
func NewTarSrc ¶
func NewTarSrc(src string) *ImageSource
func (ImageSource) GetDigest ¶
func (i ImageSource) GetDigest() string
func (ImageSource) IsDir ¶
func (i ImageSource) IsDir() bool
func (ImageSource) IsEmpty ¶
func (i ImageSource) IsEmpty() bool
func (ImageSource) IsOCI ¶
func (i ImageSource) IsOCI() bool
func (ImageSource) IsRaw ¶
func (i ImageSource) IsRaw() bool
func (ImageSource) IsTar ¶
func (i ImageSource) IsTar() bool
func (ImageSource) MarshalYAML ¶
func (i ImageSource) MarshalYAML() (any, error)
func (*ImageSource) SetDigest ¶
func (i *ImageSource) SetDigest(digest string)
func (ImageSource) String ¶
func (i ImageSource) String() string
func (ImageSource) URI ¶
func (i ImageSource) URI() string
func (*ImageSource) UnmarshalYAML ¶
func (i *ImageSource) UnmarshalYAML(data *yaml.Node) (err error)
type ImageSrcType ¶
type ImageSrcType int
const ( Dir ImageSrcType = iota + 1 OCI Raw Tar )
func ParseSrcImageType ¶
func ParseSrcImageType(i string) (ImageSrcType, error)
func (ImageSrcType) String ¶
func (i ImageSrcType) String() string
type LiveInstaller ¶
type LiveInstaller struct {
OverlayTree *ImageSource `yaml:"overlayTree,omitempty"`
CfgScript string `yaml:"configScript,omitempty"`
KernelCmdline string `yaml:"kernelCmdline,omitempty"`
}
type Opt ¶
type Opt func(d *Deployment)
func WithConfigPartition ¶
WithConfigPartition inserts a configuration partition as the second partition to the systemd disk. The given size is the amount of data expected to store in the partition, then the partition is sized to be alined with 128MiB and to ensure at least 128MiB of free space is available.
func WithPartitions ¶
WithPartitions inserts the given partitions to the default disk at the given position, where 0 is the first partition. Ignores out of range positions.
func WithRecoveryPartition ¶
WithRecoveryPartition inserts a recovery partition as the second partition to the systemd disk. The given size is the amount of data expected to store in the partition, then the partition is sized to be alined with 128MiB and to ensure at least 128MiB of free space is available.
type Partition ¶
type Partition struct {
Label string `yaml:"label,omitempty"`
FileSystem FileSystem `yaml:"fileSystem,omitempty"`
Size MiB `yaml:"size,omitempty"`
Role PartRole `yaml:"role"`
MountPoint string `yaml:"mountPoint,omitempty"`
MountOpts []string `yaml:"mountOpts,omitempty"`
RWVolumes RWVolumes `yaml:"rwVolumes,omitempty"`
UUID string `yaml:"uuid,omitempty"`
Hidden bool `yaml:"hidden,omitempty"`
}
type Partitions ¶
type Partitions []*Partition
func (Partitions) GetSnapshottedVolumes ¶
func (p Partitions) GetSnapshottedVolumes() RWVolumes
GetSnapshottedVolumes returns a list of snapshotted rw volumes defined in the given partitions list.
type SanitizeDeployment ¶
type SanitizeDeployment func(*sys.System, *Deployment) error
type SecurityConfig ¶
type SnapshotterConfig ¶
type SnapshotterConfig struct {
Name string `yaml:"name"`
}