vmbased

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2018 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionRunInstances       = "RunInstances"
	ActionStartInstances     = "StartInstances"
	ActionStopInstances      = "StopInstances"
	ActionTerminateInstances = "TerminateInstances"

	ActionCreateVolumes = "CreateVolumes"
	ActionAttachVolumes = "AttachVolumes"
	ActionDetachVolumes = "DetachVolumes"
	ActionDeleteVolumes = "DeleteVolumes"
	ActionResizeVolumes = "ResizeVolumes"

	ActionFormatAndMountVolume       = "FormatAndMountVolume"
	ActionWaitFrontgateAvailable     = "WaitFrontgateAvailable"
	ActionRegisterMetadata           = "RegisterMetadata"
	ActionDeregisterMetadata         = "DeregisterMetadata"
	ActionRegisterCmd                = "RegisterCmd"
	ActionDeregisterCmd              = "DeregisterCmd"
	ActionStartConfd                 = "StartConfd"
	ActionStopConfd                  = "StopConfd"
	ActionSetFrontgateConfig         = "SetFrontgateConfig"
	ActionSetDroneConfig             = "SetDroneConfig"
	ActionPingDrone                  = "PingDrone"
	ActionPingFrontgate              = "PingFrontgate"
	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"
)

Variables

This section is empty.

Functions

func FormatAndMountVolumeCmd

func FormatAndMountVolumeCmd(device, mountPoint, fileSystem, mountOptions string) string

func UmountVolumeCmd

func UmountVolumeCmd(mountPoint string) string

Types

type Frame

type Frame struct {
	Job                     *models.Job
	ClusterWrapper          *models.ClusterWrapper
	FrontgateClusterWrapper *models.ClusterWrapper
	Runtime                 *runtimeclient.Runtime
	Logger                  *logger.Logger
	ImageConfig             *config.ImageConfig
}

func (*Frame) AddClusterNodesLayer

func (f *Frame) AddClusterNodesLayer() *models.TaskLayer

func (*Frame) AttachKeyPairsLayer added in v0.1.7

func (f *Frame) AttachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer

func (*Frame) CreateClusterLayer

func (f *Frame) CreateClusterLayer() *models.TaskLayer

func (*Frame) DeleteClusterLayer

func (f *Frame) DeleteClusterLayer() *models.TaskLayer

func (*Frame) DeleteClusterNodesLayer

func (f *Frame) DeleteClusterNodesLayer() *models.TaskLayer

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 (f *Frame) ParseClusterConf(versionId, runtimeId, conf string) (*models.ClusterWrapper, error)

func (*Frame) StartClusterLayer

func (f *Frame) StartClusterLayer() *models.TaskLayer

func (*Frame) StopClusterLayer

func (f *Frame) StopClusterLayer() *models.TaskLayer

type FrameHandler

type FrameHandler struct {
	Logger *logger.Logger
}

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
	AttachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
	DetachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer
	ParseClusterConf(versionId, runtimeId, conf string) (*models.ClusterWrapper, error)
}

func NewFrameInterface

func NewFrameInterface(job *models.Job, logger *logger.Logger, advancedParam ...string) (FrameInterface, error)

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 (f *Frontgate) CreateClusterLayer() *models.TaskLayer

func (*Frontgate) DeleteClusterLayer

func (f *Frontgate) DeleteClusterLayer() *models.TaskLayer

func (*Frontgate) DetachKeyPairsLayer added in v0.1.8

func (f *Frontgate) DetachKeyPairsLayer(nodeKeyPairDetails models.NodeKeyPairDetails) *models.TaskLayer

func (*Frontgate) StartClusterLayer

func (f *Frontgate) StartClusterLayer() *models.TaskLayer

func (*Frontgate) StopClusterLayer

func (f *Frontgate) StopClusterLayer() *models.TaskLayer

type Metadata

type Metadata struct {
	ClusterWrapper *models.ClusterWrapper
	Logger         *logger.Logger
}

func (*Metadata) GetClusterCnodes

func (m *Metadata) GetClusterCnodes() map[string]interface{}

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 (m *Metadata) GetClusterMetadataCnodes() map[string]interface{}

func (*Metadata) GetClusterNodeCnodes

func (m *Metadata) GetClusterNodeCnodes(nodeIds []string) map[string]interface{}

func (*Metadata) GetCmdCnodes

func (m *Metadata) GetCmdCnodes(nodeId, cmd string) map[string]interface{}

func (*Metadata) GetEmptyClusterCnodes

func (m *Metadata) GetEmptyClusterCnodes() map[string]interface{}

func (*Metadata) GetEmptyClusterNodeCnodes

func (m *Metadata) GetEmptyClusterNodeCnodes(nodeIds []string) map[string]interface{}

func (*Metadata) GetEmptyHostsCnodes

func (m *Metadata) GetEmptyHostsCnodes(nodeIds []string) map[string]interface{}

func (*Metadata) GetEnvCnodes

func (m *Metadata) GetEnvCnodes() map[string]interface{}
{
  "master": {
	 "p1": "v1",
	 "p2": "v2"
  }
}

or (without role)

{
  "p1": "v1",
  "p2": "v2"
}

func (*Metadata) GetHostsCnodes

func (m *Metadata) 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 (*Metadata) GetScalingCnodes

func (m *Metadata) GetScalingCnodes(nodeIds []string, path string) map[string]interface{}

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
	Logger         *logger.Logger
}

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

type Parser struct {
	Logger *logger.Logger
}

func (*Parser) Parse added in v0.1.7

func (p *Parser) Parse(clusterConf app.ClusterConf) (*models.ClusterWrapper, error)

func (*Parser) ParseCluster added in v0.1.7

func (p *Parser) ParseCluster(clusterConf app.ClusterConf) (*models.Cluster, error)

func (*Parser) ParseClusterCommon added in v0.1.7

func (p *Parser) ParseClusterCommon(clusterConf app.ClusterConf, node app.Node) (*models.ClusterCommon, error)
func (p *Parser) ParseClusterLinks(clusterConf app.ClusterConf) map[string]*models.ClusterLink

func (*Parser) ParseClusterLoadbalancer added in v0.1.7

func (p *Parser) ParseClusterLoadbalancer(node app.Node) []*models.ClusterLoadbalancer

func (*Parser) ParseClusterNode added in v0.1.7

func (p *Parser) ParseClusterNode(node app.Node, subnetId string) (map[string]*models.ClusterNodeWithKeyPairs, error)

func (*Parser) ParseClusterRole added in v0.1.7

func (p *Parser) ParseClusterRole(clusterConf app.ClusterConf, node app.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

	WaitFrontgateAvailable(task *models.Task) error

	DescribeSubnet(runtimeId, subnetId string) (*models.Subnet, error)
	DescribeVpc(runtimeId, vpcId string) (*models.Vpc, error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL