talos/internal/pkg/install/options.go
Andrew Rynhard 69fa63a7b2 refactor: perform upgrade upon reboot
This PR introduces a new strategy for upgrades. Instead of attempting to
zap the partition table, create a new one, and then format the
partitions, this change will only update the `vmlinuz`, and
`initramfs.xz` being used to boot. It introduces an A/B style upgrade
process, which will allow for easy rollbacks. One deviation from our
original intention with upgrades is that this change does not completely
reset a node. It falls just short of that and does not reset the
partition table. This forces us to keep the current partition scheme in
mind as we make changes in the future, because an upgrade assumes a
specific partition scheme. We can improve upgrades further in the
future, but this will at least make them more dependable. Finally, one
more feature in this PR is the ability to keep state. This enables
single node clusters to upgrade since we keep the etcd data around.

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
2020-03-20 17:32:18 -07:00

41 lines
926 B
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 install
// Option controls generate options specific to input generation.
type Option func(o *Options) error
// WithImagePull disables pulling the installer image during an install
func WithImagePull(b bool) Option {
return func(o *Options) error {
o.ImagePull = b
return nil
}
}
// WithPreserve disables pulling the installer image during an install
func WithPreserve(b bool) Option {
return func(o *Options) error {
o.Preserve = b
return nil
}
}
// Options describes generate parameters.
type Options struct {
ImagePull bool
Preserve bool
}
// DefaultInstallOptions returns default options.
func DefaultInstallOptions() Options {
return Options{
ImagePull: true,
Preserve: false,
}
}