resourcesummary

package
v0.0.0-...-e7c744b Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusReady    = "Ready"
	StatusNotReady = "Not ready"
	StatusUnknown  = "Unknown"
)

Variables

This section is empty.

Functions

func CalculateNodesTotalCapacityAndAllocatable

func CalculateNodesTotalCapacityAndAllocatable(nodes []v1.Node) (map[v1.ResourceName]resource.Quantity, map[v1.ResourceName]resource.Quantity)

CalculateNodesTotalCapacityAndAllocatable calculates capacity and allocatable resources of the given nodes.

func CalculatePodsTotalRequestsAndLimits

func CalculatePodsTotalRequestsAndLimits(pods []v1.Pod) (map[v1.ResourceName]resource.Quantity, map[v1.ResourceName]resource.Quantity)

CalculatePodsTotalRequestsAndLimits calculates resource requests and limits of the given pods.

func GetNodeStatus

func GetNodeStatus(node v1.Node) string

GetNodeStatus returns the node's actual status.

func NodeCapacityAndAllocatable

func NodeCapacityAndAllocatable(node v1.Node) (map[v1.ResourceName]resource.Quantity, map[v1.ResourceName]resource.Quantity)

NodeCapacityAndAllocatable calculates capacity and allocatable resources for a node.

Types

type NodeSummary

type NodeSummary struct {
	Summary

	Status string
}

NodeSummary describes a node's resource summary with CPU and Memory capacity/request/limit/allocatable.

func CalculateNodeSummary

func CalculateNodeSummary(node v1.Node, requests, limits map[v1.ResourceName]resource.Quantity) NodeSummary

CalculateNodeSummary returns NodeSummary type with the given data.

func GetNodeSummary

func GetNodeSummary(ctx context.Context, client kubernetes.Interface, node v1.Node) (*NodeSummary, error)

GetNodeSummary returns resource summary for the given node.

type Resource

type Resource struct {
	Capacity    string
	Allocatable string
	Limit       string
	Request     string
}

Resource describes a resource with capacity/request/limit/allocatable.

type Summary

type Summary struct {
	CPU    Resource
	Memory Resource
}

Summary describes a resource summary with CPU and Memory capacity/request/limit/allocatable.

func GetSummary

func GetSummary(capacity, allocatable, requests, limits map[v1.ResourceName]resource.Quantity) Summary

GetSummary returns Summary type with the given data.

func GetTotalSummary

func GetTotalSummary(ctx context.Context, client kubernetes.Interface) (*Summary, error)

GetTotalSummary calculates all resource summary for a cluster.

func NewSummary

func NewSummary() Summary

NewSummary creates a new Summary with default zero values.

Jump to

Keyboard shortcuts

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