mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-20 22:21:13 +02:00
Firecracker launches tries to open VM disk image before every boot, parses partition table, finds boot partition, tries to read it as FAT32 filesystem, extracts uncompressed kernel from `bzImage` (firecracker doesn't support `bzImage` yet), extracts initramfs and passes it to firecracker binary. This flow allows for extended tests, e.g. testing installer, upgrade and downgrade tests, etc. Bootloader emulation is disabled by default for now, can be enabled via `--with-bootloader-emulation` flag to `osctl cluster create`. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
80 lines
1.7 KiB
Go
80 lines
1.7 KiB
Go
// This Source Code Form is subject to the terms of the Mozilla Public
|
|
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
package provision
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
|
|
"github.com/talos-systems/talos/cmd/osctl/pkg/client"
|
|
"github.com/talos-systems/talos/cmd/osctl/pkg/client/config"
|
|
)
|
|
|
|
// Option controls Provisioner.
|
|
type Option func(o *Options) error
|
|
|
|
// WithLogWriter sets logging destination.
|
|
func WithLogWriter(w io.Writer) Option {
|
|
return func(o *Options) error {
|
|
o.LogWriter = w
|
|
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithEndpoint specifies endpoint to use when acessing Talos cluster.
|
|
func WithEndpoint(endpoint string) Option {
|
|
return func(o *Options) error {
|
|
o.ForceEndpoint = endpoint
|
|
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithTalosConfig specifies talosconfig to use when acessing Talos cluster.
|
|
func WithTalosConfig(talosConfig *config.Config) Option {
|
|
return func(o *Options) error {
|
|
o.TalosConfig = talosConfig
|
|
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithTalosClient specifies client to use when acessing Talos cluster.
|
|
func WithTalosClient(client *client.Client) Option {
|
|
return func(o *Options) error {
|
|
o.TalosClient = client
|
|
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// WithBootladerEmulation enables bootloader emulation.
|
|
func WithBootladerEmulation() Option {
|
|
return func(o *Options) error {
|
|
o.BootloaderEmulation = true
|
|
|
|
return nil
|
|
}
|
|
}
|
|
|
|
// Options describes Provisioner parameters.
|
|
type Options struct {
|
|
LogWriter io.Writer
|
|
TalosConfig *config.Config
|
|
TalosClient *client.Client
|
|
ForceEndpoint string
|
|
|
|
// Enable bootloader by booting from disk image assets.
|
|
BootloaderEmulation bool
|
|
}
|
|
|
|
// DefaultOptions returns default options.
|
|
func DefaultOptions() Options {
|
|
return Options{
|
|
LogWriter: os.Stderr,
|
|
}
|
|
}
|