bcs

package
v0.0.0-...-86d5f22 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package bcs 集群操作

Index

Constants

View Source
const (
	// VirtualClusterType vcluster
	VirtualClusterType = "virtual"
)

Variables

This section is empty.

Functions

func CacheListClusters

func CacheListClusters()

CacheListClusters 定时同步 cluster 列表

func GetClusterMap

func GetClusterMap() (map[string]*Cluster, error)

GetClusterMap 获取全部集群数据, map格式

func ListClusters

func ListClusters()

ListClusters 获取集群列表

Types

type Cluster

type Cluster struct {
	ProjectID       string `json:"projectID"`
	ClusterID       string `json:"clusterID"`
	ClusterName     string `json:"clusterName"`
	BKBizID         string `json:"businessID"`
	Status          string `json:"status"`
	IsShared        bool   `json:"is_shared"`
	ClusterType     string `json:"clusterType"`
	NetworkSettings struct {
		MaxNodePodNum int `json:"maxNodePodNum"`
		MaxServiceNum int `json:"maxServiceNum"`
	} `json:"networkSettings"`
	ExtraInfo struct {
		NamespaceInfo   string `json:"namespaceInfo"`
		Provider        string `json:"provider"`
		VclusterNetwork string `json:"vclusterNetwork"`
	} `json:"extraInfo"`
	VclusterInfo VclusterInfo `json:"-"`
}

Cluster 集群信息

func GetCluster

func GetCluster(clusterID string) (*Cluster, error)

GetCluster 获取集群详情

func (*Cluster) IsVirtual

func (c *Cluster) IsVirtual() bool

IsVirtual check cluster is vcluster

func (*Cluster) String

func (c *Cluster) String() string

String :

type Project

type Project struct {
	Name          string `json:"name"`
	ProjectId     string `json:"projectID"`
	Code          string `json:"projectCode"`
	CcBizID       string `json:"businessID"`
	Creator       string `json:"creator"`
	Kind          string `json:"kind"`
	RawCreateTime string `json:"createTime"`
}

Project 项目信息

func GetProject

func GetProject(ctx context.Context, bcsConf *config.BCSConf, projectIDOrCode string) (*Project, error)

GetProject 通过 project_id/code 获取项目信息

func (*Project) CreateTime

func (p *Project) CreateTime() (time.Time, error)

CreateTime xxx

func (*Project) String

func (p *Project) String() string

String :

type VclusterInfo

type VclusterInfo struct {
	Name  string        `json:"name"`
	Quota VclusterQuota `json:"quota"`
}

VclusterInfo vcluster info, parse from extraInfo.namespaceInfo

type VclusterQuota

type VclusterQuota struct {
	CPURequests    string `json:"cpuRequests"`
	CPULimits      string `json:"cpuLimits"`
	MemoryRequests string `json:"MemoryRequests"`
	MemoryLimits   string `json:"memoryLimits"`
}

VclusterQuota vcluster quota, parse from extraInfo.namespaceInfo

Jump to

Keyboard shortcuts

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