Documentation ¶
Index ¶
- Constants
- func FSMSpec(config FSMConfig) fsm.FSMSpecFunc
- func NewFSM(config FSMConfig) (*fsm.FSM, error)
- type FSMConfig
- type Peer
- func (p *Peer) Complete(ctx context.Context, opKey ops.SiteOperationKey) error
- func (p *Peer) Execute(req *installpb.ExecuteRequest, stream installpb.Agent_ExecuteServer) (err error)
- func (p *Peer) HandleAborted(ctx context.Context) error
- func (p *Peer) HandleCompleted(ctx context.Context) error
- func (p *Peer) HandleStopped(context.Context) error
- func (p *Peer) Run(listener net.Listener) error
- func (p *Peer) SetPhase(req *installpb.SetStateRequest) error
- func (p *Peer) Stop(ctx context.Context) error
- type PeerConfig
Constants ¶
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
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 ¶
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 ¶
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 ¶
HandleAborted completes the operation by dispatching an abort event to the client. Implements server.Completer
func (*Peer) HandleCompleted ¶
HandleCompleted completes the operation by dispatching a completion event to the client. Implements server.Completer
func (*Peer) HandleStopped ¶
HandleStopped shuts down the server Implements server.Completer
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