Documentation ¶
Index ¶
- Constants
- Variables
- func ExecuteTask(t Task) error
- func GenTaskLogFileDir(basePath, taskName string) string
- func GetAllActions(aTask Task) []action.Action
- func RegisterProcessor(taskType Type, proc Processor) error
- func StartTask(t Task) error
- type Base
- func (b *Base) GetActions() []action.Action
- func (b *Base) GetCreationTimestamp() time.Time
- func (b *Base) GetErr() *pb.Error
- func (b *Base) GetLogFileDir() string
- func (b *Base) GetName() string
- func (b *Base) GetParent() string
- func (b *Base) GetPriority() int
- func (b *Base) GetStatus() Status
- func (b *Base) GetSubTasks() []Task
- func (b *Base) GetType() Type
- func (b *Base) SetErr(err *pb.Error)
- func (b *Base) SetLogFileDir(path string)
- func (b *Base) SetStatus(status Status)
- type CheckNetworkRequirementsTask
- type CheckNetworkRequirementsTaskConfig
- type DeployEtcdTask
- type DeployEtcdTaskConfig
- type DeployMasterTaskConfig
- type DeployTask
- type DeployTaskConfig
- type DeployWorkerProcessor
- type DeployWorkerTaskConfig
- type ExtraResult
- type FetchKubeConfigTask
- type FetchKubeConfigTaskConfig
- type InitMasterTask
- type InitMasterTaskConfig
- type JoinMasterTask
- type JoinMasterTaskConfig
- type NodeCheckTask
- type NodeCheckTaskConfig
- type NodeInitTask
- type NodeInitTaskConfig
- type Operation
- type Priority
- type Processor
- type Status
- type Store
- type Task
- func NewCheckNetworkRequirementsTask(name string, config *CheckNetworkRequirementsTaskConfig) (Task, error)
- func NewDeployEtcdTask(taskName string, taskConfig *DeployEtcdTaskConfig) (Task, error)
- func NewDeployMasterTask(taskName string, taskConfig *DeployMasterTaskConfig) (Task, error)
- func NewDeployTask(taskName string, taskConfig *DeployTaskConfig) (Task, error)
- func NewDeployWorkerTask(taskName string, taskConfig *DeployWorkerTaskConfig) (Task, error)
- func NewFetchKubeConfigTask(taskName string, taskConfig *FetchKubeConfigTaskConfig) (Task, error)
- func NewInitMasterTask(taskName string, taskConfig *InitMasterTaskConfig) (Task, error)
- func NewJoinMasterTask(taskName string, taskConfig *JoinMasterTaskConfig) (Task, error)
- func NewNodeCheckTask(taskName string, taskConfig *NodeCheckTaskConfig) (Task, error)
- func NewNodeInitTask(taskName string, taskConfig *NodeInitTaskConfig) (Task, error)
- func NewTestConnectionTask(taskName string, taskConfig *TestConnectionTaskConfig) (Task, error)
- type TestConnectionTask
- type TestConnectionTaskConfig
- type Type
Constants ¶
const ( InitMasterOperation Operation = "init" InitMasterPriority Priority = 10 )
const ( JointMasterOperation Operation = "join" JoinMasterPriority Priority = 20 )
Variables ¶
Functions ¶
func ExecuteTask ¶
ExecuteTask starts the task's execution and wait it to finish.
func GenTaskLogFileDir ¶
GenTaskLogFileDir is a helper to return the log file dir based on base path and task name
func GetAllActions ¶
GetAllActions returns all actions of a task, including its direct actions and its subtasks' actions recursively.
func RegisterProcessor ¶
RegisterProcessor is to register a Processor for a task type
Types ¶
type Base ¶
type Base struct { Name string TaskType Type Actions []action.Action Status Status Err *pb.Error LogFileDir string CreationTimestamp time.Time SubTasks []Task Priority int Parent string }
func (*Base) GetActions ¶
func (*Base) GetCreationTimestamp ¶
func (*Base) GetLogFileDir ¶
func (*Base) GetPriority ¶
func (*Base) GetSubTasks ¶
func (*Base) SetLogFileDir ¶
type CheckNetworkRequirementsTask ¶
type CheckNetworkRequirementsTask struct { Base Nodes []*pb.Node NetworkOptions *pb.NetworkOptions }
type CheckNetworkRequirementsTaskConfig ¶
type CheckNetworkRequirementsTaskConfig struct { Nodes []*pb.Node NetworkOptions *pb.NetworkOptions LogFileBasePath string }
CheckNetworkRequirementsTaskConfig configuration to create a CheckNetworkRequirements task.
type DeployEtcdTask ¶
type DeployEtcdTaskConfig ¶
type DeployEtcdTaskConfig struct { Nodes []*pb.Node LogFileBasePath string Priority int Parent string }
DeployEtcdTaskConfig represents the config for a deploy etcd task.
type DeployMasterTaskConfig ¶
type DeployMasterTaskConfig struct { CertKey string EtcdNodes []*pb.Node Nodes []*pb.Node ClusterConfig *pb.ClusterConfig LogFileBasePath string Priority int Parent string }
DeploymasterTaskConfig represents the config for a deploy master task.
type DeployTask ¶
type DeployTask struct { Base NodeConfigs []*pb.NodeDeployConfig ClusterConfig *pb.ClusterConfig }
type DeployTaskConfig ¶
type DeployTaskConfig struct { NodeConfigs []*pb.NodeDeployConfig ClusterConfig *pb.ClusterConfig LogFileBasePath string Priority int }
DeployTaskConfig represents the config for a deploy task.
type DeployWorkerProcessor ¶
type DeployWorkerProcessor struct { }
func (*DeployWorkerProcessor) SplitTask ¶
func (processor *DeployWorkerProcessor) SplitTask(task Task) error
Spilt the task into one or more node deploy worker actions
type DeployWorkerTaskConfig ¶
type DeployWorkerTaskConfig struct { MasterNodes []*protos.Node Nodes []*protos.NodeDeployConfig ClusterConfig *protos.ClusterConfig LogFileBasePath string Priority int Parent string }
type ExtraResult ¶
ExtraResult defines the interface to process the task's extra result, Task extra result is the specific output of a task, which is not the task's status and err. Task processor can implment this interface optionally.
type FetchKubeConfigTask ¶
type FetchKubeConfigTaskConfig ¶
FetchKubeConfigTaskConfig represents the config for a fetch-kube-config task.
type InitMasterTask ¶
type InitMasterTaskConfig ¶
type JoinMasterTask ¶
type JoinMasterTaskConfig ¶
type JoinMasterTaskConfig struct {
// contains filtered or unexported fields
}
type NodeCheckTask ¶
type NodeCheckTask struct { Base NodeConfigs []*pb.NodeCheckConfig NetworkOptions *pb.NetworkOptions }
type NodeCheckTaskConfig ¶
type NodeCheckTaskConfig struct { NodeConfigs []*pb.NodeCheckConfig NetworkOptions *pb.NetworkOptions LogFileBasePath string Priority int }
NodeCheckTaskConfig represents the config for a node check task.
type NodeInitTask ¶
type NodeInitTask struct { Base NodeConfigs []*pb.NodeDeployConfig ClusterConfig *pb.ClusterConfig }
type NodeInitTaskConfig ¶
type NodeInitTaskConfig struct { NodeConfigs []*pb.NodeDeployConfig ClusterConfig *pb.ClusterConfig LogFileBasePath string Priority int Parent string }
NodeInitTaskConfig represents the config for a node init task
type Processor ¶
type Processor interface { // No need to set the task status in this method, the caller should do that. SplitTask(task Task) error }
Processor defines the interface for all task processors
func NewProcessor ¶
NewProcessor is a simple factory method to return a task processor based on task type.
type Store ¶
type Store interface { GetTask(name string) Task // Add a task, if the task already exists (task name is same), return an error AddTask(task Task) error // Update a task, if the task doesn't exist (task name is same), return an error UpdateTask(task Task) error // Update a task, if the task doesn't exist (task name is same), add it. UpdateOrAddTask(task Task) error }
func GetGlobalCacheStore ¶
func GetGlobalCacheStore() Store
type Task ¶
type Task interface { GetName() string GetType() Type GetStatus() Status SetStatus(Status) GetErr() *pb.Error SetErr(*pb.Error) GetLogFileDir() string SetLogFileDir(string) GetActions() []action.Action GetCreationTimestamp() time.Time // Sub tasks are Task too. GetSubTasks() []Task // GetPriority returns the priority of the task: smaller value means higher prioirty. // A task should wait until all higher priority tasks are done GetPriority() int // If a task is not a sub task, this will return "" GetParent() string }
Task represents something to do and typically includes one or more actions.
func NewCheckNetworkRequirementsTask ¶
func NewCheckNetworkRequirementsTask( name string, config *CheckNetworkRequirementsTaskConfig) (Task, error)
NewCheckNetworkRequirementsTask create a CheckNetworkRequirements task to check prerequisites of deploying network.
func NewDeployEtcdTask ¶
func NewDeployEtcdTask(taskName string, taskConfig *DeployEtcdTaskConfig) (Task, error)
NewDeployEtcdTask returns a deploy etcd task based on the config. User should use this function to create a deploy etcd task.
func NewDeployMasterTask ¶
func NewDeployMasterTask(taskName string, taskConfig *DeployMasterTaskConfig) (Task, error)
NewDeploymasterTask returns a deploy master task based on the config. User should use this function to create a deploy master task.
func NewDeployTask ¶
func NewDeployTask(taskName string, taskConfig *DeployTaskConfig) (Task, error)
NewDeployTask returns a deploy task based on the config. User should use this function to create a deploy task.
func NewDeployWorkerTask ¶
func NewDeployWorkerTask(taskName string, taskConfig *DeployWorkerTaskConfig) (Task, error)
NewDeployWorkerTask returns a deploy k8s worker task based on the config. User should use this function to create a deploy worker task.
func NewFetchKubeConfigTask ¶
func NewFetchKubeConfigTask(taskName string, taskConfig *FetchKubeConfigTaskConfig) (Task, error)
NewFetchKubeConfigTask returns a fetch-kube-config task based on the config. User should use this function to create a fetch-kube-config task.
func NewInitMasterTask ¶
func NewInitMasterTask(taskName string, taskConfig *InitMasterTaskConfig) (Task, error)
func NewJoinMasterTask ¶
func NewJoinMasterTask(taskName string, taskConfig *JoinMasterTaskConfig) (Task, error)
func NewNodeCheckTask ¶
func NewNodeCheckTask(taskName string, taskConfig *NodeCheckTaskConfig) (Task, error)
NewNodeCheckTask returns a node check task based on the config. User should use this function to create a node check task.
func NewNodeInitTask ¶
func NewNodeInitTask(taskName string, taskConfig *NodeInitTaskConfig) (Task, error)
NewNodeInitTask returns a common node init task based on the config. User should use this function to create a common node init task.
func NewTestConnectionTask ¶
func NewTestConnectionTask(taskName string, taskConfig *TestConnectionTaskConfig) (Task, error)
NewTestConnectionTask returns a test-connection task based on the config. User should use this function to create a test-connection task.
type TestConnectionTask ¶
type TestConnectionTaskConfig ¶
TestConnectionTaskConfig represents the config for a test-connection task.
type Type ¶
type Type string
Type represents the type of a task
const TaskTypeCheckNetworkRequirements Type = "CheckNetworkRequirements"
const TaskTypeDeploy Type = "Deploy"
const TaskTypeDeployEtcd Type = "DeployEtcd"
const TaskTypeDeployMaster Type = "DeployMaster"
const TaskTypeDeployWorker Type = "DeployWorker"
const TaskTypeFetchKubeConfig Type = "FetchKubeConfig"
const TaskTypeInitMaster Type = "InitMaster"
const TaskTypeJoinMaster Type = "JoinMaster"
const TaskTypeNodeCheck Type = "NodeCheck"
const TaskTypeNodeInit Type = "NodeInit"
const TaskTypeTestConnection Type = "TestConnection"
Source Files ¶
- check_network_requirements.go
- deploy_etcd_processor.go
- deploy_etcd_task.go
- deploy_master_processor.go
- deploy_master_task.go
- deploy_processor.go
- deploy_task.go
- deploy_worker_processor.go
- deploy_worker_task.go
- fetch_kube_config_processor.go
- fetch_kube_config_task.go
- init_master_processor.go
- init_master_task.go
- join_master_processor.go
- join_master_task.go
- node_check_processor.go
- node_check_task.go
- node_init_processor.go
- node_init_task.go
- processor.go
- store.go
- task.go
- test_connection_processor.go
- test_connection_task.go