Documentation
¶
Overview ¶
Package phase is all the various phases used for bootstrapping a cluster. The phase files are named in a rough order used during an install; - 0x are for preconnection resources, along with ssh-ing into the node - 1x are used to gather information about the nodes in the cluster - 2x are for modifying host services, like firewalls, host files, and enabling kernel level modules - 5x are for staging files for the distro engine, e.i. rpm's, apt's, or binary files - 6x are for starting the engine or for upgrading an existing install - 8x are for resetting the engine from the nodes - 9x are last minute things and finally disconnecting from a node - ext are files that are currently not used but may be incorporated later
Index ¶
- Constants
- Variables
- func DryRunNote(p Phase) string
- type APTUploadFiles
- type BINUploadFiles
- type ConfigureEngine
- type ConfigureFirewall
- func (p *ConfigureFirewall) Explanation() string
- func (p *ConfigureFirewall) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
- func (p *ConfigureFirewall) Run(ctx context.Context) error
- func (p *ConfigureFirewall) ShouldRun() bool
- func (p *ConfigureFirewall) Title() string
- type Connect
- type DaemonReload
- type DeleteCommon
- type DeleteControllers
- func (p *DeleteControllers) Explanation() string
- func (p *DeleteControllers) Prepare(ctx context.Context, c *cluster.ZarfCluster, d *distro.ZarfDistro) error
- func (p *DeleteControllers) Run(ctx context.Context) error
- func (p *DeleteControllers) ShouldRun() bool
- func (p *DeleteControllers) Title() string
- type DeleteWorkers
- type DetectOS
- type DetectRemovedHosts
- func (p *DetectRemovedHosts) Explanation() string
- func (p *DetectRemovedHosts) Prepare(_ context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
- func (p *DetectRemovedHosts) ReadOnly() string
- func (p *DetectRemovedHosts) Run(ctx context.Context) error
- func (p *DetectRemovedHosts) ShouldRun() bool
- func (p *DetectRemovedHosts) Title() string
- type Disconnect
- type DryRunBehavior
- type EngineConfigSyncController
- type EngineConfigSyncHosts
- type EngineConfigSyncWorker
- type GatherFacts
- type GatherFactsDistro
- func (p *GatherFactsDistro) Explanation() string
- func (p *GatherFactsDistro) Prepare(_ context.Context, _ *cluster.ZarfCluster, d *distro.ZarfDistro) error
- func (p *GatherFactsDistro) ReadOnly() string
- func (p *GatherFactsDistro) Run(ctx context.Context) (err error)
- func (p *GatherFactsDistro) Title() string
- type GenericPhase
- func (p *GenericPhase) GetConfig() *cluster.ZarfCluster
- func (p *GenericPhase) GetDistro() *distro.ZarfDistro
- func (p *GenericPhase) Prepare(c *cluster.ZarfCluster, d *distro.ZarfDistro) error
- func (p *GenericPhase) SetManager(m *Manager)
- func (p *GenericPhase) VersionGreater(host *cluster.ZarfHost, version string) bool
- func (p *GenericPhase) VersionLess(host *cluster.ZarfHost, version string) bool
- func (p *GenericPhase) Wet(host fmt.Stringer, msg string, funcs ...errorfunc) error
- type InitializeControllers
- func (p *InitializeControllers) Explanation() string
- func (p *InitializeControllers) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
- func (p *InitializeControllers) Run(ctx context.Context) error
- func (p *InitializeControllers) ShouldRun() bool
- func (p *InitializeControllers) Title() string
- type InitializeWorkers
- func (p *InitializeWorkers) Explanation() string
- func (p *InitializeWorkers) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
- func (p *InitializeWorkers) Run(ctx context.Context) error
- func (p *InitializeWorkers) ShouldRun() bool
- func (p *InitializeWorkers) Title() string
- type InstallFapolicy
- type KubeConfig
- func (p *KubeConfig) Bytes() ([]byte, error)
- func (p *KubeConfig) Config() *clientcmdapi.Config
- func (p *KubeConfig) Explanation() string
- func (p *KubeConfig) Prepare(ctx context.Context, c *cluster.ZarfCluster, _ *distro.ZarfDistro) error
- func (p *KubeConfig) Run(_ context.Context) error
- func (p *KubeConfig) ShouldRun() bool
- func (p *KubeConfig) Title() string
- type LabelNodes
- type Lock
- func (p *Lock) Cancel(_ context.Context)
- func (p *Lock) CleanUp()
- func (p *Lock) Explanation() string
- func (p *Lock) Prepare(ctx context.Context, c *cluster.ZarfCluster, _ *distro.ZarfDistro) error
- func (p *Lock) Run(ctx context.Context) error
- func (p *Lock) Title() string
- func (p *Lock) UnlockPhase() Phase
- type Manager
- func (m *Manager) AddPhase(p ...Phase)
- func (m *Manager) GetDistroOSFiles() v1alpha1.ZarfFiles
- func (m *Manager) RetryTimeout(ctx context.Context, f func(ctx context.Context) error) error
- func (m *Manager) Run(ctx context.Context) error
- func (m *Manager) SetPhases(p Phases)
- func (m *Manager) SetTimout(tm time.Duration)
- func (m *Manager) Wet(_ fmt.Stringer, _ string, funcs ...errorfunc) error
- type ManagerDistroConfig
- type ManifestEntry
- type ModifyHosts
- type Phase
- type Phases
- type PrepareFapolicy
- type PrepareHosts
- type PrepareKernelModules
- func (p *PrepareKernelModules) Explanation() string
- func (p *PrepareKernelModules) Prepare(_ context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
- func (p *PrepareKernelModules) Run(ctx context.Context) error
- func (p *PrepareKernelModules) ShouldRun() bool
- func (p *PrepareKernelModules) Title() string
- type PrepareSelinux
- type RPMUploadFiles
- type UninstallEngine
- type Unlock
- type UpgradeController
- type UpgradeHosts
- type UpgradeWorkers
- type UploadFiles
- type UploadFilesCommon
- type ValidateHosts
Constants ¶
const ( // FIREWALLD name of the service for firewalld FIREWALLD = firewall.FirewalldService // UFW name of the service for ufw UFW = firewall.UFWService )
const (
// ContainerSELinux package name
ContainerSELinux = "container-selinux"
)
const (
// FAPOLICYD name of the service for fapolicyd
FAPOLICYD = "fapolicyd"
)
const (
// FAPolicydRuleFile path on the host
FAPolicydRuleFile = "/etc/fapolicyd/rules.d/31-cargoship.rules"
)
const (
// UnknownVersion for when the version is not set
UnknownVersion = "v0.0.0"
)
Variables ¶
var ErrNoControllers = errors.New("no controllers are running")
ErrNoControllers an error for when no controllers are running
var ErrNoKubeConfig = errors.New("kubeconfig has not been built")
ErrNoKubeConfig is returned when the config is asked for before the phase has run
var ErrUnmanagedNodes = errors.New("the cluster holds nodes the config does not: add the host back to the config, run `cargoship install reset` against it, or pass --allow-unmanaged-nodes to apply anyway")
ErrUnmanagedNodes is returned when the cluster holds a node no host in the config accounts for. Apply removes nothing, so continuing would report success over a machine that is still running the engine and still joined.
var Force bool
Force is used by various phases to attempt a forced installation
var ( // Interval is the time to wait between retry attempts Interval = 10 * time.Second )
var NoWait bool
NoWait is used by various phases to decide if node ready state should be waited for or not
Functions ¶
func DryRunNote ¶ added in v0.20.0
DryRunNote returns the phase's own account of why a dry run runs it, or "" for a phase that gives none. Only read-only phases carry one: they are the phases a dry run runs against live hosts, so they are the ones a reader is entitled to an argument about.
Types ¶
type APTUploadFiles ¶
type APTUploadFiles struct {
UploadFilesCommon
}
APTUploadFiles implements a phase which upload files to hosts
func (*APTUploadFiles) Explanation ¶
func (p *APTUploadFiles) Explanation() string
Explanation about the current phase, used for documentation generation
func (*APTUploadFiles) Prepare ¶
func (p *APTUploadFiles) Prepare(ctx context.Context, c *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
type BINUploadFiles ¶
type BINUploadFiles struct {
UploadFilesCommon
Distro distrocfg.Distro
}
BINUploadFiles implements a phase which upload files to hosts
func (*BINUploadFiles) Explanation ¶
func (p *BINUploadFiles) Explanation() string
Explanation about the current phase, used for documentation generation
func (*BINUploadFiles) Prepare ¶
func (p *BINUploadFiles) Prepare(ctx context.Context, c *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
type ConfigureEngine ¶
type ConfigureEngine struct {
GenericPhase
Distro distrocfg.Distro
// Keyring decrypts encrypted registry credentials, in either supported format. If it holds
// nothing that reads a given value, Prepare errors.
Keyring *clustercfg.Keyring
// contains filtered or unexported fields
}
ConfigureEngine writes the engine configuration to host engine config dir
func (*ConfigureEngine) Explanation ¶
func (p *ConfigureEngine) Explanation() string
Explanation about the current phase, used for documentation generation
func (*ConfigureEngine) Prepare ¶
func (p *ConfigureEngine) Prepare(ctx context.Context, c *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
func (*ConfigureEngine) Run ¶
func (p *ConfigureEngine) Run(ctx context.Context) error
Run the phase title
func (*ConfigureEngine) Title ¶
func (p *ConfigureEngine) Title() string
Title returns the phase title
type ConfigureFirewall ¶
type ConfigureFirewall struct {
GenericPhase
Distro distrocfg.Distro
Enabled bool
// contains filtered or unexported fields
}
ConfigureFirewall state
func (*ConfigureFirewall) Explanation ¶
func (p *ConfigureFirewall) Explanation() string
Explanation about the current phase, used for documentation generation
func (*ConfigureFirewall) Prepare ¶
func (p *ConfigureFirewall) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*ConfigureFirewall) Run ¶
func (p *ConfigureFirewall) Run(ctx context.Context) error
Run the phase
func (*ConfigureFirewall) ShouldRun ¶
func (p *ConfigureFirewall) ShouldRun() bool
ShouldRun is true when the firewall is being managed and at least one node runs one
type Connect ¶
type Connect struct {
GenericPhase
}
Connect connects to each of the hosts
func (*Connect) Explanation ¶
Explanation about the current phase, used for documentation generation
type DaemonReload ¶
type DaemonReload struct {
GenericPhase
}
DaemonReload phase runs `systemctl daemon-reload` or equivalent on all hosts.
func (*DaemonReload) Explanation ¶
func (p *DaemonReload) Explanation() string
Explanation about the current phase, used for documentation generation
func (*DaemonReload) ShouldRun ¶
func (p *DaemonReload) ShouldRun() bool
ShouldRun is true when there are controllers that needs to be reset
type DeleteCommon ¶
type DeleteCommon struct {
GenericPhase
Distro distrocfg.Distro
// contains filtered or unexported fields
}
DeleteCommon phase state
func (*DeleteCommon) Prepare ¶
func (p *DeleteCommon) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
type DeleteControllers ¶
type DeleteControllers struct {
DeleteCommon
NoDrain bool
// contains filtered or unexported fields
}
DeleteControllers phase state
func (*DeleteControllers) Explanation ¶
func (p *DeleteControllers) Explanation() string
Explanation about the current phase, used for documentation generation
func (*DeleteControllers) Prepare ¶
func (p *DeleteControllers) Prepare(ctx context.Context, c *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
func (*DeleteControllers) Run ¶
func (p *DeleteControllers) Run(ctx context.Context) error
Run the phase
func (*DeleteControllers) ShouldRun ¶
func (p *DeleteControllers) ShouldRun() bool
ShouldRun is true when this phase is enabled
type DeleteWorkers ¶
type DeleteWorkers struct {
DeleteCommon
NoDrain bool
WorkerConcurrent string
// contains filtered or unexported fields
}
DeleteWorkers phase state
func (*DeleteWorkers) Explanation ¶
func (p *DeleteWorkers) Explanation() string
Explanation about the current phase, used for documentation generation
func (*DeleteWorkers) Prepare ¶
func (p *DeleteWorkers) Prepare(ctx context.Context, c *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
func (*DeleteWorkers) ShouldRun ¶
func (p *DeleteWorkers) ShouldRun() bool
ShouldRun is true when this phase is enabled
type DetectOS ¶
type DetectOS struct {
GenericPhase
}
DetectOS performs remote OS detection
func (*DetectOS) Explanation ¶
Explanation about the current phase, used for documentation generation
type DetectRemovedHosts ¶ added in v0.23.0
type DetectRemovedHosts struct {
GenericPhase
Distro distrocfg.Distro
// AllowUnmanaged downgrades the refusal to a warning. A cluster can hold nodes cargoship
// never joined, and refusing on those would block every apply on a working setup, so the
// operator needs a way to say the extra nodes are deliberate.
AllowUnmanaged bool
// contains filtered or unexported fields
}
DetectRemovedHosts state.
Apply drives the cluster towards the config, but only ever forwards: every phase after this one reads Spec.Hosts and acts on what it finds there. A host deleted from the config is therefore invisible to all of them, and the machine keeps running the engine and stays joined to the cluster while apply reports success. This phase is what stops that from being silent.
It detects and refuses. It does not reconcile, and the reason is not effort: apply cannot reach the machine it would have to clean up. Draining a node and deleting its Node object needs only the name, which the API gives us. Uninstalling the engine needs an SSH connection, and the address, user and key for that lived in the host block that was just deleted. Deleting the Node object without the uninstall is worse than doing nothing, because it looks like the removal worked while the machine keeps its certificates and tries to rejoin -- and for a controller it stays an etcd member, so the quorum arithmetic silently moves against a member nobody can reach.
The layer that does hold the connection details for a removed host is the OpenTofu provider, which still has the old host block in its state file when it plans the destroy. That is where a real removal path belongs, and it can call reset against exactly that host. Until then this phase makes the gap loud instead of invisible.
func (*DetectRemovedHosts) Explanation ¶ added in v0.23.0
func (p *DetectRemovedHosts) Explanation() string
Explanation about the current phase, used for documentation generation
func (*DetectRemovedHosts) Prepare ¶ added in v0.23.0
func (p *DetectRemovedHosts) Prepare(_ context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase.
The leader is any host in the config already running the controller service, which is the same way the label and delete phases find one. Nothing is running on a first install, so there is no leader, and ShouldRun turns the phase off: a cluster that does not exist yet cannot have had a host removed from it.
func (*DetectRemovedHosts) ReadOnly ¶ added in v0.23.0
func (p *DetectRemovedHosts) ReadOnly() string
ReadOnly marks this phase safe under a dry run, and returns the reason for the phase docs.
func (*DetectRemovedHosts) Run ¶ added in v0.23.0
func (p *DetectRemovedHosts) Run(ctx context.Context) error
Run the phase.
Only positive evidence stops the apply. Failing to reach the cluster says nothing about whether a host was removed, and this phase runs before every phase that does the real work, so treating an unreachable cluster as a refusal would turn a transient failure into a failed apply that had nothing to do with removals. Those cases warn and continue.
func (*DetectRemovedHosts) ShouldRun ¶ added in v0.23.0
func (p *DetectRemovedHosts) ShouldRun() bool
ShouldRun is true once there is a running controller to ask
func (*DetectRemovedHosts) Title ¶ added in v0.23.0
func (p *DetectRemovedHosts) Title() string
Title for the phase
type Disconnect ¶
type Disconnect struct {
GenericPhase
}
Disconnect disconnects from the hosts
func (*Disconnect) DryRun ¶
func (p *Disconnect) DryRun() error
DryRun cleans up the temporary binary from the hosts
func (*Disconnect) Explanation ¶
func (p *Disconnect) Explanation() string
Explanation about the current phase, used for documentation generation
type DryRunBehavior ¶ added in v0.20.0
type DryRunBehavior int
DryRunBehavior is what a dry run does with a phase. It is derived from the interfaces the phase implements, and it is exported so magefiles/gen-docs.go can label each phase in docs/phases/<name>.md with the same classification Run() gates on. The docs and the gate cannot disagree, because there is only one classifier.
const ( // DryRunSkip is the default: the phase declares nothing, so a dry run reports it and // does not run it. DryRunSkip DryRunBehavior = iota // DryRunReadOnly is a phase implementing readOnly. It reads hosts and changes nothing, // so a dry run runs it as itself. DryRunReadOnly // DryRunOwnPath is a phase implementing withDryRun. A dry run calls DryRun() instead of // Run(). DryRunOwnPath )
func ClassifyDryRun ¶ added in v0.20.0
func ClassifyDryRun(p Phase) DryRunBehavior
ClassifyDryRun reports what a dry run does with p.
func (DryRunBehavior) String ¶ added in v0.20.0
func (b DryRunBehavior) String() string
String is the label written into the phase docs.
type EngineConfigSyncController ¶ added in v0.15.0
type EngineConfigSyncController struct {
EngineConfigSyncHosts
}
EngineConfigSyncController phase state
func (*EngineConfigSyncController) Explanation ¶ added in v0.15.0
func (p *EngineConfigSyncController) Explanation() string
Explanation about the current phase, used for documentation generation
func (*EngineConfigSyncController) Prepare ¶ added in v0.15.0
func (p *EngineConfigSyncController) Prepare(ctx context.Context, c *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
func (*EngineConfigSyncController) Run ¶ added in v0.15.0
func (p *EngineConfigSyncController) Run(ctx context.Context) error
Run the phase
func (*EngineConfigSyncController) Title ¶ added in v0.15.0
func (p *EngineConfigSyncController) Title() string
Title for the phase
type EngineConfigSyncHosts ¶ added in v0.15.0
type EngineConfigSyncHosts struct {
GenericPhase
Distro distrocfg.Distro
// Keyring decrypts encrypted registry credentials, in either supported format.
Keyring *clustercfg.Keyring
// contains filtered or unexported fields
}
EngineConfigSyncHosts phase state
func (*EngineConfigSyncHosts) ShouldRun ¶ added in v0.15.0
func (p *EngineConfigSyncHosts) ShouldRun() bool
ShouldRun is true when there are hosts to sync
type EngineConfigSyncWorker ¶ added in v0.15.0
type EngineConfigSyncWorker struct {
EngineConfigSyncHosts
WorkerConcurrent string
}
EngineConfigSyncWorker phase state
func (*EngineConfigSyncWorker) Explanation ¶ added in v0.15.0
func (p *EngineConfigSyncWorker) Explanation() string
Explanation about the current phase, used for documentation generation
func (*EngineConfigSyncWorker) Prepare ¶ added in v0.15.0
func (p *EngineConfigSyncWorker) Prepare(ctx context.Context, c *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
func (*EngineConfigSyncWorker) Run ¶ added in v0.15.0
func (p *EngineConfigSyncWorker) Run(ctx context.Context) error
Run the phase
func (*EngineConfigSyncWorker) Title ¶ added in v0.15.0
func (p *EngineConfigSyncWorker) Title() string
Title for the phase
type GatherFacts ¶
type GatherFacts struct {
GenericPhase
// contains filtered or unexported fields
}
GatherFacts gathers information about hosts
func (*GatherFacts) Explanation ¶
func (p *GatherFacts) Explanation() string
Explanation about the current phase, used for documentation generation
func (*GatherFacts) ReadOnly ¶ added in v0.20.0
func (p *GatherFacts) ReadOnly() string
ReadOnly marks this phase safe under a dry run, and returns the reason for the phase docs.
type GatherFactsDistro ¶
type GatherFactsDistro struct {
GenericPhase
Distro distrocfg.Distro
// contains filtered or unexported fields
}
GatherFactsDistro state
func (*GatherFactsDistro) Explanation ¶
func (p *GatherFactsDistro) Explanation() string
Explanation about the current phase, used for documentation generation
func (*GatherFactsDistro) Prepare ¶
func (p *GatherFactsDistro) Prepare(_ context.Context, _ *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
func (*GatherFactsDistro) ReadOnly ¶ added in v0.20.0
func (p *GatherFactsDistro) ReadOnly() string
ReadOnly marks this phase safe under a dry run, and returns the reason for the phase docs.
type GenericPhase ¶
type GenericPhase struct {
// contains filtered or unexported fields
}
GenericPhase state
func (*GenericPhase) GetConfig ¶
func (p *GenericPhase) GetConfig() *cluster.ZarfCluster
GetConfig is an accessor to phase Config
func (*GenericPhase) GetDistro ¶
func (p *GenericPhase) GetDistro() *distro.ZarfDistro
GetDistro is an accessor to phase Distro
func (*GenericPhase) Prepare ¶
func (p *GenericPhase) Prepare(c *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
func (*GenericPhase) SetManager ¶
func (p *GenericPhase) SetManager(m *Manager)
SetManager adds a reference to the phase manager
func (*GenericPhase) VersionGreater ¶
func (p *GenericPhase) VersionGreater(host *cluster.ZarfHost, version string) bool
VersionGreater if host version is greater then the distro version
func (*GenericPhase) VersionLess ¶
func (p *GenericPhase) VersionLess(host *cluster.ZarfHost, version string) bool
VersionLess if host version is less then the distro version
type InitializeControllers ¶
type InitializeControllers struct {
GenericPhase
Distro distrocfg.Distro
// contains filtered or unexported fields
}
InitializeControllers phase state
func (*InitializeControllers) Explanation ¶
func (p *InitializeControllers) Explanation() string
Explanation about the current phase, used for documentation generation
func (*InitializeControllers) Prepare ¶
func (p *InitializeControllers) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*InitializeControllers) Run ¶
func (p *InitializeControllers) Run(ctx context.Context) error
Run the phase
func (*InitializeControllers) ShouldRun ¶
func (p *InitializeControllers) ShouldRun() bool
ShouldRun is true when there are workers
func (*InitializeControllers) Title ¶
func (p *InitializeControllers) Title() string
Title for the phase
type InitializeWorkers ¶
type InitializeWorkers struct {
GenericPhase
Distro distrocfg.Distro
WorkerConcurrent string
// contains filtered or unexported fields
}
InitializeWorkers phase state
func (*InitializeWorkers) Explanation ¶
func (p *InitializeWorkers) Explanation() string
Explanation about the current phase, used for documentation generation
func (*InitializeWorkers) Prepare ¶
func (p *InitializeWorkers) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*InitializeWorkers) Run ¶
func (p *InitializeWorkers) Run(ctx context.Context) error
Run the phase
func (*InitializeWorkers) ShouldRun ¶
func (p *InitializeWorkers) ShouldRun() bool
ShouldRun is true when there are workers
type InstallFapolicy ¶
type InstallFapolicy struct {
GenericPhase
Enabled bool
// contains filtered or unexported fields
}
InstallFapolicy installs required packages and so on on the hosts.
func (*InstallFapolicy) Prepare ¶
func (p *InstallFapolicy) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*InstallFapolicy) Run ¶
func (p *InstallFapolicy) Run(ctx context.Context) error
Run the phase
func (*InstallFapolicy) ShouldRun ¶
func (p *InstallFapolicy) ShouldRun() bool
ShouldRun is true when there is a host with selinux or fapolicyd on the hosts
type KubeConfig ¶
type KubeConfig struct {
GenericPhase
Distro distrocfg.Distro
ClusterID string
ClusterLB string
Enabled bool
// Write merges the config into the operator's local kubeconfig once it is built. The
// CLI sets it. A caller that only wants the value -- a provider holding it as an
// attribute, say -- leaves it false and reads Config after the run, so nobody's
// ~/.kube/config is touched as a side effect.
Write bool
// Path is the kubeconfig file Write merges into. Empty means the standard location:
// KUBECONFIG when set, otherwise ~/.kube/config. A path that does not exist is created,
// and one that does keeps every cluster already in it.
Path string
// contains filtered or unexported fields
}
KubeConfig phase state
func (*KubeConfig) Bytes ¶ added in v0.21.0
func (p *KubeConfig) Bytes() ([]byte, error)
Bytes is Config serialized as a kubeconfig file, which is the form a caller storing it elsewhere wants.
func (*KubeConfig) Config ¶ added in v0.21.0
func (p *KubeConfig) Config() *clientcmdapi.Config
Config is the kubeconfig for this cluster, built during Run from the admin credentials on the leader. It is nil until the phase has run.
func (*KubeConfig) Explanation ¶
func (p *KubeConfig) Explanation() string
Explanation about the current phase, used for documentation generation
func (*KubeConfig) Prepare ¶
func (p *KubeConfig) Prepare(ctx context.Context, c *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*KubeConfig) ShouldRun ¶ added in v0.3.0
func (p *KubeConfig) ShouldRun() bool
ShouldRun is true when enabled by flags
type LabelNodes ¶ added in v0.15.0
type LabelNodes struct {
GenericPhase
Distro distrocfg.Distro
ClusterLB string
Enabled bool
// contains filtered or unexported fields
}
LabelNodes phase state
func (*LabelNodes) Explanation ¶ added in v0.15.0
func (p *LabelNodes) Explanation() string
Explanation about the current phase, used for documentation generation
func (*LabelNodes) Prepare ¶ added in v0.15.0
func (p *LabelNodes) Prepare(ctx context.Context, c *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*LabelNodes) Run ¶ added in v0.15.0
func (p *LabelNodes) Run(ctx context.Context) error
Run the phase
func (*LabelNodes) ShouldRun ¶ added in v0.15.0
func (p *LabelNodes) ShouldRun() bool
ShouldRun is true when enabled by flags
type Lock ¶
type Lock struct {
GenericPhase
// contains filtered or unexported fields
}
Lock phase state
func (*Lock) Explanation ¶
Explanation about the current phase, used for documentation generation
func (*Lock) Prepare ¶
func (p *Lock) Prepare(ctx context.Context, c *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*Lock) UnlockPhase ¶
UnlockPhase returns an unlock phase for this lock phase
type Manager ¶
type Manager struct {
Config *cluster.ZarfCluster
Distro *distro.ZarfDistro
// Values is the configuration the package ships with, merged with the
// overrides in the cluster inventory and checked against the package's
// values schema. Phases read it instead of re-reading either source, so
// every phase sees the same values.
Values map[string]any
DistroID string
Concurrency int
ConcurrentUploads int
DryRun bool
Writer io.Writer
TempDirectory string
Timeout time.Duration
// contains filtered or unexported fields
}
Manager executes phases to construct the cluster
func NewManager ¶
NewManager creates a new Manager
func (*Manager) GetDistroOSFiles ¶
GetDistroOSFiles returns the ZarfFiles for a distro
func (*Manager) RetryTimeout ¶
RetryTimeout wraps retry Timeout logic
type ManagerDistroConfig ¶
type ManagerDistroConfig struct {
BinaryDir string
Binary string
Config string
Token string
Data string
Version string
}
ManagerDistroConfig stores some values for manager distro config
type ManifestEntry ¶ added in v0.14.0
type ManifestEntry struct {
// Category labels why the file was uploaded, e.g. "engine", "image", "file", "data".
Category string
// Path is the absolute path of the file on the remote host.
Path string
}
ManifestEntry is a single file cargoship uploaded to a host, recorded so it can be found and removed later during an upgrade or uninstall.
type ModifyHosts ¶
type ModifyHosts struct {
GenericPhase
Enabled bool
// contains filtered or unexported fields
}
ModifyHosts state
func (*ModifyHosts) Explanation ¶
func (p *ModifyHosts) Explanation() string
Explanation about the current phase, used for documentation generation
func (*ModifyHosts) Prepare ¶
func (p *ModifyHosts) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*ModifyHosts) ShouldRun ¶
func (p *ModifyHosts) ShouldRun() bool
ShouldRun is true when this phase is enabled
type Phases ¶
type Phases []Phase
Phases is a slice of Phases
func (Phases) Index ¶
Index returns the index of the first occurrence matching the given phase title or -1 if not found
func (*Phases) InsertAfter ¶
InsertAfter inserts a phase after the first occurrence of a phase with the given title
func (*Phases) InsertBefore ¶
InsertBefore inserts a phase before the first occurrence of a phase with the given title
type PrepareFapolicy ¶
type PrepareFapolicy struct {
GenericPhase
// contains filtered or unexported fields
}
PrepareFapolicy installs required packages and so on on the hosts.
func (*PrepareFapolicy) Explanation ¶
func (p *PrepareFapolicy) Explanation() string
Explanation about the current phase, used for documentation generation
func (*PrepareFapolicy) Prepare ¶
func (p *PrepareFapolicy) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*PrepareFapolicy) Run ¶
func (p *PrepareFapolicy) Run(ctx context.Context) error
Run the phase
func (*PrepareFapolicy) ShouldRun ¶
func (p *PrepareFapolicy) ShouldRun() bool
ShouldRun is true when there is a host with selinux or fapolicyd on the hosts
type PrepareHosts ¶
type PrepareHosts struct {
GenericPhase
// contains filtered or unexported fields
}
PrepareHosts installs required packages and so on on the hosts.
func (*PrepareHosts) Explanation ¶
func (p *PrepareHosts) Explanation() string
Explanation about the current phase, used for documentation generation
func (*PrepareHosts) Prepare ¶ added in v0.5.0
func (p *PrepareHosts) Prepare(_ context.Context, _ *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
type PrepareKernelModules ¶ added in v0.5.0
type PrepareKernelModules struct {
GenericPhase
Enabled bool
// contains filtered or unexported fields
}
PrepareKernelModules enables the list of requested modules on the host, then reboots the box if modules are added
func (*PrepareKernelModules) Explanation ¶ added in v0.5.0
func (p *PrepareKernelModules) Explanation() string
Explanation about the current phase, used for documentation generation
func (*PrepareKernelModules) Prepare ¶ added in v0.5.0
func (p *PrepareKernelModules) Prepare(_ context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*PrepareKernelModules) Run ¶ added in v0.5.0
func (p *PrepareKernelModules) Run(ctx context.Context) error
Run the phase
func (*PrepareKernelModules) ShouldRun ¶ added in v0.5.0
func (p *PrepareKernelModules) ShouldRun() bool
ShouldRun is true when we need to enable kernel modules
func (*PrepareKernelModules) Title ¶ added in v0.5.0
func (p *PrepareKernelModules) Title() string
Title for the phase
type PrepareSelinux ¶
type PrepareSelinux struct {
GenericPhase
// contains filtered or unexported fields
}
PrepareSelinux installs required packages and so on on the hosts.
func (*PrepareSelinux) Explanation ¶
func (p *PrepareSelinux) Explanation() string
Explanation about the current phase, used for documentation generation
func (*PrepareSelinux) Prepare ¶
func (p *PrepareSelinux) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*PrepareSelinux) ShouldRun ¶
func (p *PrepareSelinux) ShouldRun() bool
ShouldRun is true when there is a host with selinux on the hosts
type RPMUploadFiles ¶
type RPMUploadFiles struct {
UploadFilesCommon
}
RPMUploadFiles implements a phase which upload files to hosts
func (*RPMUploadFiles) Explanation ¶
func (p *RPMUploadFiles) Explanation() string
Explanation about the current phase, used for documentation generation
func (*RPMUploadFiles) Prepare ¶
func (p *RPMUploadFiles) Prepare(ctx context.Context, c *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
type UninstallEngine ¶
type UninstallEngine struct {
GenericPhase
Distro distrocfg.Distro
WorkerConcurrent string
// contains filtered or unexported fields
}
UninstallEngine state
func (*UninstallEngine) Explanation ¶
func (p *UninstallEngine) Explanation() string
Explanation about the current phase, used for documentation generation
func (*UninstallEngine) Prepare ¶
func (p *UninstallEngine) Prepare(ctx context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
type Unlock ¶
type Unlock struct {
GenericPhase
Cancel func(context.Context)
}
Unlock phase state
func (*Unlock) Explanation ¶
Explanation about the current phase, used for documentation generation
func (*Unlock) Prepare ¶
func (p *Unlock) Prepare(_ context.Context, c *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
type UpgradeController ¶
type UpgradeController struct {
UpgradeHosts
}
UpgradeController phase state
func (*UpgradeController) Explanation ¶
func (p *UpgradeController) Explanation() string
Explanation about the current phase, used for documentation generation
func (*UpgradeController) Prepare ¶
func (p *UpgradeController) Prepare(ctx context.Context, _ *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
type UpgradeHosts ¶
type UpgradeHosts struct {
GenericPhase
Distro distrocfg.Distro
// contains filtered or unexported fields
}
UpgradeHosts phase state
func (*UpgradeHosts) ShouldRun ¶
func (p *UpgradeHosts) ShouldRun() bool
ShouldRun is true when there are workers
type UpgradeWorkers ¶
type UpgradeWorkers struct {
UpgradeHosts
WorkerConcurrent string
}
UpgradeWorkers phase state
func (*UpgradeWorkers) Explanation ¶
func (p *UpgradeWorkers) Explanation() string
Explanation about the current phase, used for documentation generation
func (*UpgradeWorkers) Prepare ¶
func (p *UpgradeWorkers) Prepare(ctx context.Context, _ *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
type UploadFiles ¶
type UploadFiles struct {
GenericPhase
// contains filtered or unexported fields
}
UploadFiles implements a phase which upload files to hosts
func (*UploadFiles) Explanation ¶
func (p *UploadFiles) Explanation() string
Explanation about the current phase, used for documentation generation
func (*UploadFiles) Prepare ¶
func (p *UploadFiles) Prepare(ctx context.Context, c *cluster.ZarfCluster, d *distro.ZarfDistro) error
Prepare the phase
func (*UploadFiles) ShouldRun ¶
func (p *UploadFiles) ShouldRun() bool
ShouldRun is true when there are workers
type UploadFilesCommon ¶
type UploadFilesCommon struct {
GenericPhase
// contains filtered or unexported fields
}
UploadFilesCommon implements a phase which upload files to hosts
func (*UploadFilesCommon) CleanUp ¶
func (p *UploadFilesCommon) CleanUp(ctx context.Context)
CleanUp the phase
func (*UploadFilesCommon) Prepare ¶
func (p *UploadFilesCommon) Prepare(_ context.Context, _ *cluster.ZarfCluster, _ *distro.ZarfDistro) error
Prepare the phase
func (*UploadFilesCommon) Run ¶
func (p *UploadFilesCommon) Run(ctx context.Context) (err error)
Run the phase
func (*UploadFilesCommon) ShouldRun ¶
func (p *UploadFilesCommon) ShouldRun() bool
ShouldRun is true when there are workers
type ValidateHosts ¶
type ValidateHosts struct {
GenericPhase
// contains filtered or unexported fields
}
ValidateHosts performs remote OS detection
func (*ValidateHosts) Explanation ¶
func (p *ValidateHosts) Explanation() string
Explanation about the current phase, used for documentation generation
func (*ValidateHosts) ReadOnly ¶ added in v0.20.0
func (p *ValidateHosts) ReadOnly() string
ReadOnly marks this phase safe under a dry run, and returns the reason for the phase docs.
Source Files
¶
- 00_generic_phase.go
- 01_generic_phase_file.go
- 02_imagecompress.go
- 03_manifest.go
- 05_manager.go
- 06_service_logs.go
- 07_connect.go
- 09_detect_os.go
- 10_gather_facts.go
- 11_validate_hosts.go
- 12_gather_facts_distro.go
- 13_detect_removed_hosts.go
- 20_prepare_host.go
- 21_prepare_selinux.go
- 22_prepare_fapolicyd.go
- 23_prepare_kernel_modules.go
- 25_modify_hosts_file.go
- 26_configure_firewall.go
- 50_uploadfiles.go
- 55_files_common.go
- 57_rpm_install.go
- 58_apt_install.go
- 59_bin_install.go
- 60_configure_engine.go
- 61_initialize_controller.go
- 62_initialize_worker.go
- 65_upgrade_common.go
- 66_upgrade_controller.go
- 67_upgrade_worker.go
- 70_engine_config_sync_common.go
- 71_engine_config_sync_controller.go
- 72_engine_config_sync_worker.go
- 80_kubeconfig.go
- 81_label_nodes.go
- 85_delete_common.go
- 86_delete_worker.go
- 87_delete_controller.go
- 88_uninstall_engine.go
- 91_lock.go
- 92_unlock.go
- 95_daemon_reload.go
- 99_disconnect.go
- ext_install_fapolicyd.go