gf_cluster

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//UsageKey 集群的占用的Tag
	UsageKey = "usage"
	//UnusedValue 未被占用的TagValue
	UnusedValue = "unused"
	//GalaxyfutureCloudUsage 星云集群占用Value
	GalaxyfutureCloudUsage = "galaxyfuture-cloud"
)
View Source
const (
	KubernetesStepInitializeCluster = "集群初始化"
	KubernetesStepInstallMaster     = "master安装"
	KubernetesStepInstallFlannel    = "flannel安装"
	KubernetesStepInstallNode       = "node安装"
	KubernetesStepDone              = "运行中"
)

Kubernetes step

View Source
const (
	KubernetesStatusInitializing = "initialize"
	KubernetesStatusFailed       = "failed"
	KubernetesStatusRunning      = "running"
)

KubernetesStatus

View Source
const (
	KubernetesRoleKey    = "node-role.kubernetes.io/master"
	KubernetesRoleMaster = "master"
	KubernetesRoleWorker = "worker"

	ClusterTypeKey   = "galaxy-future.org/app-type"
	ClusterTypeValue = "gf-cluster"

	ClusterInstanceGroupKey   = "galaxy-future.org/group"
	ClusterInstanceGroupIdKey = "galaxy-future.org/group-id"

	ClusterInstanceTypeKey          = "galaxy-future.org/machine-type"
	ClusterInstanceProviderLabelKey = "galaxy-future.org/machine-provider"
	ClusterInstanceClusterLabelKey  = "galaxy-future.org/bridgx-group"

	ClusterNodeTypeKey   = "bridgx.gf/node-type"
	ClusterNodeTypeValue = "connection"
)

Kubernetes Labels

View Source
const (
	KubernetesStandalone        string = "standalone"
	KubernetesHA                string = "HA"
	KubernetesHAMinMachineCount        = 4
)
View Source
const (
	InstanceInit   = "INIT"
	InstanceNormal = "NORMAL"
	InstanceError  = "ERROR"
)
View Source
const (
	OptTypeExpand = "EXPAND"
	OptTypeShrink = "SHRINK"
)
View Source
const (
	ExpandAndShrinkDefaultUser   = "bridgx"
	ExpandAndShrinkDefaultUserId = 0
)
View Source
const (
	DefaultPageSize = 10
)
View Source
const (
	HeaderTokenName = "Trans-UserToken"
)

Variables

View Source
var (
	StatusSuccess = "success"
	StatusFailed  = "failed"
	ModuleName    = "bridgx/containers-cloud"
	Version       = ""
)

Functions

This section is empty.

Types

type AKSKData

type AKSKData struct {
	AccountName          string `json:"account_name"`
	AccountKey           string `json:"account_key"`
	AccountSecretEncrypt string `json:"account_secret_encrypt"`
	Provider             string `json:"provider"`
	Salt                 string `json:"salt"`
}

AKSKData 集群AKSK数据

type BridgxClusterBuildRequest

type BridgxClusterBuildRequest struct {
	ClusterName       string `json:"cluster_name"`
	BridgxClusterName string `json:"bridgx_cluster_name"`
	PodCidr           string `json:"pod_cidr"`
	ServiceCidr       string `json:"service_cidr"`
	ClusterType       string `json:"cluster_type"`
}

BridgxClusterBuildRequest 集群构建请求

type BridgxClusterDetails

type BridgxClusterDetails struct {
	Id           int    `json:"id"`
	Name         string `json:"name"`
	Desc         string `json:"desc"`
	RegionId     string `json:"region_id"`
	ZoneId       string `json:"zone_id"`
	InstanceType string `json:"instance_type"`
	ChargeType   string `json:"charge_type"`
	Image        string `json:"image"`
	Provider     string `json:"provider"`
	Password     string `json:"password"`
}

BridgxClusterDetails 集群相信信息

type BridgxClusterDetailsResponse

type BridgxClusterDetailsResponse struct {
	Code int                   `json:"code"`
	Msg  string                `json:"msg"`
	Data *BridgxClusterDetails `json:"data"`
}

BridgxClusterDetailsResponse 集群相信信息response

type BridgxClusterName

type BridgxClusterName struct {
	ClusterId   string            `json:"cluster_id"`
	ClusterName string            `json:"cluster_name"`
	Provider    string            `json:"provider"`
	Tags        map[string]string `json:"tags"`
	CreateAt    string            `json:"create_at"`
	CreateBy    string            `json:"create_by"`
}

BridgxClusterName 集群名称信息

type BridgxInstance

type BridgxInstance struct {
	InstanceId   string `json:"instance_id"`
	IpInner      string `json:"ip_inner"`
	IpOuter      string `json:"ip_outer"`
	Provider     string `json:"provider"`
	ClusterName  string `json:"cluster_name"`
	InstanceType string `json:"instance_type"`
	CreateAt     string `json:"create_at"`
	Status       string `json:"status"`
}

BridgxInstance Bridgx集群实例

type BridgxUnusedCluster

type BridgxUnusedCluster struct {
	ClusterName string   `json:"cluster_name"`
	CloudType   string   `json:"cloud_type"`
	Nodes       []string `json:"nodes"`
	Total       int      `json:"total"`
}

BridgxUnusedCluster 未被占用的集群

type BuildMode

type BuildMode int
const (
	//SingleMode da单节点模式
	SingleMode BuildMode = iota
	//ClusterMode HA模式
	ClusterMode
	//ClusterUnknown 未知
	ClusterUnknown

	AliCloudNetMode = "alibabacloud"
	VxLanNetMode    = "vxlan"
)

func String2BuildMode

func String2BuildMode(mode string) BuildMode

String2BuildMode 字符串到创建模式转换

type BuildNetMode added in v0.4.0

type BuildNetMode string

type ClusterBuildMachine

type ClusterBuildMachine struct {
	IP       string            `json:"ip"`
	Hostname string            `json:"hostname"`
	Username string            `json:"username"`
	Password string            `json:"password"`
	Labels   map[string]string `json:"labels"`
}

ClusterBuildMachine 创建集群所用的物理机实体

type ClusterBuilderParams

type ClusterBuilderParams struct {
	PodCidr      string                `json:"pod_cidr"`
	SvcCidr      string                `json:"svc_cidr"`
	MachineList  []ClusterBuildMachine `json:"machine_list"`
	Mode         BuildMode             `json:"mode"`
	NetMode      BuildNetMode          `json:"net_mode"`
	KubernetesId int64                 `json:"kubernetes_id"`
	AccessKey    string                `json:"ak"`
	AccessSecret string                `json:"sk"`
}

ClusterBuilderParams 集群创建相关参数

type ClusterNodeSummary

type ClusterNodeSummary struct {
	//Status节点状态
	Status string `json:"status"`
	//IpAddress ip信息
	IpAddress string `json:"ip_address"`
	//HostName 机器名称
	HostName string `json:"host_name"`
	//ClusterName 集群名称
	ClusterName string `json:"cluster_name"`
	//AllCpuCores 所有cpu数量
	AllCpuCores int `json:"all_cpu_cores"`
	//AllocatedCpuCores 已经分配cpu数量
	FreeCpuCores float64 `json:"free_cpu_cores"`
	//AllMemoryGi 集群内存总数
	AllMemoryGi float64 `json:"all_memory_gi"`
	//AllocatedMemoryGi 已经分配内存
	FreeMemoryGi float64 `json:"free_memory_gi"`
	//AllDiskGi 磁盘大小
	AllDiskGi float64 `json:"all_disk_gi"`
	//AllocatedDiskGi 已经分配磁盘大小
	FreeDiskGi float64 `json:"free_disk_gi"`
	//MachineType 机器型号
	MachineType string `json:"machine_type"`
	//CloudProvider 为所属云厂商
	CloudProvider string `json:"cloud_provider"`
	//PodCount 实例中pod数量
	PodCount int `json:"pod_count"`
	//master/node
	Role string `json:"role"`
	//Message 获取节点失败信息,正常返回为success,异常时返回出错信息
	Message string `json:"message"`
}

ClusterNodeSummary 节点综述

type ClusterNodeSummaryArray

type ClusterNodeSummaryArray []*ClusterNodeSummary

func (ClusterNodeSummaryArray) Len

func (array ClusterNodeSummaryArray) Len() int

func (ClusterNodeSummaryArray) Less

func (array ClusterNodeSummaryArray) Less(i, j int) bool

func (ClusterNodeSummaryArray) Swap

func (array ClusterNodeSummaryArray) Swap(i, j int)

type ClusterPodsSummaryArray

type ClusterPodsSummaryArray []*PodSummary

func (ClusterPodsSummaryArray) Len

func (array ClusterPodsSummaryArray) Len() int

func (ClusterPodsSummaryArray) Less

func (array ClusterPodsSummaryArray) Less(i, j int) bool

func (ClusterPodsSummaryArray) Swap

func (array ClusterPodsSummaryArray) Swap(i, j int)

type ClusterSummary

type ClusterSummary struct {
	//ClusterId 集群ID
	ClusterId int64 `json:"cluster_id"`
	//ClusterName  集群名称
	ClusterName string `json:"cluster_name"`
	//AllCpuCores 所有cpu数量
	AllCpuCores int `json:"all_cpu_cores"`
	//FreeCpuCores 剩余cpu数量
	FreeCpuCores float64 `json:"free_cpu_cores"`
	//AllMemoryGi 集群内存总数
	AllMemoryGi float64 `json:"all_memory_gi"`
	//FreeMemoryG 剩余内存
	FreeMemoryGi float64 `json:"free_memory_gi"`
	//AllDiskGi 磁盘大小
	AllDiskGi float64 `json:"all_disk_gi"`
	//FreeDiskGi 剩余磁盘
	FreeDiskGi float64 `json:"free_disk_gi"`

	//AllocatedDiskGi 最大可分配cpu
	MaxUnallocatedCpuInNode float64 `json:"max_unallocated_cpu_in_node"`
	//MaxUnallocatedMemoryInNode 最大未分配内存
	MaxUnallocatedMemoryInNode float64 `json:"max_unallocated_memory_in_node"`
	//MaxUnallocatedStorageInNode  最大没有分配存储
	MaxUnallocatedStorageInNode float64 `json:"max_unallocated_storage_in_node"`

	//PodCount pod总数
	PodCount int64 `json:"pod_count"`
	//WorkCount work节点数量
	WorkCount int `json:"work_count"`
	//MasterCount master节点数量
	MasterCount int `json:"master_count"`
	//CreatedUser
	CreatedUser string `json:"created_user"`
	//CreatedTime
	CreatedTime string `json:"created_time"`
	//Status 集群状态
	Status string `json:"status"`
	//Message 其他信息,当集群异常时,相关的额错误信息
	Message     string `json:"message"`
	InstallStep string `json:"install_step"`
}

ClusterSummary 集群概要信息

type CreateClusterRequest

type CreateClusterRequest struct {
	ClusterName     string         `json:"cluster_name"`
	BridgxClusterId int64          `json:"bridgx_cluster_id"`
	Type            KubernetesType `json:"type"`
}

type EditBridgxClusterTagRequst

type EditBridgxClusterTagRequst struct {
	Tags        map[string]string `json:"tags"`
	ClusterName string            `json:"cluster_name"`
}

EditBridgxClusterTagRequst 编辑tag请求

type EditBridgxClusterTagResponse

type EditBridgxClusterTagResponse struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

EditBridgxClusterTagResponse 编辑请求返回

type GetAKSKResponse

type GetAKSKResponse struct {
	Code int       `json:"code"`
	Data *AKSKData `json:"data"`
	Msg  string    `json:"msg"`
}

GetAKSKResponse 获得AKSKresponse

type GetBridgxClusterInstanceData

type GetBridgxClusterInstanceData struct {
	InstanceList []*BridgxInstance `json:"instance_list"`
	Pager        Pager             `json:"pager"`
}

GetBridgxClusterInstanceData 获取集群data

type GetBridgxClusterInstanceRequest

type GetBridgxClusterInstanceRequest struct {
	ClusterName string `json:"cluster_name"`
	Status      string `json:"status"`
}

GetBridgxClusterInstanceRequest 获得Bridgx信息的Request

type GetBridgxClusterInstanceResponse

type GetBridgxClusterInstanceResponse struct {
	Code int                           `json:"code"`
	Msg  string                        `json:"msg"`
	Data *GetBridgxClusterInstanceData `json:"data"`
}

GetBridgxClusterInstanceResponse 获得集群实例返回

type GetClusterSummaryResponse

type GetClusterSummaryResponse struct {
	*ResponseBase
	Cluster *ClusterSummary `json:"cluster"`
}

GetClusterSummaryResponse 获取单个集群信息

func NewGetClusterSummaryResponse

func NewGetClusterSummaryResponse(cluster *ClusterSummary) *GetClusterSummaryResponse

NewGetClusterSummaryResponse 新建正常返回结构

type Instance

type Instance struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Ip      string `json:"ip"`
	HostIp  string `json:"host_ip"`
}

type InstanceDeleteRequest

type InstanceDeleteRequest struct {
	InstanceGroupId int64  `json:"instance_group_id" binding:"required"`
	InstanceName    string `json:"instance_name" binding:"required"`
}

type InstanceForm

type InstanceForm struct {
	Id                   int64  `json:"id"`
	ExecuteStatus        string `json:"execute_status"`
	InstanceGroup        string `json:"instance_group"`
	Cpu                  string `json:"cpu"`
	Memory               string `json:"memory"`
	Disk                 string `json:"disk"`
	UpdatedInstanceCount int    `json:"updated_instance_count"`
	HostTime             int64  `json:"host_time"`
	OptType              string `json:"opt_type"`
	CreatedUserId        int64  `json:"created_user_id"`
	CreatedUserName      string `json:"created_user_name"`
	CreatedTime          int64  `json:"created_time"`
	ClusterName          string `json:"cluster_name"`
}

type InstanceFormListResponse

type InstanceFormListResponse struct {
	*ResponseBase
	InstanceForms []*InstanceForm `json:"instance_forms"`
	Pager         Pager           `json:"pager"`
}

func NewInstanceFormListResponse

func NewInstanceFormListResponse(instanceForms []*InstanceForm, pager Pager) *InstanceFormListResponse

type InstanceGroup

type InstanceGroup struct {
	Id            int64  `json:"id"`
	KubernetesId  int64  `json:"kubernetes_id"`
	Name          string `json:"name"`
	Image         string `json:"image"`
	Cpu           string `json:"cpu"`
	Memory        string `json:"memory"`
	Disk          string `json:"disk"`
	InstanceCount int    `json:"instance_count"`
	CreatedUser   string `json:"created_user"`
	CreatedUserId int64  `json:"created_user_id"`
	SshPwd        string `json:"ssh_pwd"`
}

type InstanceGroupBatchDeleteRequest

type InstanceGroupBatchDeleteRequest struct {
	Ids []int64 `json:"ids" binding:"min=1"`
}

type InstanceGroupCreateRequest

type InstanceGroupCreateRequest struct {
	KubernetesId  int64  `json:"kubernetes_id" binding:"required"`
	Name          string `json:"name" binding:"required,lowercaseOrNumeric"`
	Image         string `json:"image"`
	Cpu           string `json:"cpu" binding:"required"`
	Memory        string `json:"memory" binding:"required"`
	Disk          string `json:"disk" binding:"required"`
	InstanceCount int    `json:"instance_count" binding:"required"`
	CreatedUser   string `json:"created_user"`
	CreatedUserId int64  `json:"created_user_id"`
	SshPwd        string `json:"ssh_pwd" binding:"min=1,max=6"`
}

type InstanceGroupExpandOrShrinkRequest

type InstanceGroupExpandOrShrinkRequest struct {
	InstanceGroupId int64 `json:"instance_group_id" binding:"required"`
	Count           int   `json:"count" binding:"required"`
}

type InstanceGroupExpandRequest

type InstanceGroupExpandRequest struct {
	InstanceGroupId int64 `json:"instance_group_id" binding:"required"`
	Count           int   `json:"count" binding:"required"`
}

instances

type InstanceGroupGetResponse

type InstanceGroupGetResponse struct {
	*ResponseBase
	InstanceGroup *InstanceGroup `json:"instance_group"`
}

func NewGetInstanceGroupResponse

func NewGetInstanceGroupResponse(instanceGroup *InstanceGroup) InstanceGroupGetResponse

type InstanceGroupListResponse

type InstanceGroupListResponse struct {
	*ResponseBase
	InstanceGroups []*InstanceGroup `json:"instance_groups"`
	Pager          Pager            `json:"pager"`
}

func NewListInstanceGroupResponse

func NewListInstanceGroupResponse(instanceGroups []*InstanceGroup, pager Pager) InstanceGroupListResponse

type InstanceGroupShrinkRequest

type InstanceGroupShrinkRequest struct {
	InstanceGroupId int64 `json:"instance_group_id" binding:"required"`
	Count           int   `json:"count" binding:"required"`
}

type InstanceGroupUpdateRequest

type InstanceGroupUpdateRequest struct {
	Id            int64  `json:"id" binding:"required"`
	KubernetesId  int64  `json:"kubernetes_id" binding:"required"`
	Name          string `json:"name" binding:"required,lowercaseOrNumeric"`
	Image         string `json:"image"`
	Cpu           string `json:"cpu" binding:"required"`
	Memory        string `json:"memory" binding:"required"`
	Disk          string `json:"disk" binding:"required"`
	InstanceCount int    `json:"instance_count" binding:"required"`
	CreatedUser   string `json:"created_user"`
	CreatedUserId int64  `json:"created_user_id"`
}

type InstanceListResponse

type InstanceListResponse struct {
	*ResponseBase
	Instances []*Instance `json:"instances"`
}

func NewInstanceListResponse

func NewInstanceListResponse(instances []*Instance) *InstanceListResponse

type InstanceRestartRequest

type InstanceRestartRequest struct {
	InstanceGroupId int64  `json:"instance_group_id" binding:"required"`
	InstanceName    string `json:"instance_name" binding:"required"`
}

type KubernetesInfo

type KubernetesInfo struct {
	Id                int64  `json:"id"`
	Name              string `json:"name"`
	Region            string `json:"region"`
	CloudType         string `json:"cloud_type"`
	Status            string `json:"status"`
	Config            string `json:"config"` //kube config
	InstallStep       string `json:"install_step"`
	Message           string `json:"message"`
	BridgxClusterName string `json:"bridgx_cluster_name"`
	Type              string `json:"type"`
	CreatedUser       string `json:"created_user"`
	CreatedTime       int64  `json:"created_time"`
	PodCidr           string `json:"pod_cidr"`
	ServiceCidr       string `json:"service_cidr"`
}

KubernetesInfo 代表一个Kubernetes集群

type KubernetesInfoGetResponse

type KubernetesInfoGetResponse struct {
	*ResponseBase
	Cluster *KubernetesInfo
}

func NewKubernetesInfoGetResponse

func NewKubernetesInfoGetResponse(cluster *KubernetesInfo) *KubernetesInfoGetResponse

type KubernetesInfoListResponse

type KubernetesInfoListResponse struct {
	*ResponseBase
	Clusters []*KubernetesInfo `json:"clusters"`
}

func NewKubernetesInfoListResponse

func NewKubernetesInfoListResponse(clusters []*KubernetesInfo) *KubernetesInfoListResponse

type KubernetesInstallStep

type KubernetesInstallStep struct {
	Id           int64  `json:"id"`
	KubernetesId int64  `json:"kubernetes_id"`
	HostIp       string `json:"host_ip"`
	Operation    string `json:"operation"`
	Message      string `json:"message"`
}

type KubernetesType

type KubernetesType string

type ListBirdgxClusterByClusterResponse

type ListBirdgxClusterByClusterResponse struct {
	Code int                    `json:"code"`
	Msg  string                 `json:"msg"`
	Data *ListBirdgxClusterData `json:"data"`
}

ListBirdgxClusterByClusterResponse Bridgx返回

type ListBirdgxClusterData

type ListBirdgxClusterData struct {
	ClusterList []*BridgxClusterName `json:"cluster_list"`
	Pager       Pager                `json:"pager"`
}

ListBirdgxClusterData 列出集群中返回体数据

type ListBridgxClusterByTagRequest

type ListBridgxClusterByTagRequest struct {
	Tags       map[string]string `json:"tags"`
	PageNumber int               `json:"page_number"`
	PageSize   int               `json:"page_size"`
}

ListBridgxClusterByTagRequest 获取集群请求的Request

type ListClusterLogsResponse added in v0.5.0

type ListClusterLogsResponse struct {
	*ResponseBase
	Logs []KubernetesInstallStep `json:"logs"`
}

type ListClusterNodesResponse

type ListClusterNodesResponse struct {
	*ResponseBase
	Pager
	Nodes ClusterNodeSummaryArray `json:"nodes"`
}

ListClusterNodesResponse get api/v1/kubernetes/nodes get response

func NewListClusterNodesResponse

func NewListClusterNodesResponse(nodes []*ClusterNodeSummary, page Pager) *ListClusterNodesResponse

type ListClusterPodDetail

type ListClusterPodDetail struct {
	ClusterPodsSummaryArray `json:"pods_information"`
}

ListClusterPodDetail 节点详细信息

type ListClusterPodsDetailResponse

type ListClusterPodsDetailResponse struct {
	*ResponseBase
	Pager
	Pods ClusterPodsSummaryArray `json:"pods"`
}

ListClusterPodsDetailResponse 返回集群pod信息

func NewListClusterPodsDetailResponse

func NewListClusterPodsDetailResponse(array ClusterPodsSummaryArray, pager Pager) *ListClusterPodsDetailResponse

type ListClusterSummaryResponse

type ListClusterSummaryResponse struct {
	*ResponseBase
	Pager
	Clusters []*ClusterSummary `json:"clusters"`
}

ListClusterSummaryResponse get api/v1/kubernetes/summary get response

func NewListClusterSummaryResponse

func NewListClusterSummaryResponse(clusters []*ClusterSummary, pager Pager) *ListClusterSummaryResponse

NewListClusterSummaryResponse 新建正常返回结构

type ListUnusedBridgxClusterResponse

type ListUnusedBridgxClusterResponse struct {
	*ResponseBase
	Pager
	Clusters []*BridgxUnusedCluster `json:"clusters"`
}

ListUnusedBridgxClusterResponse 未被占用集群list相应体

func NewListUnusedBridgxClusterResponse

func NewListUnusedBridgxClusterResponse(clusters []*BridgxUnusedCluster, pager Pager) *ListUnusedBridgxClusterResponse

NewListUnusedBridgxClusterResponse 新建未被占用的集群的相应体

type Pager

type Pager struct {
	PageNumber int `json:"page_number"`
	PageSize   int `json:"page_size"`
	Total      int `json:"total"`
}

type PingResponse

type PingResponse struct {
	*ResponseBase
	Module  string
	Version string
}

PingResponse 用于测试服务是否可用

func NewPingResponse

func NewPingResponse() *PingResponse

type PodSummary

type PodSummary struct {
	NodeName string `json:"node_name"`
	NodeIp   string `json:"node_ip"`

	PodName string `json:"pod_name"`
	PodIP   string `json:"pod_ip"`

	//AllocatedCpuCores 已经分配cpu数量
	AllocatedCpuCores float64 `json:"allocated_cpu_cores"`
	//AllocatedMemoryGi 已经分配内存
	AllocatedMemoryGi float64 `json:"allocated_memory_gi"`
	//AllocatedDiskGi 已经分配磁盘大小
	AllocatedDiskGi float64 `json:"allocated_disk_gi"`
	//GroupName 组名
	GroupName string `json:"group_name"`
	//RunningTime 运行时间
	RunningTime string `json:"running_time"`
	//Status 状态
	Status    string `json:"status"`
	GroupId   int64  `json:"group_id"`
	StartTime int64  `json:"start_time"`
}

type ResponseBase

type ResponseBase struct {
	Status  string `json:"status"`
	Message string `json:"message"`
}

func NewFailedResponse

func NewFailedResponse(message string) *ResponseBase

func NewSuccessResponse

func NewSuccessResponse() *ResponseBase

Jump to

Keyboard shortcuts

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