expand

package
v0.0.0-...-3bfe646 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2023 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ChecksPhase runs preflight checks on the joining node
	ChecksPhase = "/checks"
	// PreHookPhase runs pre-expand application hook
	PreHookPhase = "/preHook"
	// EtcdBackupPhase backs up etcd data on a master node
	EtcdBackupPhase = "/etcdBackup"
	// EtcdPhase adds joining node to cluster's etcd cluster
	EtcdPhase = "/etcd"
	// SystemPhase installs system software on the joining node
	SystemPhase = "/system"
	// WaitPlanetPhase waits for planet to start
	WaitPlanetPhase = "/wait/planet"
	// WaitK8sPhase waits for joining node to register with Kubernetes
	WaitK8sPhase = "/wait/k8s"
	// WaitTeleportPhase waits for Teleport on the joining node to join the cluster
	WaitTeleportPhase = "/wait/teleport"
	// PostHookPhase runs post-expand application hook
	PostHookPhase = "/postHook"
	// ElectPhase enables leader election on master node
	ElectPhase = "/elect"
	// StartAgentPhase starts RPC agent
	StartAgentPhase = "/startAgent"
	// StopAgentPhase stops RPC agent
	StopAgentPhase = "/stopAgent"
)

Variables

This section is empty.

Functions

func FSMSpec

func FSMSpec(config FSMConfig) fsm.FSMSpecFunc

FSMSpec returns a function that returns an appropriate phase executor

func NewFSM

func NewFSM(config FSMConfig) (*fsm.FSM, error)

NewFSM returns a new state machine for expand operation

Types

type FSMConfig

type FSMConfig struct {
	// OperationKey is the key of the join operation
	OperationKey ops.SiteOperationKey
	// Operator is operator of the cluster the node is joining to
	Operator ops.Operator
	// Apps is apps service of the cluster the node is joining to
	Apps app.Applications
	// Packages is package service of the cluster the node is joining to
	Packages pack.PackageService
	// LocalBackend is local backend of the joining node
	LocalBackend storage.LocalBackend
	// LocalApps is local apps service of the joining node
	LocalApps app.Applications
	// LocalPackages is local package service of the joining node
	LocalPackages *localpack.PackageServer
	// JoinBackend is the local backend that stores join-specific data
	JoinBackend storage.Backend
	// Spec is the FSM spec
	Spec fsm.FSMSpecFunc
	// Credentials is the credentials for gRPC agents
	Credentials credentials.TransportCredentials
	// Runner is optional runner to use when running remote commands
	Runner rpc.AgentRepository
	// DebugMode turns on FSM debug mode
	DebugMode bool
	// Insecure turns on FSM insecure mode
	Insecure bool
}

FSMConfig is the expand FSM configuration

func (*FSMConfig) CheckAndSetDefaults

func (c *FSMConfig) CheckAndSetDefaults() error

CheckAndSetDefaults validates expand FSM configuration and sets defaults

type Peer

type Peer struct {
	PeerConfig
	// contains filtered or unexported fields
}

Peer is a client that manages joining the cluster

func NewPeer

func NewPeer(config PeerConfig) (*Peer, error)

NewPeer returns new cluster peer client

func (*Peer) Complete

func (p *Peer) Complete(ctx context.Context, opKey ops.SiteOperationKey) error

Complete manually completes the operation given with opKey. Implements server.Executor

func (*Peer) Execute

func (p *Peer) Execute(req *installpb.ExecuteRequest, stream installpb.Agent_ExecuteServer) (err error)

Execute executes the peer operation (join or just serving an agent). Implements server.Executor

func (*Peer) HandleAborted

func (p *Peer) HandleAborted(ctx context.Context) error

HandleAborted completes the operation by dispatching an abort event to the client. Implements server.Completer

func (*Peer) HandleCompleted

func (p *Peer) HandleCompleted(ctx context.Context) error

HandleCompleted completes the operation by dispatching a completion event to the client. Implements server.Completer

func (*Peer) HandleStopped

func (p *Peer) HandleStopped(context.Context) error

HandleStopped shuts down the server Implements server.Completer

func (*Peer) Run

func (p *Peer) Run(listener net.Listener) error

Run runs the peer operation

func (*Peer) SetPhase

func (p *Peer) SetPhase(req *installpb.SetStateRequest) error

SetPhase sets phase state without executing it.

func (*Peer) Stop

func (p *Peer) Stop(ctx context.Context) error

Stop shuts down this RPC agent Implements signals.Stopper

type PeerConfig

type PeerConfig struct {
	// Peers is a list of peer addresses
	Peers []string
	// AdvertiseAddr is advertise address of this node
	AdvertiseAddr string
	// ServerAddr is optional address of the agent server.
	// It will be derived from agent instructions if unspecified
	ServerAddr string
	// WatchCh is channel that relays peer reconnect events
	WatchCh chan rpcserver.WatchEvent
	// RuntimeConfig is peer's runtime configuration
	pb.RuntimeConfig
	// FieldLogger is used for logging
	log.FieldLogger
	// DebugMode turns on FSM debug mode
	DebugMode bool
	// Insecure turns on FSM insecure mode
	Insecure bool
	// LocalBackend is local backend of the joining node
	LocalBackend storage.LocalBackend
	// LocalApps is local apps service of the joining node
	LocalApps app.Applications
	// LocalPackages is local package service of the joining node
	LocalPackages *localpack.PackageServer
	// LocalClusterClient is a factory for creating a client to the installed cluster
	LocalClusterClient func(...httplib.ClientOption) (*opsclient.Client, error)
	// JoinBackend is the local backend where join-specific operation data is stored
	JoinBackend storage.Backend
	// OperationID is the ID of existing join operation created via UI
	OperationID string
	// StateDir defines where peer will store operation-specific data
	StateDir string
	// SkipWizard specifies to the peer agents that the peer is not a wizard
	// and attempts to contact the wizard should be skipped
	SkipWizard bool
}

PeerConfig defines the configuration for a peer joining the cluster

func (*PeerConfig) CheckAndSetDefaults

func (c *PeerConfig) CheckAndSetDefaults() (err error)

CheckAndSetDefaults checks the parameters and autodetects some defaults

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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