Documentation
¶
Index ¶
- func CalculateNodeAllocatedRes(nodeName string, pods []types2.APIObject) (cpu, mem, podNum int64)
- func CalculateNodeRes(node data.Object, allocatedCPU, allocatedMem, allocatedPods int64) (unallocatedCPU, unallocatedMem, leftCPU, leftMem, leftPods int64)
- func GetNodesAllocatedRes(server cmp.SteveServer, clusterName, userID, orgID string, nodes []data.Object) (map[string]NodeAllocatedRes, error)
- func GetWorkloadAgeAndImage(obj data.Object) (string, string, error)
- func ParseWorkloadID(id string) (apistructs.K8SResType, string, string, error)
- func ParseWorkloadStatus(obj data.Object) (string, string, error)
- func ResourceToString(sdk *cptype.SDK, res float64, format resource.Format) string
- type NodeAllocatedRes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateNodeAllocatedRes ¶ added in v1.3.1
CalculateNodeAllocatedRes calculate allocated cpu, memory and pods for target node
func CalculateNodeRes ¶
func CalculateNodeRes(node data.Object, allocatedCPU, allocatedMem, allocatedPods int64) (unallocatedCPU, unallocatedMem, leftCPU, leftMem, leftPods int64)
CalculateNodeRes calculate unallocated cpu, memory and left cpu, mem, pods for given node and its allocated cpu, memory
func GetNodesAllocatedRes ¶ added in v1.3.1
func GetNodesAllocatedRes(server cmp.SteveServer, clusterName, userID, orgID string, nodes []data.Object) (map[string]NodeAllocatedRes, error)
GetNodesAllocatedRes get nodes allocated resource from cache, and update cache in goroutine
func GetWorkloadAgeAndImage ¶
GetWorkloadAgeAndImage get age and image for workloads from .metadata.fields
func ParseWorkloadID ¶
func ParseWorkloadID(id string) (apistructs.K8SResType, string, string, error)
ParseWorkloadID get workloadKind, namespace and name from id
func ParseWorkloadStatus ¶
ParseWorkloadStatus get status for workloads from .metadata.fields
func ResourceToString ¶
ResourceToString return resource with unit Only support resource.DecimalSI and resource.BinarySI format Original unit is m (for DecimalSI) or B (for resource.BinarySI) Accurate to 3 decimal places. Zero in suffix will be removed