statistics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const ResourceLimitsPrefix = "limits."

Variables

This section is empty.

Functions

func AddResourceList

func AddResourceList(total corev1.ResourceList, add corev1.ResourceList)

func AppendResourceNamePrefix

func AppendResourceNamePrefix(prefix string, list corev1.ResourceList) corev1.ResourceList

func FilterResourceName

func FilterResourceName(list corev1.ResourceList, keep func(name corev1.ResourceName) bool) corev1.ResourceList

func GetClusterTenantResourceQuotaLimits

func GetClusterTenantResourceQuotaLimits(ctx context.Context, cli client.Client) (corev1.ResourceList, error)

func ResourceListCollect

func ResourceListCollect(into, vals corev1.ResourceList, collect ResourceListCollectFunc) corev1.ResourceList

func SubResourceList

func SubResourceList(total corev1.ResourceList, sub corev1.ResourceList)

Types

type ClusterPodResourceStatistics

type ClusterPodResourceStatistics struct {
	Limit   corev1.ResourceList                    `json:"limit"`
	Request corev1.ResourceList                    `json:"request"`
	Nodes   map[string]corev1.ResourceRequirements `json:"nodes"`
}

func GetAllPodResourceStatistics

func GetAllPodResourceStatistics(ctx context.Context, cli client.Client) (ClusterPodResourceStatistics, error)

type ClusterResourceStatistics

type ClusterResourceStatistics struct {
	// 集群资源的总容量,即物理资源总量
	Capacity corev1.ResourceList `json:"capacity"`
	// 集群资源的真实使用量
	Used corev1.ResourceList `json:"used"`
	// 集群下的租户资源分配总量
	TenantAllocated corev1.ResourceList `json:"tenantAllocated"`
}

func GetClusterResourceStatistics

func GetClusterResourceStatistics(ctx context.Context, cli client.Client) ClusterResourceStatistics

type ClusterStatistics

type ClusterStatistics struct {
	Version   string                    `json:"version"`
	Resources ClusterResourceStatistics `json:"resources"`
	Workloads ClusterWorkloadStatistics `json:"workloads"`
}

func GetClusterAllStatistics

func GetClusterAllStatistics(ctx context.Context, cli client.Client, discovery discovery.DiscoveryInterface) *ClusterStatistics

type ClusterWorkloadStatistics

type ClusterWorkloadStatistics map[string]int

func GetWorkloadsStatistics

func GetWorkloadsStatistics(ctx context.Context, cli client.Client) ClusterWorkloadStatistics

type ResourceListCollectFunc

type ResourceListCollectFunc func(corev1.ResourceName, *resource.Quantity, resource.Quantity)

Jump to

Keyboard shortcuts

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