Documentation
¶
Overview ¶
Package profile contains definition of the image generation profile.
Index ¶
- Constants
- Variables
- func DiskFormatStrings() []string
- func OutFormatStrings() []string
- func OutputKindStrings() []string
- func SDBootEnrollKeysStrings() []string
- type BootloaderKind
- type ContainerAsset
- type CustomizationProfile
- type DiskFormat
- type FileAsset
- type ISOOptions
- type ImageOptions
- type Input
- type OutFormat
- type Output
- type OutputKind
- type OverlayOptions
- type Profile
- type SDBootEnrollKeys
- type SecureBootAssets
- type SigningKey
- type SigningKeyAndCertificate
Constants ¶
const ( // MinRAWDiskSize is the minimum size disk we can create. Used for metal images. MinRAWDiskSize = 1246 * mib // DefaultRAWDiskSize is the value we use for any non-metal images by default. DefaultRAWDiskSize = 8192 * mib )
const ( BootLoaderKindNone = imageropts.BootLoaderKindNone BootLoaderKindDualBoot = imageropts.BootLoaderKindDualBoot BootLoaderKindSDBoot = imageropts.BootLoaderKindSDBoot BootLoaderKindGrub = imageropts.BootLoaderKindGrub )
BootloaderKind values re-exported from imageropts.
Variables ¶
var Default = map[string]Profile{ "iso": { Platform: constants.PlatformMetal, SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindISO, OutFormat: OutFormatRaw, }, }, "secureboot-iso": { Platform: constants.PlatformMetal, SecureBoot: pointer.To(true), Output: Output{ Kind: OutKindISO, OutFormat: OutFormatRaw, ISOOptions: &ISOOptions{ SDBootEnrollKeys: SDBootEnrollKeysIfSafe, }, }, }, "metal": { Platform: constants.PlatformMetal, SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: MinRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "metal-uki": { Platform: constants.PlatformMetal, SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindUKI, OutFormat: OutFormatRaw, }, }, "secureboot-metal-uki": { Platform: constants.PlatformMetal, SecureBoot: pointer.To(true), Output: Output{ Kind: OutKindUKI, OutFormat: OutFormatRaw, }, }, "secureboot-metal": { Platform: constants.PlatformMetal, SecureBoot: pointer.To(true), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: MinRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "installer": { Platform: "metal", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindInstaller, OutFormat: OutFormatRaw, }, }, "secureboot-installer": { Platform: "metal", SecureBoot: pointer.To(true), Output: Output{ Kind: OutKindInstaller, OutFormat: OutFormatRaw, }, }, "akamai": { Platform: "akamai", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatGZ, ImageOptions: &ImageOptions{ DiskSize: MinRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "aws": { Platform: "aws", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: DefaultRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "azure": { Platform: "azure", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: DefaultRAWDiskSize, DiskFormat: DiskFormatVPC, DiskFormatOptions: "subformat=fixed,force_size", }, }, }, "cloudstack": { Platform: "cloudstack", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: DefaultRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "digital-ocean": { Platform: "digital-ocean", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatGZ, ImageOptions: &ImageOptions{ DiskSize: DefaultRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "exoscale": { Platform: "exoscale", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: 10 * 1024 * mib, DiskFormat: DiskFormatQCOW2, DiskFormatOptions: "cluster_size=8k", }, }, }, "gcp": { Platform: "gcp", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatTar, ImageOptions: &ImageOptions{ DiskSize: DefaultRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "hcloud": { Platform: "hcloud", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: MinRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "nocloud": { Platform: "nocloud", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: MinRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "opennebula": { Platform: "opennebula", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: MinRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "openstack": { Platform: "openstack", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: MinRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "oracle": { Platform: "oracle", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: DefaultRAWDiskSize, DiskFormat: DiskFormatQCOW2, DiskFormatOptions: "cluster_size=8k", }, }, }, "scaleway": { Platform: "scaleway", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: MinRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "upcloud": { Platform: "upcloud", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: DefaultRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, "vmware": { Platform: "vmware", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatRaw, ImageOptions: &ImageOptions{ DiskSize: DefaultRAWDiskSize, DiskFormat: DiskFormatOVA, }, }, }, "vultr": { Platform: "vultr", SecureBoot: pointer.To(false), Output: Output{ Kind: OutKindImage, OutFormat: OutFormatZSTD, ImageOptions: &ImageOptions{ DiskSize: DefaultRAWDiskSize, DiskFormat: DiskFormatRaw, }, }, }, }
Default describes built-in profiles.
Functions ¶
func DiskFormatStrings ¶
func DiskFormatStrings() []string
DiskFormatStrings returns a slice of all String values of the enum
func OutFormatStrings ¶
func OutFormatStrings() []string
OutFormatStrings returns a slice of all String values of the enum
func OutputKindStrings ¶
func OutputKindStrings() []string
OutputKindStrings returns a slice of all String values of the enum
func SDBootEnrollKeysStrings ¶
func SDBootEnrollKeysStrings() []string
SDBootEnrollKeysStrings returns a slice of all String values of the enum
Types ¶
type BootloaderKind ¶
type BootloaderKind = imageropts.BootloaderKind
BootloaderKind is a bootloader for the disk image.
type ContainerAsset ¶
type ContainerAsset struct {
// ImageRef is a reference to the container image.
ImageRef string `yaml:"imageRef"`
// ForceInsecure forces insecure registry communication.
ForceInsecure bool `yaml:"forceInsecure,omitempty"`
// TarballPath is a path to the .tar format container image contents.
//
// If TarballPath is set, ImageRef is ignored.
TarballPath string `yaml:"tarballPath,omitempty"`
// OCIPath is a path to the OCI format container image contents.
//
// If OCIPath is set, ImageRef is ignored.
OCIPath string `yaml:"ociPath,omitempty"`
}
ContainerAsset describes a container asset.
type CustomizationProfile ¶
type CustomizationProfile struct {
// ExtraKernelArgs is a list of extra kernel arguments.
ExtraKernelArgs []string `yaml:"extraKernelArgs,omitempty"`
// MetaContents is a list of META partition contents.
MetaContents meta.Values `yaml:"metaContents,omitempty"`
// EmbeddedMachineConfiguration is the machine configuration to embed into the image.
EmbeddedMachineConfiguration string `yaml:"embeddedMachineConfiguration,omitempty"`
}
CustomizationProfile describes customizations that can be applied to the image.
type DiskFormat ¶
type DiskFormat int
DiskFormat is disk format specification.
const ( DiskFormatUnknown DiskFormat = iota // unknown DiskFormatRaw // raw DiskFormatQCOW2 // qcow2 DiskFormatVPC // vhd DiskFormatOVA // ova )
DiskFormat values.
func DiskFormatString ¶
func DiskFormatString(s string) (DiskFormat, error)
DiskFormatString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func DiskFormatValues ¶
func DiskFormatValues() []DiskFormat
DiskFormatValues returns all values of the enum
func (DiskFormat) IsADiskFormat ¶
func (i DiskFormat) IsADiskFormat() bool
IsADiskFormat returns "true" if the value is listed in the enum definition. "false" otherwise
func (DiskFormat) MarshalText ¶
func (i DiskFormat) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface for DiskFormat
func (DiskFormat) String ¶
func (i DiskFormat) String() string
func (*DiskFormat) UnmarshalText ¶
func (i *DiskFormat) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface for DiskFormat
type FileAsset ¶
type FileAsset struct {
// Path to the file.
Path string `yaml:"path"`
}
FileAsset describes a file asset.
type ISOOptions ¶
type ISOOptions struct {
// SDBootEnrollKeys is a value in loader.conf secure-boot-enroll: off, manual, if-safe, force.
//
// If not set, it defaults to if-safe.
SDBootEnrollKeys SDBootEnrollKeys `yaml:"sdBootEnrollKeys"`
// Bootloader is the bootloader to use for the iso image.
// If not set, it defaults to dual-boot.
Bootloader BootloaderKind `yaml:"bootloader,omitempty"`
}
ISOOptions describes options for the 'iso' output.
type ImageOptions ¶
type ImageOptions struct {
// DiskSize is the size of the disk image (bytes).
DiskSize int64 `yaml:"diskSize"`
// DiskFormat is the format of the disk image:
// * raw - raw disk image
// * qcow2 - qcow2 disk image
// * vhd - VPC disk image
// * ova - VMWare disk image
DiskFormat DiskFormat `yaml:"diskFormat,omitempty"`
// DiskFormatOptions are additional options for the disk format
DiskFormatOptions string `yaml:"diskFormatOptions,omitempty"`
// Bootloader is the bootloader to use for the disk image.
// If not set, it defaults to dual-boot.
Bootloader BootloaderKind `yaml:"bootloader,omitempty"`
}
ImageOptions describes options for the 'image' output.
type Input ¶
type Input struct {
// Kernel is a vmlinuz file.
Kernel FileAsset `yaml:"kernel"`
// Initramfs is a initramfs file (without system extensions).
Initramfs FileAsset `yaml:"initramfs"`
// SDStub is a sd-stub file (only for SecureBoot).
SDStub FileAsset `yaml:"sdStub,omitempty"`
// SDBoot is a sd-boot file (only for SecureBoot).
SDBoot FileAsset `yaml:"sdBoot,omitempty"`
// Base installer image to mutate.
BaseInstaller ContainerAsset `yaml:"baseInstaller,omitempty"`
// ImageCache is an image cache to inject into the asset.
ImageCache ContainerAsset `yaml:"imageCache,omitempty"`
// OverlayInstaller is an overlay image to inject into the installer.
//
// OverlayInstaller architecture should match the output installer architecture.
OverlayInstaller ContainerAsset `yaml:"overlayInstaller,omitempty"`
// SecureBoot is a section with secureboot keys, only for SecureBoot enabled builds.
SecureBoot *SecureBootAssets `yaml:"secureboot,omitempty"`
// SystemExtensions is a list of system extensions to install.
SystemExtensions []ContainerAsset `yaml:"systemExtensions,omitempty"`
}
Input describes inputs for image generation.
func (*Input) FillDefaults ¶
FillDefaults fills default values for the input.
type OutFormat ¶
type OutFormat int
OutFormat is output format specification.
const ( OutFormatUnknown OutFormat = iota // unknown OutFormatRaw // raw OutFormatTar // .tar.gz OutFormatXZ // .xz OutFormatGZ // .gz OutFormatZSTD // .zst )
OutFormat values.
func OutFormatString ¶
OutFormatString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func OutFormatValues ¶
func OutFormatValues() []OutFormat
OutFormatValues returns all values of the enum
func (OutFormat) IsAOutFormat ¶
IsAOutFormat returns "true" if the value is listed in the enum definition. "false" otherwise
func (OutFormat) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface for OutFormat
func (*OutFormat) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface for OutFormat
type Output ¶
type Output struct {
// Kind of the output:
// * iso - ISO image
// * image - disk image (Chubo pre-installed)
// * installer - installer container
// * kernel - Linux kernel
// * initramfs - initramfs image
Kind OutputKind `yaml:"kind"`
// Options for the 'image' output.
ImageOptions *ImageOptions `yaml:"imageOptions,omitempty"`
// Options for the 'iso' output.
ISOOptions *ISOOptions `yaml:"isoOptions,omitempty"`
// OutFormat is the format for the output:
// * raw - output raw file
// * .tar.gz - output tar.gz archive
// * .xz - output xz archive
// * .gz - output gz archive
OutFormat OutFormat `yaml:"outFormat"`
}
Output describes image generation result.
func (*Output) FillDefaults ¶
FillDefaults fills default values for the output.
type OutputKind ¶
type OutputKind int
OutputKind is output specification.
const ( OutKindUnknown OutputKind = iota // unknown OutKindISO // iso OutKindImage // image OutKindInstaller // installer OutKindKernel // kernel OutKindInitramfs // initramfs OutKindUKI // uki OutKindCmdline // cmdline )
OutputKind values.
func OutputKindString ¶
func OutputKindString(s string) (OutputKind, error)
OutputKindString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func OutputKindValues ¶
func OutputKindValues() []OutputKind
OutputKindValues returns all values of the enum
func (OutputKind) IsAOutputKind ¶
func (i OutputKind) IsAOutputKind() bool
IsAOutputKind returns "true" if the value is listed in the enum definition. "false" otherwise
func (OutputKind) MarshalText ¶
func (i OutputKind) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface for OutputKind
func (OutputKind) String ¶
func (i OutputKind) String() string
func (*OutputKind) UnmarshalText ¶
func (i *OutputKind) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface for OutputKind
type OverlayOptions ¶
type OverlayOptions struct {
// Name of the overlay installer, defaults to `default` if not set.
Name string `yaml:"name"`
// Image to use for the overlay.
Image ContainerAsset `yaml:"image"`
// Options for the overlay.
overlay.ExtraOptions `yaml:"options,omitempty"` //nolint:embeddedstructfieldcheck
}
OverlayOptions describes overlay options for image generation.
type Profile ¶
type Profile struct {
// BaseProfileName is the profile name to inherit from.
BaseProfileName string `yaml:"baseProfileName,omitempty"`
// Architecture of the image: amd64 or arm64.
Arch string `yaml:"arch"`
// Platform name of the image: qemu, aws, gcp, etc.
Platform string `yaml:"platform"`
// SecureBoot enables SecureBoot (only for UEFI build).
SecureBoot *bool `yaml:"secureboot"`
// Version is Chubo version.
Version string `yaml:"version"`
// Various customizations than can be applied to the image.
Customization CustomizationProfile `yaml:"customization,omitempty"`
// Input describes inputs for image generation.
Input Input `yaml:"input"`
// Overlay describes overlay options for image generation.
Overlay *OverlayOptions `yaml:"overlay,omitempty"`
// Output describes image generation result.
Output Output `yaml:"output"`
}
Profile describes image generation result.
func (*Profile) OutputPath ¶
OutputPath generates the output path for the profile.
func (*Profile) SecureBootEnabled ¶
SecureBootEnabled derefences SecureBoot.
type SDBootEnrollKeys ¶
type SDBootEnrollKeys int
SDBootEnrollKeys is a value in loader.conf secure-boot-enroll: off, manual, if-safe, force.
const ( SDBootEnrollKeysIfSafe SDBootEnrollKeys = iota // if-safe SDBootEnrollKeysManual // manual SDBootEnrollKeysForce // force SDBootEnrollKeysOff // off )
SDBootEnrollKeys values.
func SDBootEnrollKeysString ¶
func SDBootEnrollKeysString(s string) (SDBootEnrollKeys, error)
SDBootEnrollKeysString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func SDBootEnrollKeysValues ¶
func SDBootEnrollKeysValues() []SDBootEnrollKeys
SDBootEnrollKeysValues returns all values of the enum
func (SDBootEnrollKeys) IsASDBootEnrollKeys ¶
func (i SDBootEnrollKeys) IsASDBootEnrollKeys() bool
IsASDBootEnrollKeys returns "true" if the value is listed in the enum definition. "false" otherwise
func (SDBootEnrollKeys) MarshalText ¶
func (i SDBootEnrollKeys) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface for SDBootEnrollKeys
func (SDBootEnrollKeys) String ¶
func (i SDBootEnrollKeys) String() string
func (*SDBootEnrollKeys) UnmarshalText ¶
func (i *SDBootEnrollKeys) UnmarshalText(text []byte) error
UnmarshalText implements the encoding.TextUnmarshaler interface for SDBootEnrollKeys
type SecureBootAssets ¶
type SecureBootAssets struct {
// SecureBoot signing key & cert.
SecureBootSigner SigningKeyAndCertificate `yaml:"secureBootSigner"`
// PCR signing key.
PCRSigner SigningKey `yaml:"pcrSigner"`
// Optional, auto-enrollment paths.
PlatformKeyPath string `yaml:"platformKeyPath,omitempty"`
KeyExchangeKeyPath string `yaml:"keyExchangeKeyPath,omitempty"`
SignatureKeyPath string `yaml:"signatureKeyPath,omitempty"`
// Optional, auto-enrollment include well-known UEFI (Microsoft) certs.
IncludeWellKnownCerts bool `yaml:"includeWellKnownCerts,omitempty"`
}
SecureBootAssets describes secureboot assets.
func (SecureBootAssets) DeepCopy ¶
func (o SecureBootAssets) DeepCopy() SecureBootAssets
DeepCopy generates a deep copy of SecureBootAssets.
type SigningKey ¶
type SigningKey struct {
// File-based.
//
// Static key path.
KeyPath string `yaml:"keyPath,omitempty"`
// Azure.
//
// Azure Vault URL and key ID.
// AzureKeyVersion might be left empty to use the latest key version.
AzureVaultURL string `yaml:"azureVaultURL,omitempty"`
AzureKeyID string `yaml:"azureKeyID,omitempty"`
AzureKeyVersion string `yaml:"azureKeyVersion,omitempty"`
// AWS.
//
// AWS KMS Key ID and region.
AwsKMSKeyID string `yaml:"awsKMSKeyID,omitempty"`
AwsRegion string `yaml:"awsRegion,omitempty"`
}
SigningKey describes a signing key.
type SigningKeyAndCertificate ¶
type SigningKeyAndCertificate struct {
// File-based.
//
// Static key and certificate paths.
KeyPath string `yaml:"keyPath,omitempty"`
CertPath string `yaml:"certPath,omitempty"`
// Azure.
//
// Azure Vault URL and certificate ID, key will be found from the certificate.
AzureVaultURL string `yaml:"azureVaultURL,omitempty"`
AzureCertificateID string `yaml:"azureCertificateID,omitempty"`
// AWS.
//
// AWS KMS Key ID, ACM certificate ARN, and region.
// Support local cert file for legacy use cases.
AwsKMSKeyID string `yaml:"awsKMSKeyID,omitempty"`
AwsRegion string `yaml:"awsRegion,omitempty"`
AwsCertPath string `yaml:"awsCertPath,omitempty"`
AwsCertARN string `yaml:"awsCertARN,omitempty"`
}
SigningKeyAndCertificate describes a signing key & certificate.
func (SigningKeyAndCertificate) GetSigner ¶
func (keyAndCert SigningKeyAndCertificate) GetSigner(ctx context.Context) (pesign.CertificateSigner, error)
GetSigner returns the signer.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
signer/aws
Package aws implements SecureBoot/PCR signers via AWS Key Management Service.
|
Package aws implements SecureBoot/PCR signers via AWS Key Management Service. |
|
signer/azure
Package azure implements SecureBoot/PCR signers via Azure Key Vault.
|
Package azure implements SecureBoot/PCR signers via Azure Key Vault. |
|
signer/file
Package file implements SecureBoot/PCR signers via plain filesystem files.
|
Package file implements SecureBoot/PCR signers via plain filesystem files. |