Documentation ¶
Index ¶
- Constants
- func AddHeader(header, data string) string
- func BootedFrom(runner v1.Runner, label string) bool
- func DetectPreConfiguredDevice(logger types.KairosLogger) (string, error)
- func FilterKeys(d []byte) ([]byte, error)
- func FromString(s string, o interface{}) error
- func GetSourceSize(config *Config, source *v1.ImageSource) (int64, error)
- func HasHeader(userdata, head string) (bool, string)
- func MergeYAML(objs ...interface{}) ([]byte, error)
- func NewInstallElementalPartitions(log types.KairosLogger, spec *v1.InstallSpec) v1.ElementalPartitions
- func NewInstallSpec(cfg *Config) (*v1.InstallSpec, error)
- func NewResetSpec(cfg *Config) (*v1.ResetSpec, error)
- func NewUkiInstallSpec(cfg *Config) (*v1.InstallUkiSpec, error)
- func NewUkiResetSpec(cfg *Config) (spec *v1.ResetUkiSpec, err error)
- func NewUkiUpgradeSpec(cfg *Config) (*v1.UpgradeUkiSpec, error)
- func NewUpgradeSpec(cfg *Config) (*v1.UpgradeSpec, error)
- func ReadInstallSpecFromConfig(c *Config) (*v1.InstallSpec, error)
- func ReadResetSpecFromConfig(c *Config) (*v1.ResetSpec, error)
- func ReadSpecFromCloudConfig(r *Config, spec string) (v1.Spec, error)
- func ReadUkiInstallSpecFromConfig(c *Config) (*v1.InstallUkiSpec, error)
- func ReadUkiResetSpecFromConfig(c *Config) (*v1.ResetUkiSpec, error)
- func ReadUkiUpgradeSpecFromConfig(c *Config) (*v1.UpgradeUkiSpec, error)
- func ReadUpgradeSpecFromConfig(c *Config) (*v1.UpgradeSpec, error)
- func SaveCloudConfig(name Stage, yc yip.YipConfig) error
- func UnmarshalerHook() mapstructure.DecodeHookFunc
- func WithClient(client v1.HTTPClient) func(r *Config)
- func WithCloudInitRunner(ci v1.CloudInitRunner) func(r *Config)
- func WithFs(fs v1.FS) func(r *Config)
- func WithImageExtractor(extractor v1.ImageExtractor) func(r *Config)
- func WithLogger(logger sdkTypes.KairosLogger) func(r *Config)
- func WithMounter(mounter mount.Interface) func(r *Config)
- func WithPlatform(platform string) func(r *Config)
- func WithRunner(runner v1.Runner) func(r *Config)
- func WithSyscall(syscall v1.SyscallInterface) func(r *Config)
- type Bundle
- type Bundles
- type Config
- type GenericOptions
- type Install
- type Stage
- type Unmarshaler
Constants ¶
const ( DefaultWebUIListenAddress = ":8080" FilePrefix = "file://" )
const ( KiB MiB GiB TiB )
const DefaultHeader = "#cloud-config"
Variables ¶
This section is empty.
Functions ¶
func BootedFrom ¶
BootedFrom will check if we are booting from the given label
func DetectPreConfiguredDevice ¶ added in v2.8.10
func DetectPreConfiguredDevice(logger types.KairosLogger) (string, error)
DetectPreConfiguredDevice returns a disk that has partitions labeled with Kairos labels. It can be used to detect a pre-configured device.
func FilterKeys ¶
FilterKeys is used to pass to any other pkg which might want to see which part of the config matches the Kairos config.
func FromString ¶
func GetSourceSize ¶
func GetSourceSize(config *Config, source *v1.ImageSource) (int64, error)
GetSourceSize will try to gather the actual size of the source Useful to create the exact size of images and by side effect the partition size This helps adjust the size to be juuuuust right. It can still be manually override from the cloud config by setting all values manually But by default it should adjust the sizes properly
func NewInstallElementalPartitions ¶
func NewInstallElementalPartitions(log types.KairosLogger, spec *v1.InstallSpec) v1.ElementalPartitions
func NewInstallSpec ¶
func NewInstallSpec(cfg *Config) (*v1.InstallSpec, error)
NewInstallSpec returns an InstallSpec struct all based on defaults and basic host checks (e.g. EFI vs BIOS)
func NewResetSpec ¶
NewResetSpec returns a ResetSpec struct all based on defaults and current host state
func NewUkiInstallSpec ¶
func NewUkiInstallSpec(cfg *Config) (*v1.InstallUkiSpec, error)
func NewUkiResetSpec ¶ added in v2.7.8
func NewUkiResetSpec(cfg *Config) (spec *v1.ResetUkiSpec, err error)
func NewUkiUpgradeSpec ¶
func NewUkiUpgradeSpec(cfg *Config) (*v1.UpgradeUkiSpec, error)
func NewUpgradeSpec ¶
func NewUpgradeSpec(cfg *Config) (*v1.UpgradeSpec, error)
NewUpgradeSpec returns an UpgradeSpec struct all based on defaults and current host state
func ReadInstallSpecFromConfig ¶
func ReadInstallSpecFromConfig(c *Config) (*v1.InstallSpec, error)
ReadInstallSpecFromConfig will return a proper v1.InstallSpec based on an agent Config
func ReadResetSpecFromConfig ¶
ReadResetSpecFromConfig will return a proper v1.ResetSpec based on an agent Config
func ReadSpecFromCloudConfig ¶
ReadSpecFromCloudConfig returns a v1.Spec for the given spec
func ReadUkiInstallSpecFromConfig ¶
func ReadUkiInstallSpecFromConfig(c *Config) (*v1.InstallUkiSpec, error)
ReadUkiInstallSpecFromConfig will return a proper v1.InstallUkiSpec based on an agent Config
func ReadUkiResetSpecFromConfig ¶
func ReadUkiResetSpecFromConfig(c *Config) (*v1.ResetUkiSpec, error)
ReadUkiResetSpecFromConfig will return a proper v1.ResetUkiSpec based on an agent Config
func ReadUkiUpgradeSpecFromConfig ¶ added in v2.7.13
func ReadUkiUpgradeSpecFromConfig(c *Config) (*v1.UpgradeUkiSpec, error)
ReadUkiUpgradeSpecFromConfig will return a proper v1.UpgradeUkiSpec based on an agent Config
func ReadUpgradeSpecFromConfig ¶
func ReadUpgradeSpecFromConfig(c *Config) (*v1.UpgradeSpec, error)
ReadUpgradeSpecFromConfig will return a proper v1.UpgradeSpec based on an agent Config
func UnmarshalerHook ¶
func UnmarshalerHook() mapstructure.DecodeHookFunc
func WithClient ¶
func WithClient(client v1.HTTPClient) func(r *Config)
func WithCloudInitRunner ¶
func WithCloudInitRunner(ci v1.CloudInitRunner) func(r *Config)
func WithImageExtractor ¶
func WithImageExtractor(extractor v1.ImageExtractor) func(r *Config)
func WithLogger ¶
func WithLogger(logger sdkTypes.KairosLogger) func(r *Config)
func WithMounter ¶
func WithMounter(mounter mount.Interface) func(r *Config)
func WithPlatform ¶
func WithRunner ¶
func WithSyscall ¶
func WithSyscall(syscall v1.SyscallInterface) func(r *Config)
Types ¶
type Bundles ¶
type Bundles []Bundle
func (Bundles) Options ¶
func (b Bundles) Options() (res [][]bundles.BundleOption)
type Config ¶
type Config struct { Install *Install `yaml:"install,omitempty"` collector.Config `yaml:"-"` ConfigURL string `yaml:"config_url,omitempty"` Options map[string]string `yaml:"options,omitempty"` FailOnBundleErrors bool `yaml:"fail_on_bundles_errors,omitempty"` Bundles Bundles `yaml:"bundles,omitempty"` GrubOptions map[string]string `yaml:"grub_options,omitempty"` Env []string `yaml:"env,omitempty"` Debug bool `yaml:"debug,omitempty" mapstructure:"debug"` Strict bool `yaml:"strict,omitempty" mapstructure:"strict"` CloudInitPaths []string `yaml:"cloud-init-paths,omitempty" mapstructure:"cloud-init-paths"` EjectCD bool `yaml:"eject-cd,omitempty" mapstructure:"eject-cd"` Logger sdkTypes.KairosLogger `yaml:"-"` Fs v1.FS `yaml:"-"` Mounter mount.Interface `yaml:"-"` Runner v1.Runner `yaml:"-"` Syscall v1.SyscallInterface `yaml:"-"` CloudInitRunner v1.CloudInitRunner `yaml:"-"` ImageExtractor v1.ImageExtractor `yaml:"-"` Client v1.HTTPClient `yaml:"-"` Platform *v1.Platform `yaml:"-"` Cosign bool `yaml:"cosign,omitempty" mapstructure:"cosign"` Verify bool `yaml:"verify,omitempty" mapstructure:"verify"` CosignPubKey string `yaml:"cosign-key,omitempty" mapstructure:"cosign-key"` Arch string `yaml:"arch,omitempty" mapstructure:"arch"` SquashFsCompressionConfig []string `yaml:"squash-compression,omitempty" mapstructure:"squash-compression"` SquashFsNoCompression bool `yaml:"squash-no-compression,omitempty" mapstructure:"squash-no-compression"` UkiMaxEntries int `yaml:"uki-max-entries,omitempty" mapstructure:"uki-max-entries"` BindPCRs []string `yaml:"bind-pcrs,omitempty" mapstructure:"bind-pcrs"` BindPublicPCRs []string `yaml:"bind-public-pcrs,omitempty" mapstructure:"bind-public-pcrs"` }
func NewConfig ¶
func NewConfig(opts ...GenericOptions) *Config
func Scan ¶
Scan is a wrapper around collector.Scan that sets the logger to the default Kairos logger
func ScanNoLogs ¶ added in v2.8.6
ScanNoLogs is a wrapper around Scan that sets the logger to null Also sets the NoLogs option to true by default
func (Config) CheckForUsers ¶ added in v2.15.2
CheckForUsers will check the config for any users and validate that at least we have 1 admin. Since Kairos 3.3.x we don't ship a default user with the system, so before a system with no specific users was relying in our default cloud-configs which created a kairos user ALWAYS (with SUDO!) But now we don't ship it anymore. So a user upgrading from 3.2.x to 3.3.x that created no users, will end up with a blocked system. So we need to see if they are setting a user in their config and if not refuse to continue
func (Config) HasConfigURL ¶
HasConfigURL returns true if ConfigURL has been set and false if it's empty.
func (Config) LoadInstallState ¶
func (c Config) LoadInstallState() (*v1.InstallState, error)
LoadInstallState loads the state.yaml file and unmarshals it to an InstallState object
func (*Config) Sanitize ¶
Sanitize checks the consistency of the struct, returns error if unsolvable inconsistencies are found
func (Config) WriteInstallState ¶
func (c Config) WriteInstallState(i *v1.InstallState, statePath, recoveryPath string) error
WriteInstallState writes the state.yaml file to the given state and recovery paths
type GenericOptions ¶
type GenericOptions func(a *Config)
type Install ¶
type Install struct { Auto bool `yaml:"auto,omitempty"` Reboot bool `yaml:"reboot,omitempty"` NoFormat bool `yaml:"no-format,omitempty"` Device string `yaml:"device,omitempty"` Poweroff bool `yaml:"poweroff,omitempty"` GrubOptions map[string]string `yaml:"grub_options,omitempty"` Bundles Bundles `yaml:"bundles,omitempty"` Encrypt []string `yaml:"encrypted_partitions,omitempty"` SkipEncryptCopyPlugins bool `yaml:"skip_copy_kcrypt_plugin,omitempty"` Env []string `yaml:"env,omitempty"` Source string `yaml:"source,omitempty"` EphemeralMounts []string `yaml:"ephemeral_mounts,omitempty"` BindMounts []string `yaml:"bind_mounts,omitempty"` Partitions v1.ElementalPartitions `yaml:"partitions,omitempty" mapstructure:"partitions"` Active v1.Image `yaml:"system,omitempty" mapstructure:"system"` Recovery v1.Image `yaml:"recovery-system,omitempty" mapstructure:"recovery-system"` Passive v1.Image `yaml:"passive,omitempty" mapstructure:"recovery-system"` GrubDefEntry string `yaml:"grub-entry-name,omitempty" mapstructure:"grub-entry-name"` ExtraPartitions sdkTypes.PartitionList `yaml:"extra-partitions,omitempty" mapstructure:"extra-partitions"` ExtraDirsRootfs []string `yaml:"extra-dirs-rootfs,omitempty" mapstructure:"extra-dirs-rootfs"` Force bool `yaml:"force,omitempty" mapstructure:"force"` NoUsers bool `yaml:"nousers,omitempty" mapstructure:"nousers"` }