Documentation
¶
Index ¶
- Constants
- func FormatAndMountVolumeCmd(device, mountPoint, fileSystem, mountOptions string) string
- func HandleSubtask(ctx context.Context, task *models.Task, handler ProviderHandlerInterface) error
- func SplitJobIntoTasks(ctx context.Context, job *models.Job, advancedParam ...string) (*models.TaskLayer, error)
- func UmountVolumeCmd(mountPoint string) string
- func WaitSubtask(ctx context.Context, task *models.Task, handler ProviderHandlerInterface) error
- type Credential
- type Frame
- func (f *Frame) AddClusterNodesLayer() *models.TaskLayer
- func (f *Frame) AttachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
- func (f *Frame) CreateClusterLayer() *models.TaskLayer
- func (f *Frame) DeleteClusterLayer() *models.TaskLayer
- func (f *Frame) DeleteClusterNodesLayer() *models.TaskLayer
- func (f *Frame) DetachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
- func (f *Frame) ParseClusterConf(ctx context.Context, versionId, runtimeId, conf string, ...) error
- func (f *Frame) ResizeClusterLayer(roleResizeResources models.RoleResizeResources) *models.TaskLayer
- func (f *Frame) StartClusterLayer() *models.TaskLayer
- func (f *Frame) StopClusterLayer() *models.TaskLayer
- type FrameHandler
- type FrameInterface
- type Frontgate
- func (f *Frontgate) AttachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
- func (f *Frontgate) CreateClusterLayer() *models.TaskLayer
- func (f *Frontgate) DeleteClusterLayer() *models.TaskLayer
- func (f *Frontgate) DetachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
- func (f *Frontgate) StartClusterLayer() *models.TaskLayer
- func (f *Frontgate) StopClusterLayer() *models.TaskLayer
- type Metadata
- func (m *Metadata) GetClusterCnodes() map[string]interface{}
- func (m *Metadata) GetClusterMetadataCnodes() map[string]interface{}
- func (m *Metadata) GetClusterNodeCnodes(nodeIds []string) map[string]interface{}
- func (m *Metadata) GetCmdCnodes(nodeId, cmd string) map[string]interface{}
- func (m *Metadata) GetEmptyClusterCnodes() map[string]interface{}
- func (m *Metadata) GetEmptyClusterNodeCnodes(nodeIds []string) map[string]interface{}
- func (m *Metadata) GetEmptyHostsCnodes(nodeIds []string) map[string]interface{}
- func (m *Metadata) GetEnvCnodes() map[string]interface{}
- func (m *Metadata) GetHostsCnodes(nodeIds []string) map[string]interface{}
- func (m *Metadata) GetScalingCnodes(nodeIds []string, path string) map[string]interface{}
- type MetadataConfig
- type MetadataV1
- func (m *MetadataV1) GetClusterCnodes() map[string]interface{}
- func (m *MetadataV1) GetClusterMetadataCnodes() map[string]interface{}
- func (m *MetadataV1) GetClusterNodeCnodes(nodeIds []string) map[string]interface{}
- func (m *MetadataV1) GetEmptyClusterCnodes() map[string]interface{}
- func (m *MetadataV1) GetEmptyClusterNodeCnodes(nodeIds []string) map[string]interface{}
- func (m *MetadataV1) GetEmptyHostsCnodes(nodeIds []string) map[string]interface{}
- func (m *MetadataV1) GetHostCnodes(nodeId string) map[string]interface{}
- func (m *MetadataV1) GetHostsCnodes(nodeIds []string) map[string]interface{}
- func (m *MetadataV1) GetScalingCnodes(nodeIds []string, path string) map[string]interface{}
- func (m *MetadataV1) GetSelfEnvCnodes(nodeId string) map[string]interface{}
- type Parser
- func (p *Parser) Parse(clusterConf opapp.ClusterConf, clusterWrapper *models.ClusterWrapper) error
- func (p *Parser) ParseAddClusterNode(clusterConf opapp.ClusterConf, clusterWrapper *models.ClusterWrapper) error
- func (p *Parser) ParseCluster(clusterConf opapp.ClusterConf) (*models.Cluster, error)
- func (p *Parser) ParseClusterCommon(clusterConf opapp.ClusterConf, node opapp.Node) (*models.ClusterCommon, error)
- func (p *Parser) ParseClusterLinks(clusterConf opapp.ClusterConf) map[string]*models.ClusterLink
- func (p *Parser) ParseClusterLoadbalancer(node opapp.Node) []*models.ClusterLoadbalancer
- func (p *Parser) ParseClusterNode(node opapp.Node, subnetId string) (map[string]*models.ClusterNodeWithKeyPairs, error)
- func (p *Parser) ParseClusterRole(clusterConf opapp.ClusterConf, node opapp.Node) (*models.ClusterRole, error)
- type ProviderHandlerInterface
Constants ¶
View Source
const ( ActionRunInstances = "RunInstances" ActionStartInstances = "StartInstances" ActionStopInstances = "StopInstances" ActionTerminateInstances = "TerminateInstances" ActionResizeInstances = "ResizeInstances" ActionCreateVolumes = "CreateVolumes" ActionAttachVolumes = "AttachVolumes" ActionDetachVolumes = "DetachVolumes" ActionDeleteVolumes = "DeleteVolumes" ActionResizeVolumes = "ResizeVolumes" ActionFormatAndMountVolume = "FormatAndMountVolume" ActionWaitFrontgateAvailable = "WaitFrontgateAvailable" ActionRegisterMetadata = "RegisterMetadata" ActionRegisterNodesMetadata = "RegisterNodesMetadata" ActionDeregisterMetadata = "DeregisterMetadata" ActionRegisterCmd = "RegisterCmd" ActionDeregisterCmd = "DeregisterCmd" ActionStartConfd = "StartConfd" ActionStopConfd = "StopConfd" ActionSetFrontgateConfig = "SetFrontgateConfig" ActionSetDroneConfig = "SetDroneConfig" ActionPingDrone = "PingDrone" ActionPingFrontgate = "PingFrontgate" PingMetadataBackend = "PingMetadataBackend" ActionRunCommandOnDrone = "RunCommandOnDrone" ActionRemoveContainerOnDrone = "RemoveContainerOnDrone" ActionRemoveContainerOnFrontgate = "RemoveContainerOnFrontgate" ActionRunCommandOnFrontgateNode = "RunCommandOnFrontgateNode" )
View Source
const ( RegisterClustersRootPath = "clusters" RegisterNodeHosts = "hosts" RegisterNodeHost = "host" RegisterNodeCluster = "cluster" RegisterNodeEnv = "env" RegisterNodeLoadbalancer = "loadbalancer" RegisterNodeCmd = "cmd" RegisterNodeCmdId = "id" RegisterNodeCmdTimeout = "timeout" RegisterNodeEndpoint = "endpoints" RegisterNodeAdding = "adding-hosts" RegisterNodeDeleting = "deleting-hosts" RegisterNodeVerticalScalingRoles = "vertical-scaling-roles" )
View Source
const ( // second TimeoutStartConfd = 60 TimeoutStopConfd = 60 TimeoutDeregister = 60 TimeoutRegister = 60 TimeoutFormatAndMountVolume = 600 TimeoutUmountVolume = 120 TimeoutSshKeygen = 120 TimeoutRemoveContainer = 120 TimeoutKeyPair = 60 )
View Source
const ( OpenPitrixBasePath = "/opt/openpitrix/" OpenPitrixExecFile = "/etc/rc.local" OpenPitrixConfPath = OpenPitrixBasePath + "conf/" OpenPitrixSbinPath = OpenPitrixBasePath + "sbin/" OpenPitrixConfFile = "openpitrix.conf" DroneConfFile = "drone.conf" FrontgateConfFile = "frontgate.conf" UpdateFstabFile = "update_fstab.sh" ConfdPath = "/etc/confd/" MetadataLogLevel = "debug" ConfdBackendType = "libconfd-backend-etcdv3" ConfdCmdLogPath = "/opt/openpitrix/log/cmd.log" HostCmdPrefix = "nsenter -t 1 -m -u -n -i sh -c" MetadataNodeName = "metadata" DefaultNodeName = "node" )
View Source
const ( InstanceSize = 20 DefaultMountPoint = "/data" Ext4FileSystem = "ext4" XfsFileSystem = "xfs" DefaultExt4MountOption = "defaults,noatime" DefaultXfsMountOption = "rw,noatime,inode64,allocsize=16m" )
Variables ¶
This section is empty.
Functions ¶
func FormatAndMountVolumeCmd ¶
func HandleSubtask ¶ added in v0.2.1
func SplitJobIntoTasks ¶ added in v0.2.1
func UmountVolumeCmd ¶
func WaitSubtask ¶ added in v0.2.1
Types ¶
type Credential ¶ added in v0.2.1
type Frame ¶
type Frame struct {
Ctx context.Context
Job *models.Job
ClusterWrapper *models.ClusterWrapper
FrontgateClusterWrapper *models.ClusterWrapper
Runtime *runtimeclient.Runtime
ImageConfig *config.ImageConfig
}
func (*Frame) AddClusterNodesLayer ¶
func (*Frame) AttachKeyPairsLayer ¶ added in v0.1.7
func (f *Frame) AttachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
func (*Frame) CreateClusterLayer ¶
func (*Frame) DeleteClusterLayer ¶
func (*Frame) DeleteClusterNodesLayer ¶
func (*Frame) DetachKeyPairsLayer ¶ added in v0.1.7
func (f *Frame) DetachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
func (*Frame) ParseClusterConf ¶ added in v0.1.7
func (*Frame) ResizeClusterLayer ¶ added in v0.2.1
func (f *Frame) ResizeClusterLayer(roleResizeResources models.RoleResizeResources) *models.TaskLayer
func (*Frame) StartClusterLayer ¶
func (*Frame) StopClusterLayer ¶
type FrameHandler ¶
func (*FrameHandler) WaitFrontgateAvailable ¶
func (f *FrameHandler) WaitFrontgateAvailable(task *models.Task) error
type FrameInterface ¶
type FrameInterface interface {
CreateClusterLayer() *models.TaskLayer
StopClusterLayer() *models.TaskLayer
StartClusterLayer() *models.TaskLayer
DeleteClusterLayer() *models.TaskLayer
AddClusterNodesLayer() *models.TaskLayer
DeleteClusterNodesLayer() *models.TaskLayer
ResizeClusterLayer(roleResizeResources models.RoleResizeResources) *models.TaskLayer
AttachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
DetachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
ParseClusterConf(ctx context.Context, versionId, runtimeId, conf string, clusterWrapper *models.ClusterWrapper) error
}
func GetFrameInterface ¶ added in v0.2.1
type Frontgate ¶
type Frontgate struct {
*Frame
}
func (*Frontgate) AttachKeyPairsLayer ¶ added in v0.1.8
func (f *Frontgate) AttachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
func (*Frontgate) CreateClusterLayer ¶
func (*Frontgate) DeleteClusterLayer ¶
func (*Frontgate) DetachKeyPairsLayer ¶ added in v0.1.8
func (f *Frontgate) DetachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
func (*Frontgate) StartClusterLayer ¶
func (*Frontgate) StopClusterLayer ¶
type Metadata ¶
type Metadata struct {
ClusterWrapper *models.ClusterWrapper
Ctx context.Context
}
func (*Metadata) GetClusterCnodes ¶
Compose cluster info into the following format, in order to register cluster to configuration management service.
{
"<cluster_id>": {
"hosts": {
<The data from the function GetHostsCnodes below>
},
"cluster": {
<The data from the function GetClusterMetadataCnodes below>
},
"env": { # optional
<The data from the function GetEnvCnodes below>
}
},
"self": {
"192.168.100.10": {
<The data from the function GetClusterSelfCnodes below>
}
}
}
func (*Metadata) GetClusterMetadataCnodes ¶
func (*Metadata) GetClusterNodeCnodes ¶
func (*Metadata) GetCmdCnodes ¶
func (*Metadata) GetEmptyClusterCnodes ¶
func (*Metadata) GetEmptyClusterNodeCnodes ¶
func (*Metadata) GetEmptyHostsCnodes ¶
func (*Metadata) GetEnvCnodes ¶
{
"master": {
"p1": "v1",
"p2": "v2"
}
}
or (without role)
{
"p1": "v1",
"p2": "v2"
}
func (*Metadata) GetHostsCnodes ¶
{
"master": {
"i-abcdefg": {
"ip":<ip>,
"server_id":<server id>,
"pub_key": <pub_key>
},
"i-xuzabcd": {
"ip":<ip>,
"server_id":<server id>,
"pub_key": <pub_key>
}
}
}
or (without role)
{
"i-abcdefg": {
"ip":<ip>,
"server_id":<server id>
},
"i-xuzabcd": {
"ip":<ip>,
"server_id":<server id>
}
}
type MetadataConfig ¶
type MetadataConfig struct {
ClusterWrapper *models.ClusterWrapper
}
func (*MetadataConfig) GetDroneConfig ¶
func (m *MetadataConfig) GetDroneConfig(nodeId string) string
func (*MetadataConfig) GetFrontgateConfig ¶
func (m *MetadataConfig) GetFrontgateConfig(nodeId string) string
type MetadataV1 ¶
type MetadataV1 struct {
ClusterWrapper *models.ClusterWrapper
Ctx context.Context
}
func (*MetadataV1) GetClusterCnodes ¶
func (m *MetadataV1) GetClusterCnodes() map[string]interface{}
Compose cluster info into the following format, in order to register cluster to configuration management service.
{
"<ip>": {
"hosts": {
<The data from the function GetHostsCnodes below>
},
"host": {
<The data from the function GetHostCnodes below>
},
"cluster": {
<The data from the function GetClusterMetadataCnodes below>
},
"env": { # optional
<The data from the function GetEnvCnodes below>
}
}
}
func (*MetadataV1) GetClusterMetadataCnodes ¶
func (m *MetadataV1) GetClusterMetadataCnodes() map[string]interface{}
func (*MetadataV1) GetClusterNodeCnodes ¶
func (m *MetadataV1) GetClusterNodeCnodes(nodeIds []string) map[string]interface{}
func (*MetadataV1) GetEmptyClusterCnodes ¶
func (m *MetadataV1) GetEmptyClusterCnodes() map[string]interface{}
func (*MetadataV1) GetEmptyClusterNodeCnodes ¶
func (m *MetadataV1) GetEmptyClusterNodeCnodes(nodeIds []string) map[string]interface{}
func (*MetadataV1) GetEmptyHostsCnodes ¶
func (m *MetadataV1) GetEmptyHostsCnodes(nodeIds []string) map[string]interface{}
func (*MetadataV1) GetHostCnodes ¶
func (m *MetadataV1) GetHostCnodes(nodeId string) map[string]interface{}
{
"ip":<ip>,
"server_id":<server id>
}
func (*MetadataV1) GetHostsCnodes ¶
func (m *MetadataV1) GetHostsCnodes(nodeIds []string) map[string]interface{}
{
"master": {
"i-abcdefg": {
"ip":<ip>,
"server_id":<server id>,
"pub_key": <pub_key>
},
"i-xuzabcd": {
"ip":<ip>,
"server_id":<server id>,
"pub_key": <pub_key>
}
}
}
or (without role)
{
"i-abcdefg": {
"ip":<ip>,
"server_id":<server id>
},
"i-xuzabcd": {
"ip":<ip>,
"server_id":<server id>
}
}
func (*MetadataV1) GetScalingCnodes ¶
func (m *MetadataV1) GetScalingCnodes(nodeIds []string, path string) map[string]interface{}
func (*MetadataV1) GetSelfEnvCnodes ¶
func (m *MetadataV1) GetSelfEnvCnodes(nodeId string) map[string]interface{}
{
"p1": "v1",
"p2": "v2"
}
type Parser ¶ added in v0.1.7
func (*Parser) Parse ¶ added in v0.1.7
func (p *Parser) Parse(clusterConf opapp.ClusterConf, clusterWrapper *models.ClusterWrapper) error
func (*Parser) ParseAddClusterNode ¶ added in v0.2.1
func (p *Parser) ParseAddClusterNode(clusterConf opapp.ClusterConf, clusterWrapper *models.ClusterWrapper) error
func (*Parser) ParseCluster ¶ added in v0.1.7
func (*Parser) ParseClusterCommon ¶ added in v0.1.7
func (p *Parser) ParseClusterCommon(clusterConf opapp.ClusterConf, node opapp.Node) (*models.ClusterCommon, error)
func (*Parser) ParseClusterLinks ¶ added in v0.1.7
func (p *Parser) ParseClusterLinks(clusterConf opapp.ClusterConf) map[string]*models.ClusterLink
func (*Parser) ParseClusterLoadbalancer ¶ added in v0.1.7
func (p *Parser) ParseClusterLoadbalancer(node opapp.Node) []*models.ClusterLoadbalancer
func (*Parser) ParseClusterNode ¶ added in v0.1.7
func (*Parser) ParseClusterRole ¶ added in v0.1.7
func (p *Parser) ParseClusterRole(clusterConf opapp.ClusterConf, node opapp.Node) (*models.ClusterRole, error)
type ProviderHandlerInterface ¶
type ProviderHandlerInterface interface {
RunInstances(task *models.Task) error
WaitRunInstances(task *models.Task) error
StopInstances(task *models.Task) error
WaitStopInstances(task *models.Task) error
StartInstances(task *models.Task) error
WaitStartInstances(task *models.Task) error
DeleteInstances(task *models.Task) error
WaitDeleteInstances(task *models.Task) error
CreateVolumes(task *models.Task) error
WaitCreateVolumes(task *models.Task) error
DetachVolumes(task *models.Task) error
WaitDetachVolumes(task *models.Task) error
AttachVolumes(task *models.Task) error
WaitAttachVolumes(task *models.Task) error
DeleteVolumes(task *models.Task) error
WaitDeleteVolumes(task *models.Task) error
ResizeInstances(task *models.Task) error
WaitResizeInstances(task *models.Task) error
ResizeVolumes(task *models.Task) error
WaitResizeVolumes(task *models.Task) error
WaitFrontgateAvailable(task *models.Task) error
}
Click to show internal directories.
Click to hide internal directories.