infra

package
v0.10.3 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Package mci is to manage multi-cloud infra

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNLBVMs

func AddNLBVMs(nsId string, mciId string, resourceId string, u *model.TbNLBAddRemoveVMReq) (model.TbNLBInfo, error)

AddNLBVMs accepts VM addition request, adds VM to NLB, and returns an updated TB NLB object

func AttachDetachDataDisk

func AttachDetachDataDisk(nsId string, mciId string, vmId string, command string, dataDiskId string, force bool) (model.TbVmInfo, error)

AttachDetachDataDisk is func to attach/detach DataDisk to/from VM

func BenchmarkAction

func BenchmarkAction(nsId string, mciId string, action string, option string) (model.BenchmarkInfoArray, error)

BenchmarkAction is func to action Benchmark

func CallGetMonitoringAsync

func CallGetMonitoringAsync(wg *sync.WaitGroup, nsID string, mciID string, vmID string, vmIP string, method string, metric string, cmd string, returnResult *[]model.MonResultSimple)

func CallMilkyway

func CallMilkyway(wg *sync.WaitGroup, vmList []string, nsId string, mciId string, vmId string, vmIp string, action string, option string, results *model.BenchmarkInfoArray)

CallMilkyway is func to call milkyway agents

func CallMonitoringAsync

func CallMonitoringAsync(wg *sync.WaitGroup, nsID string, mciID string, mciServiceType string, vmID string, givenUserName string, method string, cmd string, returnResult *[]model.SshCmdResult)

CallMonitoringAsync is func to call CB-Dragonfly monitoring framework

func CheckAllowedTransition

func CheckAllowedTransition(nsId string, mciId string, vmId model.OptionalParameter, action string) error

CheckAllowedTransition is func to check status transition is acceptable

func CheckConnectivity

func CheckConnectivity(host string, port string) error

CheckConnectivity func checks if given port is open and ready

func CheckDragonflyEndpoint

func CheckDragonflyEndpoint() error

Module for checking CB-Dragonfly endpoint (call get config)

func CheckK8sClusterDynamicReq added in v0.10.0

CheckK8sClusterDynamicReq is func to check request info to create K8sCluster obeject and deploy requested Nodes in a dynamic way

func CheckMci

func CheckMci(nsId string, mciId string) (bool, error)

CheckMci func is to check given mciId is duplicated with existing

func CheckMciDynamicReq

CheckMciDynamicReq is func to check request info to create MCI obeject and deploy requested VMs in a dynamic way

func CheckMciPolicy

func CheckMciPolicy(nsId string, mciId string) (bool, error)

func CheckNLB

func CheckNLB(nsId string, mciId string, resourceId string) (bool, error)

CheckNLB returns the existence of the TB NLB object in bool form.

func CheckSubGroup

func CheckSubGroup(nsId string, mciId string, subGroupId string) (bool, error)

CheckSubGroup func is to check given subGroupId is duplicated with existing

func CheckVm

func CheckVm(nsId string, mciId string, vmId string) (bool, error)

func ControlMciAsync

func ControlMciAsync(nsId string, mciId string, action string, force bool) error

ControlMciAsync is func to control MCI async

func ControlVmAsync

func ControlVmAsync(wg *sync.WaitGroup, nsId string, mciId string, vmId string, action string, results chan<- model.ControlVmResult)

ControlVmAsync is func to control VM async

func CoreGetBenchmark

func CoreGetBenchmark(nsId string, mciId string, action string, host string) (*model.BenchmarkInfoArray, error)

CoreGetBenchmark is func to get Benchmark

func CreateK8sClusterDynamic added in v0.10.0

func CreateK8sClusterDynamic(reqID string, nsId string, dReq *model.TbK8sClusterDynamicReq, deployOption string) (*model.TbK8sClusterInfo, error)

CreateK8sClusterDynamic is func to create K8sCluster obeject and deploy requested K8sCluster and NodeGroup in a dynamic way

func CreateK8sNodeGroupDynamic added in v0.10.2

func CreateK8sNodeGroupDynamic(reqID string, nsId string, k8sClusterId string, dReq *model.TbK8sNodeGroupDynamicReq) (*model.TbK8sClusterInfo, error)

CreateK8sNodeGroupDynamic is func to create K8sNodeGroup obeject and deploy requested K8sNodeGroup in a dynamic way

func CreateMcSwNlb

func CreateMcSwNlb(nsId string, mciId string, req *model.TbNLBReq, option string) (model.McNlbInfo, error)

CreateMcSwNlb func create a special purpose MCI for NLB and depoly and setting SW NLB

func CreateMci

func CreateMci(nsId string, req *model.TbMciReq, option string) (*model.TbMciInfo, error)

CreateMci is func to create MCI obeject and deploy requested VMs (register CSP native VM with option=register)

func CreateMciDynamic

func CreateMciDynamic(reqID string, nsId string, req *model.TbMciDynamicReq, deployOption string) (*model.TbMciInfo, error)

CreateMciDynamic is func to create MCI obeject and deploy requested VMs in a dynamic way

func CreateMciGroupVm

func CreateMciGroupVm(nsId string, mciId string, vmRequest *model.TbVmReq, newSubGroup bool) (*model.TbMciInfo, error)

CreateMciGroupVm is func to create MCI groupVM

func CreateMciPolicy

func CreateMciPolicy(nsId string, mciId string, u *model.MciPolicyReq) (model.MciPolicyInfo, error)

CreateMciPolicy create model.MciPolicyInfo object in DB according to user's requirements.

func CreateMciVm

func CreateMciVm(nsId string, mciId string, vmInfoData *model.TbVmInfo) (*model.TbVmInfo, error)

CreateMciVm is func to post (create) MciVm

func CreateMciVmDynamic

func CreateMciVmDynamic(nsId string, mciId string, req *model.TbVmDynamicReq) (*model.TbMciInfo, error)

CreateMciVmDynamic is func to create requested VM in a dynamic way and add it to MCI

func CreateNLB

func CreateNLB(nsId string, mciId string, u *model.TbNLBReq, option string) (model.TbNLBInfo, error)

CreateNLB accepts nlb creation request, creates and returns an TB nlb object

func CreateSystemMciDynamic

func CreateSystemMciDynamic(option string) (*model.TbMciInfo, error)

CreateSystemMciDynamic is func to create MCI obeject and deploy requested VMs in a dynamic way

func CreateVm

func CreateVm(wg *sync.WaitGroup, nsId string, mciId string, vmInfoData *model.TbVmInfo, option string) error

CreateVm is func to create VM (option = "register" for register existing VM)

func CreateVmObject added in v0.9.19

func CreateVmObject(wg *sync.WaitGroup, nsId string, mciId string, vmInfoData *model.TbVmInfo) error

CreateVmObject is func to add VM to MCI

func CreateVmSnapshot

func CreateVmSnapshot(nsId string, mciId string, vmId string, snapshotName string) (model.TbCustomImageInfo, error)

CreateVmSnapshot is func to create VM snapshot

func DFMonAgentInstallReqStructLevelValidation

func DFMonAgentInstallReqStructLevelValidation(sl validator.StructLevel)

func DelAllMci

func DelAllMci(nsId string, option string) (string, error)

DelAllMci is func to delete all MCI objects in parallel

func DelAllMciPolicy

func DelAllMciPolicy(nsId string) (string, error)

DelAllMciPolicy deletes all model.MciPolicyInfo objects.

func DelAllNLB

func DelAllNLB(nsId string, mciId string, subString string, forceFlag string) (model.IdList, error)

DelAllNLB deletes all TB NLB object of given nsId

func DelMci

func DelMci(nsId string, mciId string, option string) (model.IdList, error)

DelMci is func to delete MCI object

func DelMciPolicy

func DelMciPolicy(nsId string, mciId string) error

DelMciPolicy deletes model.MciPolicyInfo object by mciId.

func DelMciVm

func DelMciVm(nsId string, mciId string, vmId string, option string) error

DelMciVm is func to delete VM object

func DelNLB

func DelNLB(nsId string, mciId string, resourceId string, forceFlag string) error

DelNLB deletes the TB NLB object

func FetchVmStatus

func FetchVmStatus(nsId string, mciId string, vmId string) (model.TbVmStatusInfo, error)

FetchVmStatus is func to fetch VM status (call to CSPs)

func FetchVmStatusAsync

func FetchVmStatusAsync(wg *sync.WaitGroup, nsId string, mciId string, vmId string, results *model.MciStatusInfo) error

FetchVmStatusAsync is func to get VM status async

func FindTbVmByCspId

func FindTbVmByCspId(nsId string, mciId string, vmCspResourceId string) (model.TbVmInfo, error)

func GenNLBKey

func GenNLBKey(nsId string, mciId string, resourceId string) string

GenNLBKey is func to generate a key from NLB id

func GetAllMciPolicyObject

func GetAllMciPolicyObject(nsId string) ([]model.MciPolicyInfo, error)

GetAllMciPolicyObject returns all model.MciPolicyInfo objects.

func GetAvailableDataDisks

func GetAvailableDataDisks(nsId string, mciId string, vmId string, option string) (interface{}, error)

func GetBastionNodes

func GetBastionNodes(nsId string, mciId string, targetVmId string) ([]model.BastionNode, error)

GetBastionNodes func retrieves bastion nodes for a given VM

func GetLatency

func GetLatency(src string, dest string) (float64, error)

GetLatency func get latency between given two regions

func GetMcNlbAccess

func GetMcNlbAccess(nsId string, mciId string) (*model.MciAccessInfo, error)

GetMcNlbAccess returns the requested TB G-NLB access info (currenly MCI)

func GetMciAccessInfo

func GetMciAccessInfo(nsId string, mciId string, option string) (*model.MciAccessInfo, error)

GetMciAccessInfo is func to retrieve MCI Access information

func GetMciInfo

func GetMciInfo(nsId string, mciId string) (*model.TbMciInfo, error)

GetMciInfo is func to return MCI information with the current status update

func GetMciObject

func GetMciObject(nsId string, mciId string) (model.TbMciInfo, error)

GetMciObject is func to retrieve MCI object from database (no current status update)

func GetMciPolicyObject

func GetMciPolicyObject(nsId string, mciId string) (model.MciPolicyInfo, error)

GetMciPolicyObject returns model.MciPolicyInfo object.

func GetMciStatus

func GetMciStatus(nsId string, mciId string) (*model.MciStatusInfo, error)

GetMciStatus is func to Get Mci Status

func GetMciVmStatus

func GetMciVmStatus(nsId string, mciId string, vmId string) (*model.TbVmStatusInfo, error)

GetMciVmStatus is func to Get MciVm Status

func GetMonitoringData

func GetMonitoringData(nsId string, mciId string, metric string) (model.MonResultSimpleResponse, error)

GetMonitoringData func retrieves monitoring data from cb-dragonfly

func GetNLB

func GetNLB(nsId string, mciId string, resourceId string) (model.TbNLBInfo, error)

GetNLB returns the requested TB NLB object

func GetNLBHealth

func GetNLBHealth(nsId string, mciId string, nlbId string) (model.TbNLBHealthInfo, error)

GetNLBHealth queries the health status of NLB to CB-Spider, and returns it to user

func GetSubGroup added in v0.9.10

func GetSubGroup(nsId string, mciId string, subGroupId string) (model.TbSubGroupInfo, error)

GetSubGroup is func to return list of SubGroups in a given MCI

func GetVmCurrentPublicIp

func GetVmCurrentPublicIp(nsId string, mciId string, vmId string) (model.TbVmStatusInfo, error)

GetVmCurrentPublicIp is func to get VM public IP

func GetVmIdNameInDetail

func GetVmIdNameInDetail(nsId string, mciId string, vmId string) (*model.TbIdNameInDetailInfo, error)

GetVmIdNameInDetail is func to get ID and Name details

func GetVmIp

func GetVmIp(nsId string, mciId string, vmId string) (string, string, string, error)

GetVmIp is func to get VM IP to return PublicIP, PrivateIP, SSHPort

func GetVmObject

func GetVmObject(nsId string, mciId string, vmId string) (model.TbVmInfo, error)

GetVmObject is func to get VM object

func GetVmSpecId

func GetVmSpecId(nsId string, mciId string, vmId string) string

GetVmSpecId is func to get VM SpecId

func GetVmSshKey

func GetVmSshKey(nsId string, mciId string, vmId string) (string, string, string, error)

GetVmSshKey is func to get VM SShKey. Returns username, verifiedUsername, privateKey

func GetVmTemplate

func GetVmTemplate(nsId string, mciId string, algo string) (model.TbVmInfo, error)

GetVmTemplate is func to get VM template

func HandleMciAction

func HandleMciAction(nsId string, mciId string, action string, force bool) (string, error)

HandleMciAction is func to handle actions to MCI

func HandleMciVmAction

func HandleMciVmAction(nsId string, mciId string, vmId string, action string, force bool) (string, error)

HandleMciVmAction is func to Get MciVm Action

func InspectResources

func InspectResources(connConfig string, resourceType string) (model.InspectResource, error)

InspectResources returns the state list of TB Resource objects of given connConfig and resourceType

func InspectResourcesOverview

func InspectResourcesOverview() (model.InspectResourceAllResult, error)

InspectResourcesOverview func is to check all resources in CB-TB and CSPs

func InstallBenchmarkAgentToMci

func InstallBenchmarkAgentToMci(nsId string, mciId string, req *model.MciCmdReq, option string) ([]model.SshCmdResult, error)

InstallBenchmarkAgentToMci is func to install milkyway agents in MCI

func InstallMonitorAgentToMci

func InstallMonitorAgentToMci(nsId string, mciId string, mciServiceType string, req *model.MciCmdReq) (model.AgentInstallContentWrapper, error)

func ListMciId

func ListMciId(nsId string) ([]string, error)

ListMciId is func to list MCI ID

func ListMciInfo

func ListMciInfo(nsId string, option string) ([]model.TbMciInfo, error)

ListMciInfo is func to get all MCI objects

func ListMciPolicyId

func ListMciPolicyId(nsId string) []string

ListMciPolicyId returns a list of Ids for all model.MciPolicyInfo objects .

func ListMciStatus

func ListMciStatus(nsId string) ([]model.MciStatusInfo, error)

ListMciStatus is func to get MCI status all

func ListNLB

func ListNLB(nsId string, mciId string, filterKey string, filterVal string) (interface{}, error)

ListNLB returns the list of TB NLB objects of given nsId

func ListNLBId

func ListNLBId(nsId string, mciId string) ([]string, error)

ListNLBId returns the list of TB NLB object IDs of given nsId

func ListSubGroupId

func ListSubGroupId(nsId string, mciId string) ([]string, error)

ListSubGroupId is func to return list of SubGroups in a given MCI

func ListVmByFilter

func ListVmByFilter(nsId string, mciId string, filterKey string, filterVal string) ([]string, error)

ListVmByFilter is func to get list VMs in a MCI by a filter consist of Key and Value

func ListVmByLabel

func ListVmByLabel(nsId string, mciId string, labelKey string) ([]string, error)

ListVmByLabel is a function to list VM IDs by label

func ListVmBySubGroup

func ListVmBySubGroup(nsId string, mciId string, groupId string) ([]string, error)

ListVmBySubGroup is func to get VM list with a SubGroup label in a specified MCI

func ListVmId

func ListVmId(nsId string, mciId string) ([]string, error)

ListVmId is func to list VM IDs

func ListVmInfo

func ListVmInfo(nsId string, mciId string, vmId string) (*model.TbVmInfo, error)

ListVmInfo is func to Get MciVm Info

func OrchestrationController

func OrchestrationController()

OrchestrationController is responsible for executing MCI automation policy. OrchestrationController will be periodically involked by a time.NewTicker in main.go.

func ProvisionDataDisk

func ProvisionDataDisk(nsId string, mciId string, vmId string, u *model.TbDataDiskVmReq) (model.TbVmInfo, error)

ProvisionDataDisk is func to provision DataDisk to VM (create and attach to VM)

func RecommendK8sNode added in v0.10.0

func RecommendK8sNode(nsId string, plan model.DeploymentPlan) ([]model.TbSpecInfo, error)

RecommendK8sNode is func to recommend a node for K8sCluster

func RecommendVm

func RecommendVm(nsId string, plan model.DeploymentPlan) ([]model.TbSpecInfo, error)

RecommendVm is func to recommend a VM

func RecommendVmCost

func RecommendVmCost(nsId string, specList *[]model.TbSpecInfo) ([]model.TbSpecInfo, error)

RecommendVmCost func prioritize specs based on given Cost

func RecommendVmLatency

func RecommendVmLatency(nsId string, specList *[]model.TbSpecInfo, param *[]model.ParameterKeyVal) ([]model.TbSpecInfo, error)

RecommendVmLatency func prioritize specs by latency based on given MCI (fair)

func RecommendVmLocation

func RecommendVmLocation(nsId string, specList *[]model.TbSpecInfo, param *[]model.ParameterKeyVal) ([]model.TbSpecInfo, error)

RecommendVmLocation func prioritize specs based on given location

func RecommendVmPerformance

func RecommendVmPerformance(nsId string, specList *[]model.TbSpecInfo) ([]model.TbSpecInfo, error)

RecommendVmPerformance func prioritize specs based on given Performance condition

func RecommendVmRandom

func RecommendVmRandom(nsId string, specList *[]model.TbSpecInfo) ([]model.TbSpecInfo, error)

RecommendVmRandom func prioritize specs randomly

func RegisterCspNativeResources

func RegisterCspNativeResources(nsId string, connConfig string, mciId string, option string, mciFlag string) (model.RegisterResourceResult, error)

RegisterCspNativeResources func registers all CSP-native resources into CB-TB

func RegisterCspNativeResourcesAll

func RegisterCspNativeResourcesAll(nsId string, mciId string, option string, mciFlag string) (model.RegisterResourceAllResult, error)

RegisterCspNativeResourcesAll func registers all CSP-native resources into CB-TB

func RemoteCommandToMci

func RemoteCommandToMci(nsId string, mciId string, subGroupId string, vmId string, req *model.MciCmdReq) ([]model.SshCmdResult, error)

RemoteCommandToMci is func to command to all VMs in MCI by SSH

func RemoveBastionNodes

func RemoveBastionNodes(nsId string, mciId string, bastionVmId string) (string, error)

RemoveBastionNodes func removes existing bastion nodes info

func RemoveNLBVMs

func RemoveNLBVMs(nsId string, mciId string, resourceId string, u *model.TbNLBAddRemoveVMReq) error

RemoveNLBVMs accepts VM removal request, removes VMs from NLB, and returns an error if occurs.

func RunAllBenchmarks

func RunAllBenchmarks(nsId string, mciId string, host string) (*model.BenchmarkInfoArray, error)

RunAllBenchmarks is func to get all Benchmarks

func RunLatencyBenchmark

func RunLatencyBenchmark(nsId string, mciId string, host string) (*model.BenchmarkInfoArray, error)

RunLatencyBenchmark is func to get MCI benchmark for network latency

func RunRemoteCommand

func RunRemoteCommand(nsId string, mciId string, vmId string, givenUserName string, cmds []string) (map[int]string, map[int]string, error)

RunRemoteCommand is func to execute a SSH command to a VM (sync call)

func RunRemoteCommandAsync

func RunRemoteCommandAsync(wg *sync.WaitGroup, nsId string, mciId string, vmId string, givenUserName string, cmd []string, returnResult *[]model.SshCmdResult)

RunRemoteCommandAsync is func to execute a SSH command to a VM (async call)

func ScaleOutMciSubGroup

func ScaleOutMciSubGroup(nsId string, mciId string, subGroupId string, numVMsToAdd string) (*model.TbMciInfo, error)

ScaleOutMciSubGroup is func to create MCI groupVM

func SetBastionNodes

func SetBastionNodes(nsId string, mciId string, targetVmId string, bastionVmId string) (string, error)

SetBastionNodes func sets bastion nodes

func SetMonitoringAgentStatusInstalled

func SetMonitoringAgentStatusInstalled(nsId string, mciId string, vmId string) error

SetMonitoringAgentStatusInstalled is func to Set Monitoring Agent Status Installed

func TbMciCmdReqStructLevelValidation

func TbMciCmdReqStructLevelValidation(sl validator.StructLevel)

TbMciCmdReqStructLevelValidation is func to validate fields in model.MciCmdReq

func TbMciReqStructLevelValidation

func TbMciReqStructLevelValidation(sl validator.StructLevel)

TbMciReqStructLevelValidation is func to validate fields in TbMciReqStruct

func TbNLBReqStructLevelValidation

func TbNLBReqStructLevelValidation(sl validator.StructLevel)

TbNLBReqStructLevelValidation is a function to validate 'model.TbNLBReq' object.

func TbVmReqStructLevelValidation

func TbVmReqStructLevelValidation(sl validator.StructLevel)

TbVmReqStructLevelValidation is func to validate fields in model.TbVmReqStruct

func TransferFileToMci added in v0.9.12

func TransferFileToMci(nsId string, mciId string, subGroupId string, vmId string, fileData []byte, fileName string, targetPath string) ([]model.SshCmdResult, error)

TransferFileToMci is a function to transfer a file to all VMs in MCI by SSH through bastion hosts

func TrimIP

func TrimIP(sshAccessPoint string) (string, error)

func UpdateMciInfo

func UpdateMciInfo(nsId string, mciInfoData model.TbMciInfo)

UpdateMciInfo is func to update MCI Info (without VM info in MCI)

func UpdateMciPolicyInfo

func UpdateMciPolicyInfo(nsId string, mciPolicyInfoData model.MciPolicyInfo)

UpdateMciPolicyInfo updates model.MciPolicyInfo object in DB.

func UpdateMonitoringAgentStatusManually

func UpdateMonitoringAgentStatusManually(nsId string, mciId string, vmId string, targetStatus string) error

UpdateMonitoringAgentStatusManually is func to Update Monitoring Agent Installation Status Manually

func UpdateVmInfo

func UpdateVmInfo(nsId string, mciId string, vmInfoData model.TbVmInfo)

UpdateVmInfo is func to update VM Info

func UpdateVmPublicIp

func UpdateVmPublicIp(nsId string, mciId string, vmInfoData model.TbVmInfo) error

UpdateVmPublicIp is func to update VM public IP

func UpdateVmSshKey

func UpdateVmSshKey(nsId string, mciId string, vmId string, verifiedUserName string) error

UpdateVmSshKey is func to update VM SShKey

func VerifySshUserName

func VerifySshUserName(nsId string, mciId string, vmId string, vmIp string, sshPort string, givenUserName string) (string, string, error)

VerifySshUserName is func to verify SSH username

Types

This section is empty.

Jump to

Keyboard shortcuts

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