Documentation ¶
Index ¶
- Constants
- func CheckCPUExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
- func CheckDistributionExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
- func CheckDockerExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
- func CheckKernelExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
- func CheckMemoryExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
- func CheckPortOccupiedExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
- func CheckRootDiskExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
- func CheckSysManagerExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
- func CheckSysPrefExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
- func ExecuteAction(act Action, wg *sync.WaitGroup)
- func GenActionLogFilePath(basePath, actionName string, nodeName string) string
- func GenActionName(actionType Type) string
- func InitAsyncExecutor(item it.ItemEnum, ncAction *NodeInitAction, wg *sync.WaitGroup)
- func RegisterExecutor(actionType Type, exec Executor) error
- func UpdateInitItems(initAction *NodeInitAction, report *NodeInitItem)
- type Action
- func NewConnectivityCheckAction(cfg *ConnectivityCheckActionConfig) (Action, error)
- func NewDeployEtcdAction(cfg *DeployEtcdActionConfig) (Action, error)
- func NewDeployWorkerAction(config *DeployWorkerActionConfig) (Action, error)
- func NewFetchKubeConfigAction(cfg *FetchKubeConfigActionConfig) (Action, error)
- func NewInitMasterAction(cfg *InitMasterActionConfig) (Action, error)
- func NewJoinMasterAction(cfg *JoinMasterActionConfig) (Action, error)
- func NewNodeCheckAction(cfg *NodeCheckActionConfig) (Action, error)
- func NewNodeInitAction(cfg *NodeInitActionConfig) (Action, error)
- func NewTestConnectionAction(cfg *TestConnectionActionConfig) (Action, error)
- type Base
- func (b *Base) GetCreationTimestamp() time.Time
- func (b *Base) GetErr() *pb.Error
- func (b *Base) GetExecuteLogBuffer() io.ReadWriter
- func (b *Base) GetLogFilePath() string
- func (b *Base) GetName() string
- func (b *Base) GetNode() *pb.Node
- func (b *Base) GetStatus() Status
- func (b *Base) GetType() Type
- func (b *Base) SetErr(err *pb.Error)
- func (b *Base) SetExecuteLogBuffer(buf io.ReadWriter)
- func (b *Base) SetLogFilePath(path string)
- func (b *Base) SetStatus(status Status)
- type ConnectivityCheckAction
- type ConnectivityCheckActionConfig
- type ConnectivityCheckItem
- type DeployEtcdAction
- type DeployEtcdActionConfig
- type DeployWorkerAction
- type DeployWorkerActionConfig
- type Executor
- type FetchKubeConfigAction
- type FetchKubeConfigActionConfig
- type InitMasterAction
- type InitMasterActionConfig
- type ItemStatus
- type JoinMasterAction
- type JoinMasterActionConfig
- type NodeCheckAction
- type NodeCheckActionConfig
- type NodeCheckItem
- type NodeInitAction
- type NodeInitActionConfig
- type NodeInitItem
- type Status
- type TestConnectionAction
- type TestConnectionActionConfig
- type Type
Constants ¶
const ( ItemErrEmpty = "empty parameter" ItemErrOperation = "failed to generate operations" ItemErrScript = "invalid script" ItemHelperEmpty = "please input suitable check item" ItemHelperOperation = "please check your operations" ItemHelperScript = "please check your script" CheckPassed = "check passed" CheckFailed = "check failed" )
constant value for check
const ( InitPassed = "init passed" InitFailed = "init failed" )
Variables ¶
This section is empty.
Functions ¶
func CheckCPUExecutor ¶
func CheckCPUExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
goroutine as executor for check CPU
func CheckDistributionExecutor ¶
func CheckDistributionExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
goroutine as executor for check distribution
func CheckDockerExecutor ¶
func CheckDockerExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
goroutine as executor for check docker
func CheckKernelExecutor ¶
func CheckKernelExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
goroutine as executor for check kernel
func CheckMemoryExecutor ¶
func CheckMemoryExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
goroutine as executor for check memory
func CheckPortOccupiedExecutor ¶
func CheckPortOccupiedExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
goroutine as executor for port occupied check
func CheckRootDiskExecutor ¶
func CheckRootDiskExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
goroutine as executor for check disk
func CheckSysManagerExecutor ¶
func CheckSysManagerExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
goroutine as executor for check system manager
func CheckSysPrefExecutor ¶
func CheckSysPrefExecutor(ncAction *NodeCheckAction, wg *sync.WaitGroup)
goroutine as executor for check system preference
func ExecuteAction ¶
ExecuteAction creates and run the executor for an action, a *sync.WaitGroup should be passed in.
func GenActionLogFilePath ¶
GenActionLogFilePath is a helper to return a file path based on the base path and aciton name
func GenActionName ¶
GenActionName generates a unique action name with the action type as prefix.
func InitAsyncExecutor ¶
func InitAsyncExecutor(item it.ItemEnum, ncAction *NodeInitAction, wg *sync.WaitGroup)
goroutine exec item init event
func RegisterExecutor ¶
RegisterExecutor is to register an Executor for an action type
func UpdateInitItems ¶
func UpdateInitItems(initAction *NodeInitAction, report *NodeInitItem)
update init items with matching name
Types ¶
type Action ¶
type Action interface { GetName() string GetStatus() Status SetStatus(Status) GetType() Type GetErr() *pb.Error SetErr(*pb.Error) GetLogFilePath() string SetLogFilePath(string) GetCreationTimestamp() time.Time GetNode() *pb.Node GetExecuteLogBuffer() io.ReadWriter SetExecuteLogBuffer(io.ReadWriter) }
Action repsents the definition of executable command(s) in a node, multiple actions can be executed concurrently.
func NewConnectivityCheckAction ¶
func NewConnectivityCheckAction(cfg *ConnectivityCheckActionConfig) (Action, error)
NewConnectivityCheckAction creates an action to check connectivity from soruce to destination.
func NewDeployEtcdAction ¶
func NewDeployEtcdAction(cfg *DeployEtcdActionConfig) (Action, error)
NewDeployEtcdAction returns a deploy etcd action based on the config. User should use this function to create a deploy etcd action.
func NewDeployWorkerAction ¶
func NewDeployWorkerAction(config *DeployWorkerActionConfig) (Action, error)
func NewFetchKubeConfigAction ¶
func NewFetchKubeConfigAction(cfg *FetchKubeConfigActionConfig) (Action, error)
NewFetchKubeConfigAction returns a fetch-kube-config action based on the config. User should use this function to create a fetch-kube-config action.
func NewInitMasterAction ¶
func NewInitMasterAction(cfg *InitMasterActionConfig) (Action, error)
func NewJoinMasterAction ¶
func NewJoinMasterAction(cfg *JoinMasterActionConfig) (Action, error)
func NewNodeCheckAction ¶
func NewNodeCheckAction(cfg *NodeCheckActionConfig) (Action, error)
NewNodeCheckAction returns a node check action based on the config. User should use this function to create a node check action.
func NewNodeInitAction ¶
func NewNodeInitAction(cfg *NodeInitActionConfig) (Action, error)
NewNodeInitAction returns a node init action based on the config. User should use this function to create a node init action.
func NewTestConnectionAction ¶
func NewTestConnectionAction(cfg *TestConnectionActionConfig) (Action, error)
NewTestConnectionAction returns a test-connection action based on the config. User should use this function to create a test-connection action.
type Base ¶
type Base struct { Name string ActionType Type Status Status Err *pb.Error LogFilePath string CreationTimestamp time.Time Node *pb.Node ExecuteLogBuffer io.ReadWriter }
Base is the basic metadata of an action
func (*Base) GetCreationTimestamp ¶
func (*Base) GetExecuteLogBuffer ¶
func (b *Base) GetExecuteLogBuffer() io.ReadWriter
func (*Base) GetLogFilePath ¶
func (*Base) SetExecuteLogBuffer ¶
func (b *Base) SetExecuteLogBuffer(buf io.ReadWriter)
func (*Base) SetLogFilePath ¶
type ConnectivityCheckAction ¶
type ConnectivityCheckActionConfig ¶
type ConnectivityCheckActionConfig struct { SourceNode *pb.Node DestinationNode *pb.Node ConnectivityCheckItems []ConnectivityCheckItem LogFileBasePath string }
ConnectivityCheckActionConfig configuration of checking connectivity from soruce to destination.
type ConnectivityCheckItem ¶
type ConnectivityCheckItem struct { Protocol consts.Protocol Port uint16 CheckResult *pb.ItemCheckResult }
ConnectivityCheckItem an item representing one check item of checking whether a node can connect to another by the protocol and port.
type DeployEtcdAction ¶
type DeployEtcdActionConfig ¶
type DeployEtcdActionConfig struct { CaCrt *x509.Certificate CaKey crypto.Signer Node *pb.Node ClusterNodes []*pb.Node LogFileBasePath string }
DeployEtcdActionConfig represents the config for a ectd deploy in a node
type DeployWorkerAction ¶
type DeployWorkerAction struct { Base // contains filtered or unexported fields }
type DeployWorkerActionConfig ¶
type DeployWorkerActionConfig struct { NodeCfg *pb.NodeDeployConfig ClusterConfig *pb.ClusterConfig MasterNodes []*pb.Node LogFileBasePath string }
type Executor ¶
Executor represents the interface of an action executor. Concrete executors implements the logic of actions.
func NewExecutor ¶
NewExecutor is a simple factory method to return an action executor based on action type.
type FetchKubeConfigAction ¶
type FetchKubeConfigActionConfig ¶
FetchKubeConfigActionConfig represents the config for a action to fetch the kube config
type InitMasterAction ¶
type InitMasterActionConfig ¶
type ItemStatus ¶
type ItemStatus string
ItemStatus represents the status of an action item
const ( ItemPending ItemStatus = "pending" ItemDoing ItemStatus = "doing" ItemDone ItemStatus = "done" // means success ItemFailed ItemStatus = "failed" )
type JoinMasterAction ¶
type JoinMasterActionConfig ¶
type NodeCheckAction ¶
type NodeCheckAction struct { Base sync.RWMutex NodeCheckConfig *pb.NodeCheckConfig CheckItems []*NodeCheckItem }
type NodeCheckActionConfig ¶
type NodeCheckActionConfig struct { NodeCheckConfig *pb.NodeCheckConfig LogFileBasePath string }
NodeCheckActionConfig represents the config for a node check action
type NodeCheckItem ¶
type NodeCheckItem struct { Name string Description string Status ItemStatus Err *pb.Error }
func ExecuteCheckScript ¶
func ExecuteCheckScript(item check.ItemEnum, config *pb.NodeCheckConfig, checkItemReport *NodeCheckItem) (string, *NodeCheckItem, error)
due to items, ItemsCheckScripts exec remote scripts and return std, report, error
type NodeInitAction ¶
type NodeInitAction struct { Base sync.RWMutex NodeInitConfig *pb.NodeDeployConfig NodesConfig []*pb.NodeDeployConfig ClusterConfig *pb.ClusterConfig InitItems []*NodeInitItem }
type NodeInitActionConfig ¶
type NodeInitActionConfig struct { NodeInitConfig *pb.NodeDeployConfig NodesConfig []*pb.NodeDeployConfig ClusterConfig *pb.ClusterConfig LogFileBasePath string }
NodeInitActionConfig represents the config for a node init action
type NodeInitItem ¶
type NodeInitItem struct { Name string Description string Status ItemStatus Err *pb.Error }
func ExecuteInitScript ¶
func ExecuteInitScript(item it.ItemEnum, action *NodeInitAction, initItemReport *NodeInitItem) (string, *NodeInitItem, error)
due to items, ItemInitScripts exec remote scripts and return std, report, error
type TestConnectionAction ¶
type TestConnectionAction struct {
Base
}
type TestConnectionActionConfig ¶
TestConnectionActionConfig represents the config for a test-connection action
type Type ¶
type Type string
Type represents the type of an action
const ActionTypeConnectivityCheck Type = "ConnectivityCheck"
const ActionTypeDeployEtcd Type = "DeployEtcd"
const ActionTypeDeployWorker Type = "DeployWorker"
const ActionTypeFetchKubeConfig Type = "FetchKubeConfig"
const ActionTypeInitMaster Type = "InitMaster"
const ActionTypeJoinMaster Type = "JoinMaster"
const ActionTypeNodeCheck Type = "NodeCheck"
const ActionTypeNodeInit Type = "NodeInit"
const ActionTypeTestConnection Type = "TestConnection"
Source Files ¶
- action.go
- connectivity_check_action.go
- deploy_etcd_action.go
- deploy_etcd_executor.go
- deploy_worker_action.go
- deploy_worker_executor.go
- executor.go
- fetch_kube_config_action.go
- fetch_kube_config_executor.go
- init_master_action.go
- init_master_executor.go
- join_master_action.go
- join_master_executor.go
- node_check_action.go
- node_check_executor.go
- node_init_action.go
- node_init_executor.go
- test_connection_action.go
- test_connection_executor.go