Documentation ¶
Index ¶
- Constants
- func FormatAndMountVolumeCmd(device, mountPoint, fileSystem, mountOptions string) string
- func FormatUserData(userData, frontgateIp string) string
- func HandleSubtask(ctx context.Context, task *models.Task, handler ProviderHandlerInterface) (*models.Task, error)
- func ParseClusterConf(ctx context.Context, versionId, runtimeId, conf string, ...) (*models.ClusterWrapper, 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) (*models.Task, 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) ResizeClusterLayer(roleResizeResources models.RoleResizeResources) *models.TaskLayer
- func (f *Frame) StartClusterLayer() *models.TaskLayer
- func (f *Frame) StopClusterLayer() *models.TaskLayer
- func (f *Frame) UpdateClusterEnvLayer() *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(ctx context.Context) map[string]interface{}
- func (m *Metadata) GetClusterEnvCnodes(ctx context.Context) map[string]interface{}
- func (m *Metadata) GetClusterMappingCnodes(ctx context.Context) map[string]interface{}
- func (m *Metadata) GetClusterMetadataCnodes() map[string]interface{}
- func (m *Metadata) GetClusterNodesCnodes(ctx context.Context, nodeIds []string) map[string]interface{}
- func (m *Metadata) GetClusterNodesMappingCnodes(ctx context.Context, nodeIds []string) map[string]interface{}
- func (m *Metadata) GetCmdCnodes(nodeId string, cmd *models.Cmd) *models.CmdCnodes
- func (m *Metadata) GetEmptyClusterCnodes() map[string]interface{}
- func (m *Metadata) GetEmptyClusterMappingCnodes() map[string]interface{}
- func (m *Metadata) GetEmptyClusterNodeCnodes(ctx context.Context, nodeIds []string) map[string]interface{}
- func (m *Metadata) GetEmptyClusterNodeMappingCnodes(ctx context.Context, nodeIds []string) map[string]interface{}
- func (m *Metadata) GetEmptyHostsCnodes(nodeIds []string) map[string]interface{}
- func (m *Metadata) GetEnvCnodes(ctx context.Context) map[string]interface{}
- func (m *Metadata) GetHostsCnodes(ctx context.Context, nodeIds []string) map[string]interface{}
- func (m *Metadata) GetMappingCnodes(nodeIds []string) map[string]interface{}
- func (m *Metadata) GetScalingCnodes(ctx context.Context, nodeIds []string, path string) map[string]interface{}
- type MetadataConfig
- 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, clusterEnv string) (*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" ActionRegisterMetadataMapping = "RegisterMetadataMapping" ActionRegisterNodesMetadata = "RegisterNodesMetadata" ActionRegisterEnvMetadata = "RegisterEnvMetadata" ActionRegisterNodesMetadataMapping = "RegisterNodesMetadataMapping" ActionDeregisterMetadata = "DeregisterMetadata" ActionDeregisterMetadataMapping = "DeregisterMetadataMapping" 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" RegisterNodeSelf = "self" RegisterNodeCmd = "cmd" RegisterNodeCmdId = "id" RegisterNodeCmdTimeout = "timeout" RegisterNodeEndpoint = "endpoints" RegisterNodeLinks = "links" RegisterNodeAdding = "adding-hosts" RegisterNodeDeleting = "deleting-hosts" RegisterNodeScaling = "scaling-hosts" RegisterNodeStopping = "stopping-hosts" RegisterNodeStarting = "starting-hosts" )
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-metad" ConfdCmdLogPath = "/opt/openpitrix/log/cmd.log" HostCmdPrefix = "nsenter -t 1 -m -u -n -i sh -c" MetadataNodeName = "metadata" DefaultNodeName = "node" EtcdPort = 2379 MetadPort = 80 )
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 FormatUserData ¶ added in v0.4.0
func HandleSubtask ¶ added in v0.2.1
func ParseClusterConf ¶ added in v0.4.0
func ParseClusterConf(ctx context.Context, versionId, runtimeId, conf string, clusterWrapper *models.ClusterWrapper) (*models.ClusterWrapper, error)
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 Runtime *models.RuntimeDetails RuntimeProviderConfig *config.RuntimeProviderConfig }
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) ResizeClusterLayer ¶ added in v0.2.1
func (f *Frame) ResizeClusterLayer(roleResizeResources models.RoleResizeResources) *models.TaskLayer
func (*Frame) StartClusterLayer ¶
func (*Frame) StopClusterLayer ¶
func (*Frame) UpdateClusterEnvLayer ¶ added in v0.4.0
type FrameInterface ¶
type FrameInterface interface { CreateClusterLayer() *models.TaskLayer StopClusterLayer() *models.TaskLayer StartClusterLayer() *models.TaskLayer DeleteClusterLayer() *models.TaskLayer AddClusterNodesLayer() *models.TaskLayer DeleteClusterNodesLayer() *models.TaskLayer UpdateClusterEnvLayer() *models.TaskLayer ResizeClusterLayer(roleResizeResources models.RoleResizeResources) *models.TaskLayer AttachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer DetachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer }
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 RuntimeDetails *models.RuntimeDetails }
func (*Metadata) GetClusterCnodes ¶
Compose cluster info into the following format, in order to register cluster to configuration management service.
{ "clusters": { "<cluster_id>": { "hosts": { <The data from the function GetHostsCnodes> }, "cluster": { <The data from the function GetClusterMetadataCnodes> }, "env": { # optional <The data from the function GetEnvCnodes> } } } }
func (*Metadata) GetClusterEnvCnodes ¶ added in v0.4.0
{ "clusters": { "<cluster_id>": { "env": { # optional <The data from the function GetEnvCnodes> } } } }
func (*Metadata) GetClusterMappingCnodes ¶ added in v0.4.0
{ "self": { <The data from the function GetMappingCnodes below> } }
func (*Metadata) GetClusterMetadataCnodes ¶
{ "cluster_id": <cluster_id>, "app_id": <app_id>, "subnet": <subnet>, "user_id": <user_id>, "global_uuid": <global_uuid>, "zone": <zone>, "provider": <provider>, "runtime_url": <runtime_url>, }
func (*Metadata) GetClusterNodesCnodes ¶ added in v0.4.0
func (m *Metadata) GetClusterNodesCnodes(ctx context.Context, nodeIds []string) map[string]interface{}
{ "clusters": { "<cluster_id>": { "hosts": { <The data from the function GetHostsCnodes> } } } }
func (*Metadata) GetClusterNodesMappingCnodes ¶ added in v0.4.0
func (m *Metadata) GetClusterNodesMappingCnodes(ctx context.Context, nodeIds []string) map[string]interface{}
{ "self": { <The data from the function GetMappingCnodes below> } }
func (*Metadata) GetCmdCnodes ¶
func (*Metadata) GetEmptyClusterCnodes ¶
{ clusters: { <cluster_id>: "" } }
func (*Metadata) GetEmptyClusterMappingCnodes ¶ added in v0.4.0
{ self: { <ip>: "" } }
func (*Metadata) GetEmptyClusterNodeCnodes ¶
func (m *Metadata) GetEmptyClusterNodeCnodes(ctx context.Context, nodeIds []string) map[string]interface{}
{ "clusters": { "<cluster_id>": { "hosts": { <The data from the function GetEmptyHostsCnodes> } } } }
func (*Metadata) GetEmptyClusterNodeMappingCnodes ¶ added in v0.4.0
func (m *Metadata) GetEmptyClusterNodeMappingCnodes(ctx context.Context, nodeIds []string) map[string]interface{}
{ self: { <ip>: "" } }
func (*Metadata) GetEmptyHostsCnodes ¶
{ "<role>": { "<instance_id>": "" } }
or (without role)
{ "<instance_id>": "" }
func (*Metadata) GetEnvCnodes ¶
{ "<role>": { "p1": "v1", "p2": "v2" } }
or (without role)
{ "p1": "v1", "p2": "v2" }
func (*Metadata) GetHostsCnodes ¶
{ "<role>": { "<instance_id>": { "ip":<ip>, "server_id":<server_id>, "pub_key": <pub_key> } } }
or (without role)
{ "<instance_id>": { "ip":<ip>, "server_id":<server_id> } }
func (*Metadata) GetMappingCnodes ¶ added in v0.4.0
{ "<ip>": { "host":"/clusters/</cluster_id>/hosts/master/<instance_id>", "hosts":"/clusters/</cluster_id>/hosts", "cluster":"/clusters/</cluster_id>/cluster", "env":"/clusters/</cluster_id>/env/<role>", "cmd":"/clusters/<cluster_id>/cmd/<instance_id>, "links":"/clusters/<cluster_id>/links" } }
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 Parser ¶ added in v0.1.7
func (*Parser) Parse ¶ added in v0.1.7
func (p *Parser) Parse(clusterConf opapp.ClusterConf, clusterWrapper *models.ClusterWrapper, clusterEnv string) 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(ctx context.Context, task *models.Task) (*models.Task, error) WaitRunInstances(ctx context.Context, task *models.Task) (*models.Task, error) StopInstances(ctx context.Context, task *models.Task) (*models.Task, error) WaitStopInstances(ctx context.Context, task *models.Task) (*models.Task, error) StartInstances(ctx context.Context, task *models.Task) (*models.Task, error) WaitStartInstances(ctx context.Context, task *models.Task) (*models.Task, error) DeleteInstances(ctx context.Context, task *models.Task) (*models.Task, error) WaitDeleteInstances(ctx context.Context, task *models.Task) (*models.Task, error) CreateVolumes(ctx context.Context, task *models.Task) (*models.Task, error) WaitCreateVolumes(ctx context.Context, task *models.Task) (*models.Task, error) DetachVolumes(ctx context.Context, task *models.Task) (*models.Task, error) WaitDetachVolumes(ctx context.Context, task *models.Task) (*models.Task, error) AttachVolumes(ctx context.Context, task *models.Task) (*models.Task, error) WaitAttachVolumes(ctx context.Context, task *models.Task) (*models.Task, error) DeleteVolumes(ctx context.Context, task *models.Task) (*models.Task, error) WaitDeleteVolumes(ctx context.Context, task *models.Task) (*models.Task, error) ResizeInstances(ctx context.Context, task *models.Task) (*models.Task, error) WaitResizeInstances(ctx context.Context, task *models.Task) (*models.Task, error) ResizeVolumes(ctx context.Context, task *models.Task) (*models.Task, error) WaitResizeVolumes(ctx context.Context, task *models.Task) (*models.Task, error) WaitFrontgateAvailable(ctx context.Context, task *models.Task) (*models.Task, error) }
Click to show internal directories.
Click to hide internal directories.