phase

package
v0.17.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 36 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Colorize = aurora.NewAurora(false)

Colorize is an instance of "aurora", used to colorize the output

View Source
var Force bool

Force is used by various phases to attempt a forced installation

View Source
var NoWait bool

NoWait is used by various phases to decide if node ready state should be waited for or not

Functions

This section is empty.

Types

type Backup added in v0.8.5

type Backup struct {
	GenericPhase
	// contains filtered or unexported fields
}

Backup connect to one of the controllers and takes a backup

func (*Backup) Prepare added in v0.8.5

func (p *Backup) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*Backup) Run added in v0.8.5

func (p *Backup) Run() error

Run the phase

func (*Backup) ShouldRun added in v0.8.5

func (p *Backup) ShouldRun() bool

ShouldRun is true when there is a leader host

func (*Backup) Title added in v0.8.5

func (p *Backup) Title() string

Title returns the title for the phase

type ConfigureK0s

type ConfigureK0s struct {
	GenericPhase
	// contains filtered or unexported fields
}

ConfigureK0s writes the k0s configuration to host k0s config dir

func (*ConfigureK0s) DryRun added in v0.17.0

func (p *ConfigureK0s) DryRun() error

DryRun prints the actions that would be taken

func (*ConfigureK0s) Prepare added in v0.13.0

func (p *ConfigureK0s) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*ConfigureK0s) Run

func (p *ConfigureK0s) Run() error

Run the phase

func (*ConfigureK0s) ShouldRun added in v0.17.0

func (p *ConfigureK0s) ShouldRun() bool

ShouldRun is true when there are controllers to configure

func (*ConfigureK0s) Title

func (p *ConfigureK0s) Title() string

Title returns the phase title

type Connect

type Connect struct {
	GenericPhase
}

Connect connects to each of the hosts

func (*Connect) Run

func (p *Connect) Run() error

Run the phase

func (*Connect) Title

func (p *Connect) Title() string

Title for the phase

type DefaultK0sVersion added in v0.17.0

type DefaultK0sVersion struct {
	GenericPhase
}

func (*DefaultK0sVersion) Run added in v0.17.0

func (p *DefaultK0sVersion) Run() error

func (*DefaultK0sVersion) ShouldRun added in v0.17.0

func (p *DefaultK0sVersion) ShouldRun() bool

func (*DefaultK0sVersion) Title added in v0.17.0

func (p *DefaultK0sVersion) Title() string

type DetectOS

type DetectOS struct {
	GenericPhase
}

DetectOS performs remote OS detection

func (*DetectOS) Run

func (p *DetectOS) Run() error

Run the phase

func (*DetectOS) Title

func (p *DetectOS) Title() string

Title for the phase

type Disconnect

type Disconnect struct {
	GenericPhase
}

Disconnect disconnects from the hosts

func (*Disconnect) DryRun added in v0.17.0

func (p *Disconnect) DryRun() error

DryRun cleans up the temporary k0s binary from the hosts

func (*Disconnect) Run

func (p *Disconnect) Run() error

Run the phase

func (*Disconnect) Title

func (p *Disconnect) Title() string

Title for the phase

type DownloadBinaries

type DownloadBinaries struct {
	GenericPhase
	// contains filtered or unexported fields
}

DownloadBinaries downloads k0s binaries to localohost temp files

func (*DownloadBinaries) Prepare

func (p *DownloadBinaries) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*DownloadBinaries) Run

func (p *DownloadBinaries) Run() error

Run the phase

func (*DownloadBinaries) ShouldRun

func (p *DownloadBinaries) ShouldRun() bool

ShouldRun is true when the phase should be run

func (*DownloadBinaries) Title

func (p *DownloadBinaries) Title() string

Title for the phase

type DownloadK0s

type DownloadK0s struct {
	GenericPhase
	// contains filtered or unexported fields
}

DownloadK0s performs k0s online download on the hosts

func (*DownloadK0s) Prepare

func (p *DownloadK0s) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*DownloadK0s) Run

func (p *DownloadK0s) Run() error

Run the phase

func (*DownloadK0s) ShouldRun

func (p *DownloadK0s) ShouldRun() bool

ShouldRun is true when the phase should be run

func (*DownloadK0s) Title

func (p *DownloadK0s) Title() string

Title for the phase

type GatherFacts

type GatherFacts struct {
	GenericPhase
}

GatherFacts gathers information about hosts, such as if k0s is already up and running

func (*GatherFacts) Run

func (p *GatherFacts) Run() error

Run the phase

func (*GatherFacts) Title

func (p *GatherFacts) Title() string

Title for the phase

type GatherK0sFacts

type GatherK0sFacts struct {
	GenericPhase
	// contains filtered or unexported fields
}

GatherK0sFacts gathers information about hosts, such as if k0s is already up and running

func (*GatherK0sFacts) Prepare added in v0.17.0

func (p *GatherK0sFacts) Prepare(config *v1beta1.Cluster) error

Prepare finds hosts with k0s installed

func (*GatherK0sFacts) Run

func (p *GatherK0sFacts) Run() error

Run the phase

func (*GatherK0sFacts) ShouldRun added in v0.17.0

func (p *GatherK0sFacts) ShouldRun() bool

ShouldRun is true when there are hosts that need to be connected

func (*GatherK0sFacts) Title

func (p *GatherK0sFacts) Title() string

Title for the phase

type GenericPhase

type GenericPhase struct {
	analytics.Phase
	Config *v1beta1.Cluster
	// contains filtered or unexported fields
}

GenericPhase is a basic phase which gets a config via prepare, sets it into p.Config

func (*GenericPhase) DryMsg added in v0.17.0

func (p *GenericPhase) DryMsg(host fmt.Stringer, msg string)

DryMsg is a shorthand for manager.DryMsg

func (*GenericPhase) DryMsgf added in v0.17.0

func (p *GenericPhase) DryMsgf(host fmt.Stringer, msg string, args ...any)

DryMsgf is a shorthand for manager.DryMsg + fmt.Sprintf

func (*GenericPhase) GetConfig

func (p *GenericPhase) GetConfig() *v1beta1.Cluster

GetConfig is an accessor to phase Config

func (*GenericPhase) IsWet added in v0.17.0

func (p *GenericPhase) IsWet() bool

IsWet returns true if manager is in dry-run mode

func (*GenericPhase) Prepare

func (p *GenericPhase) Prepare(c *v1beta1.Cluster) error

Prepare the phase

func (*GenericPhase) SetManager added in v0.15.0

func (p *GenericPhase) SetManager(m *Manager)

SetManager adds a reference to the phase manager

func (*GenericPhase) Wet added in v0.17.0

func (p *GenericPhase) Wet(host fmt.Stringer, msg string, funcs ...errorfunc) error

Wet is a shorthand for manager.Wet

type GetKubeconfig

type GetKubeconfig struct {
	GenericPhase
	APIAddress string
}

GetKubeconfig is a phase to get and dump the admin kubeconfig

func (*GetKubeconfig) DryRun added in v0.17.0

func (p *GetKubeconfig) DryRun() error

func (*GetKubeconfig) Run

func (p *GetKubeconfig) Run() error

Run the phase

func (*GetKubeconfig) Title

func (p *GetKubeconfig) Title() string

Title for the phase

type InitializeK0s

type InitializeK0s struct {
	GenericPhase
	// contains filtered or unexported fields
}

InitializeK0s sets up the "initial" k0s controller

func (*InitializeK0s) CleanUp added in v0.10.0

func (p *InitializeK0s) CleanUp()

CleanUp cleans up the environment override file

func (*InitializeK0s) Prepare

func (p *InitializeK0s) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*InitializeK0s) Run

func (p *InitializeK0s) Run() error

Run the phase

func (*InitializeK0s) ShouldRun

func (p *InitializeK0s) ShouldRun() bool

ShouldRun is true when there is a leader host

func (*InitializeK0s) Title

func (p *InitializeK0s) Title() string

Title for the phase

type InstallBinaries added in v0.15.1

type InstallBinaries struct {
	GenericPhase
	// contains filtered or unexported fields
}

InstallBinaries installs the k0s binaries from the temp location of UploadBinaries or InstallBinaries

func (*InstallBinaries) CleanUp added in v0.15.1

func (p *InstallBinaries) CleanUp()

func (*InstallBinaries) DryRun added in v0.17.0

func (p *InstallBinaries) DryRun() error

DryRun reports what would happen if Run is called.

func (*InstallBinaries) Prepare added in v0.15.1

func (p *InstallBinaries) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*InstallBinaries) Run added in v0.15.1

func (p *InstallBinaries) Run() error

Run the phase

func (*InstallBinaries) ShouldRun added in v0.15.1

func (p *InstallBinaries) ShouldRun() bool

ShouldRun is true when the phase should be run

func (*InstallBinaries) Title added in v0.15.1

func (p *InstallBinaries) Title() string

Title for the phase

type InstallControllers

type InstallControllers struct {
	GenericPhase
	// contains filtered or unexported fields
}

InstallControllers installs k0s controllers and joins them to the cluster

func (*InstallControllers) After added in v0.17.0

func (p *InstallControllers) After() error

func (*InstallControllers) CleanUp added in v0.10.0

func (p *InstallControllers) CleanUp()

CleanUp cleans up the environment override files on hosts

func (*InstallControllers) Prepare

func (p *InstallControllers) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*InstallControllers) Run

func (p *InstallControllers) Run() error

Run the phase

func (*InstallControllers) ShouldRun

func (p *InstallControllers) ShouldRun() bool

ShouldRun is true when there are controllers

func (*InstallControllers) Title

func (p *InstallControllers) Title() string

Title for the phase

type InstallWorkers

type InstallWorkers struct {
	GenericPhase
	// contains filtered or unexported fields
}

InstallWorkers installs k0s on worker hosts and joins them to the cluster

func (*InstallWorkers) After added in v0.17.0

func (p *InstallWorkers) After() error

func (*InstallWorkers) CleanUp added in v0.10.0

func (p *InstallWorkers) CleanUp()

CleanUp attempts to clean up any changes after a failed install

func (*InstallWorkers) Prepare

func (p *InstallWorkers) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*InstallWorkers) Run

func (p *InstallWorkers) Run() error

Run the phase

func (*InstallWorkers) ShouldRun

func (p *InstallWorkers) ShouldRun() bool

ShouldRun is true when there are workers

func (*InstallWorkers) Title

func (p *InstallWorkers) Title() string

Title for the phase

type Lock added in v0.13.0

type Lock struct {
	GenericPhase
	// contains filtered or unexported fields
}

Lock acquires an exclusive k0sctl lock on hosts

func (*Lock) Cancel added in v0.13.0

func (p *Lock) Cancel()

Cancel releases the lock

func (*Lock) CleanUp added in v0.15.5

func (p *Lock) CleanUp()

CleanUp calls Cancel to release the lock

func (*Lock) Prepare added in v0.13.0

func (p *Lock) Prepare(c *v1beta1.Cluster) error

Prepare the phase

func (*Lock) Run added in v0.13.0

func (p *Lock) Run() error

Run the phase

func (*Lock) Title added in v0.13.0

func (p *Lock) Title() string

Title for the phase

type Manager

type Manager struct {
	Config            *v1beta1.Cluster
	Concurrency       int
	ConcurrentUploads int
	DryRun            bool
	// contains filtered or unexported fields
}

Manager executes phases to construct the cluster

func NewManager added in v0.16.0

func NewManager(config *v1beta1.Cluster) (*Manager, error)

NewManager creates a new Manager

func (*Manager) AddPhase

func (m *Manager) AddPhase(p ...phase)

AddPhase adds a Phase to Manager

func (*Manager) DryMsg added in v0.17.0

func (m *Manager) DryMsg(host fmt.Stringer, msg string)

DryMsg prints a message in dry-run mode

func (*Manager) Run

func (m *Manager) Run() error

Run executes all the added Phases in order

func (*Manager) Wet added in v0.17.0

func (m *Manager) Wet(host fmt.Stringer, msg string, funcs ...errorfunc) error

Wet runs the first given function when not in dry-run mode. The second function will be run when in dry-mode and the message will be displayed. Any error returned from the functions will be returned and will halt the operation.

type PrepareArm added in v0.10.0

type PrepareArm struct {
	GenericPhase
	// contains filtered or unexported fields
}

PrepareArm implements a phase which fixes arm quirks

func (*PrepareArm) Prepare added in v0.10.0

func (p *PrepareArm) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*PrepareArm) Run added in v0.10.0

func (p *PrepareArm) Run() error

Run the phase

func (*PrepareArm) ShouldRun added in v0.10.0

func (p *PrepareArm) ShouldRun() bool

ShouldRun is true when there are arm controllers

func (*PrepareArm) Title added in v0.10.0

func (p *PrepareArm) Title() string

Title for the phase

type PrepareHosts

type PrepareHosts struct {
	GenericPhase
}

PrepareHosts installs required packages and so on on the hosts.

func (*PrepareHosts) Run

func (p *PrepareHosts) Run() error

Run the phase

func (*PrepareHosts) Title

func (p *PrepareHosts) Title() string

Title for the phase

type ResetControllers added in v0.15.0

type ResetControllers struct {
	GenericPhase

	NoDrain  bool
	NoDelete bool
	NoLeave  bool
	// contains filtered or unexported fields
}

ResetControllers phase removes controllers marked for reset from the kubernetes and etcd clusters and resets k0s on the host

func (*ResetControllers) Prepare added in v0.15.0

func (p *ResetControllers) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*ResetControllers) Run added in v0.15.0

func (p *ResetControllers) Run() error

Run the phase

func (*ResetControllers) ShouldRun added in v0.15.0

func (p *ResetControllers) ShouldRun() bool

ShouldRun is true when there are controllers that needs to be reset

func (*ResetControllers) Title added in v0.15.0

func (p *ResetControllers) Title() string

Title for the phase

type ResetLeader added in v0.15.0

type ResetLeader struct {
	GenericPhase
	// contains filtered or unexported fields
}

ResetLeader phase removes the leader from the cluster and thus destroys the cluster

func (*ResetLeader) Prepare added in v0.15.0

func (p *ResetLeader) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*ResetLeader) Run added in v0.15.0

func (p *ResetLeader) Run() error

Run the phase

func (*ResetLeader) Title added in v0.15.0

func (p *ResetLeader) Title() string

Title for the phase

type ResetWorkers added in v0.15.0

type ResetWorkers struct {
	GenericPhase

	NoDrain  bool
	NoDelete bool
	// contains filtered or unexported fields
}

ResetControllers phase removes workers marked for reset from the kubernetes cluster and resets k0s on the host

func (*ResetWorkers) Prepare added in v0.15.0

func (p *ResetWorkers) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*ResetWorkers) Run added in v0.15.0

func (p *ResetWorkers) Run() error

Run the phase

func (*ResetWorkers) ShouldRun added in v0.15.0

func (p *ResetWorkers) ShouldRun() bool

ShouldRun is true when there are workers that needs to be reset

func (*ResetWorkers) Title added in v0.15.0

func (p *ResetWorkers) Title() string

Title for the phase

type Restore added in v0.8.5

type Restore struct {
	GenericPhase

	RestoreFrom string
	// contains filtered or unexported fields
}

func (*Restore) Prepare added in v0.8.5

func (p *Restore) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*Restore) Run added in v0.8.5

func (p *Restore) Run() error

Run the phase

func (*Restore) ShouldRun added in v0.8.5

func (p *Restore) ShouldRun() bool

ShouldRun is true when there path to backup file

func (*Restore) Title added in v0.8.5

func (p *Restore) Title() string

Title for the phase

type RunHooks added in v0.9.0

type RunHooks struct {
	GenericPhase
	Action string
	Stage  string
	// contains filtered or unexported fields
}

RunHooks phase runs a set of hooks configured for the host

func (*RunHooks) Prepare added in v0.9.0

func (p *RunHooks) Prepare(config *v1beta1.Cluster) error

Prepare digs out the hosts with steps from the config

func (*RunHooks) Run added in v0.9.0

func (p *RunHooks) Run() error

Run does all the prep work on the hosts in parallel

func (*RunHooks) ShouldRun added in v0.9.0

func (p *RunHooks) ShouldRun() bool

ShouldRun is true when there are hosts that need to be connected

func (*RunHooks) Title added in v0.9.0

func (p *RunHooks) Title() string

Title for the phase

type Unlock added in v0.13.0

type Unlock struct {
	GenericPhase
	Cancel func()
}

Unlock acquires an exclusive k0sctl lock on hosts

func (*Unlock) Prepare added in v0.13.0

func (p *Unlock) Prepare(c *v1beta1.Cluster) error

Prepare the phase

func (*Unlock) Run added in v0.13.0

func (p *Unlock) Run() error

Run the phase

func (*Unlock) Title added in v0.13.0

func (p *Unlock) Title() string

Title for the phase

type UpgradeControllers added in v0.5.0

type UpgradeControllers struct {
	GenericPhase
	// contains filtered or unexported fields
}

UpgradeControllers upgrades the controllers one-by-one

func (*UpgradeControllers) CleanUp added in v0.10.0

func (p *UpgradeControllers) CleanUp()

CleanUp cleans up the environment override files on hosts

func (*UpgradeControllers) Prepare added in v0.5.0

func (p *UpgradeControllers) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*UpgradeControllers) Run added in v0.5.0

func (p *UpgradeControllers) Run() error

Run the phase

func (*UpgradeControllers) ShouldRun added in v0.5.0

func (p *UpgradeControllers) ShouldRun() bool

ShouldRun is true when there are controllers that needs to be upgraded

func (*UpgradeControllers) Title added in v0.5.0

func (p *UpgradeControllers) Title() string

Title for the phase

type UpgradeWorkers added in v0.5.0

type UpgradeWorkers struct {
	GenericPhase

	NoDrain bool
	// contains filtered or unexported fields
}

UpgradeWorkers upgrades workers in batches

func (*UpgradeWorkers) CleanUp added in v0.10.0

func (p *UpgradeWorkers) CleanUp()

CleanUp cleans up the environment override files on hosts

func (*UpgradeWorkers) Prepare added in v0.5.0

func (p *UpgradeWorkers) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*UpgradeWorkers) Run added in v0.5.0

func (p *UpgradeWorkers) Run() error

Run the phase

func (*UpgradeWorkers) ShouldRun added in v0.5.0

func (p *UpgradeWorkers) ShouldRun() bool

ShouldRun is true when there are workers that needs to be upgraded

func (*UpgradeWorkers) Title added in v0.5.0

func (p *UpgradeWorkers) Title() string

Title for the phase

type UploadFiles added in v0.6.0

type UploadFiles struct {
	GenericPhase
	// contains filtered or unexported fields
}

UploadFiles implements a phase which upload files to hosts

func (*UploadFiles) Prepare added in v0.6.0

func (p *UploadFiles) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*UploadFiles) Run added in v0.6.0

func (p *UploadFiles) Run() error

Run the phase

func (*UploadFiles) ShouldRun added in v0.6.0

func (p *UploadFiles) ShouldRun() bool

ShouldRun is true when there are workers

func (*UploadFiles) Title added in v0.6.0

func (p *UploadFiles) Title() string

Title for the phase

type UploadK0s added in v0.17.0

type UploadK0s struct {
	GenericPhase
	// contains filtered or unexported fields
}

UploadK0s uploads k0s binaries from localhost to target

func (*UploadK0s) Prepare added in v0.17.0

func (p *UploadK0s) Prepare(config *v1beta1.Cluster) error

Prepare the phase

func (*UploadK0s) Run added in v0.17.0

func (p *UploadK0s) Run() error

Run the phase

func (*UploadK0s) ShouldRun added in v0.17.0

func (p *UploadK0s) ShouldRun() bool

ShouldRun is true when there are hosts that need binary uploading

func (*UploadK0s) Title added in v0.17.0

func (p *UploadK0s) Title() string

Title for the phase

type ValidateFacts added in v0.5.0

type ValidateFacts struct {
	GenericPhase
	SkipDowngradeCheck bool
}

ValidateFacts performs remote OS detection

func (*ValidateFacts) Run added in v0.5.0

func (p *ValidateFacts) Run() error

Run the phase

func (*ValidateFacts) Title added in v0.5.0

func (p *ValidateFacts) Title() string

Title for the phase

type ValidateHosts

type ValidateHosts struct {
	GenericPhase
	// contains filtered or unexported fields
}

ValidateHosts performs remote OS detection

func (*ValidateHosts) Run

func (p *ValidateHosts) Run() error

Run the phase

func (*ValidateHosts) Title

func (p *ValidateHosts) Title() string

Title for the phase

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL