Documentation
¶
Index ¶
- type Checkpoint
- type CheckpointStatus
- type ErrorInfo
- type Manager
- func (m *Manager) AddCheckpoint(phase Phase, status CheckpointStatus, snapshotPath string)
- func (m *Manager) Backup() (string, error)
- func (m *Manager) CanResume() bool
- func (m *Manager) ClearCheckpoints(phase Phase)
- func (m *Manager) ClearError()
- func (m *Manager) ClearLocalState() error
- func (m *Manager) GetAgentID() string
- func (m *Manager) GetAgentName() string
- func (m *Manager) GetLastCheckpoint() *Checkpoint
- func (m *Manager) GetRegisterScope() *RegisterScope
- func (m *Manager) GetState() *State
- func (m *Manager) HasSuccessfulCheckpoint(phase Phase) bool
- func (m *Manager) Load() error
- func (m *Manager) ResetCheckpoints()
- func (m *Manager) RollbackToLastCheckpoint() (*Checkpoint, error)
- func (m *Manager) Save() error
- func (m *Manager) SetAgentInfo(agentID, agentName string)
- func (m *Manager) SetError(phase Phase, errorMsg string, recoverable bool)
- func (m *Manager) SetPhase(phase Phase)
- func (m *Manager) SetRegisterScope(scope RegisterScope)
- func (m *Manager) SetVersions(versions map[string]string)
- func (m *Manager) StateDir() string
- func (m *Manager) StatePath() string
- type Phase
- type RegisterScope
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checkpoint ¶
type Checkpoint struct {
Phase Phase `json:"phase"` // k3s|calico|liqo|peering|offloading
Timestamp time.Time `json:"timestamp"` // Checkpoint creation time
Status CheckpointStatus `json:"status"` // success|failed
SnapshotPath string `json:"snapshot_path,omitempty"` // Optional snapshot path
}
Checkpoint represents an installation checkpoint
type CheckpointStatus ¶
type CheckpointStatus string
CheckpointStatus is the status of an installation checkpoint.
const ( CheckpointStatusSuccess CheckpointStatus = "success" CheckpointStatusFailed CheckpointStatus = "failed" )
type ErrorInfo ¶
type ErrorInfo struct {
Phase Phase `json:"phase"`
Timestamp time.Time `json:"timestamp"`
Error string `json:"error"`
Recoverable bool `json:"recoverable"`
}
ErrorInfo represents error information
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages installation state
func NewManager ¶
NewManager creates a new state manager agentID can be either the agent ID (UUID) or agent name
func (*Manager) AddCheckpoint ¶
func (m *Manager) AddCheckpoint(phase Phase, status CheckpointStatus, snapshotPath string)
AddCheckpoint adds a new checkpoint
func (*Manager) ClearCheckpoints ¶
ClearCheckpoints removes all checkpoints for the given phase.
func (*Manager) ClearLocalState ¶
ClearLocalState removes the cluster state directory.
func (*Manager) GetAgentName ¶
GetAgentName returns the agent name
func (*Manager) GetLastCheckpoint ¶
func (m *Manager) GetLastCheckpoint() *Checkpoint
GetLastCheckpoint returns the last successful checkpoint
func (*Manager) GetRegisterScope ¶
func (m *Manager) GetRegisterScope() *RegisterScope
GetRegisterScope returns persisted register flags, if any.
func (*Manager) HasSuccessfulCheckpoint ¶
HasSuccessfulCheckpoint reports whether a phase completed successfully.
func (*Manager) ResetCheckpoints ¶
func (m *Manager) ResetCheckpoints()
ResetCheckpoints clears checkpoints and error while preserving agent identity.
func (*Manager) RollbackToLastCheckpoint ¶
func (m *Manager) RollbackToLastCheckpoint() (*Checkpoint, error)
RollbackToLastCheckpoint truncates checkpoints after the last success and sets phase to it.
func (*Manager) SetAgentInfo ¶
SetAgentInfo sets agent ID and name
func (*Manager) SetRegisterScope ¶
func (m *Manager) SetRegisterScope(scope RegisterScope)
SetRegisterScope persists register flags for standalone verify.
func (*Manager) SetVersions ¶
SetVersions stores component versions used during registration.
type Phase ¶
type Phase string
Phase is an installation phase persisted in state.json.
const ( PhaseCurrent Phase = "current" PhaseK3s Phase = "k3s" PhaseCalico Phase = "calico" PhaseLiqo Phase = "liqo" PhasePeering Phase = "peering" PhaseOffloading Phase = "offloading" PhaseInboundPeering Phase = "inbound_peering" PhaseOperatorInstall Phase = "operator_install" PhaseComplete Phase = "complete" PhaseFailed Phase = "failed" )
func ReconcilePhase ¶
ReconcilePhase updates phase based on detected installed components.
type RegisterScope ¶
type RegisterScope struct {
DisableOffloading bool `json:"disable_offloading,omitempty"`
SkipOperatorInstall bool `json:"skip_operator_install,omitempty"`
HypervisorDriver string `json:"hypervisor_driver,omitempty"`
OperatorNamespace string `json:"operator_namespace,omitempty"` // optional offload ns
VNCGatewayNamespace string `json:"vnc_gateway_namespace,omitempty"`
OffloadNamespaces []string `json:"offload_namespaces,omitempty"`
}
RegisterScope is the subset of register flags that affect post-install verify.
type State ¶
type State struct {
AgentID string `json:"agent_id,omitempty"` // Agent ID (UUID) generated by backend
AgentName string `json:"agent_name,omitempty"` // Agent name (user-provided)
RegistrationTime time.Time `json:"registration_time,omitempty"` // When agent was registered
Phase Phase `json:"phase"` // current|k3s|calico|liqo|peering|offloading|complete|failed
LastUpdated time.Time `json:"last_updated"` // Last state update timestamp
RollbackAvailable bool `json:"rollback_available"` // Whether rollback is available
Checkpoints []Checkpoint `json:"checkpoints"` // Installation checkpoints
LastError *ErrorInfo `json:"last_error,omitempty"` // Last error information
Versions map[string]string `json:"versions,omitempty"` // Component versions used at register
// RegisterScope stores register flags needed by standalone cluster verify.
RegisterScope *RegisterScope `json:"register_scope,omitempty"`
}
State represents the installation state