types

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TabulateCluster

func TabulateCluster(clusterManifest *ClusterManifest)

TabulateCluster Print cluster analytics in a tabular form

func TabulateNodeMap

func TabulateNodeMap(nodesMap map[string]NodeManifest)

TabulateNodeMap Print the Nodes Metrics in a Table

func TabulatePodsMap

func TabulatePodsMap(podsMap map[string]PodManifest)

TabulatePodsMap Print pod analytics in a tabular form

Types

type ClusterManifest

type ClusterManifest struct {
	ExcessNodes             float64
	NumberOfNonTaintedNodes int
	NumberOfNodes           int
	NumberOfPods            int
	TotalNodeMetrics        NodeMetrics
	TotalPodsMetrics        PodMetrics
	Utilization             Utilization
}

ClusterManifest Overall cluster metrics

func NewClusterManifest

func NewClusterManifest(nodesMap map[string]NodeManifest) ClusterManifest

NewClusterManifest creates a new cluster manifest object from a map of NodeManifest

func (*ClusterManifest) CalculateExcessNode

func (cm *ClusterManifest) CalculateExcessNode(sampleNode *NodeManifest)

CalculateExcessNode divide the remaining unused resources by a sample node to know the excess nodes

type NodeManifest

type NodeManifest struct {
	Node              *v1.Node
	Metrics           *NodeMetrics
	NumberOfPods      int
	TotalPodsRequests PodMetrics
	Pods              []*PodManifest
	Utilization       Utilization
}

NodeManifest meta-data of the node + the metrics of our concern

func (*NodeManifest) IncPods

func (nm *NodeManifest) IncPods()

IncPods increment number of pods in a NodeManifest by 1

type NodeMetrics

type NodeMetrics struct {
	AllocCPU resource.Quantity
	AllocRAM resource.Quantity
}

NodeMetrics allocatable cpu and ram of a node

func CreateNodeMetricsFromNodeObj

func CreateNodeMetricsFromNodeObj(node *v1.Node) *NodeMetrics

CreateNodeMetricsFromNodeObj create a NodeMetrics object by extracting the relevant information from a Node object

func (*NodeMetrics) AddNodeMetrics

func (nm *NodeMetrics) AddNodeMetrics(nmNew *NodeMetrics)

AddNodeMetrics add AddNodeMetrics to an existing AddNodeMetrics

type PodManifest

type PodManifest struct {
	Pod     *v1.Pod
	Metrics *PodMetrics
}

PodManifest meta-data of the pod + the metrics of our concern

func NewPodManifest

func NewPodManifest(pod *v1.Pod) PodManifest

NewPodManifest create a PodManifest by extracting the relevant information from a Pod object

type PodMetrics

type PodMetrics struct {
	ReqCPU resource.Quantity
	ReqRAM resource.Quantity
}

PodMetrics requests cpu and ram of a pod

func CreatePodMetricsFromPodObj

func CreatePodMetricsFromPodObj(pod *v1.Pod) *PodMetrics

CreatePodMetricsFromPodObj create a PodMetrics object by extracting the relevant information from a Pod object

func (*PodMetrics) AddPodContainerResources

func (pm *PodMetrics) AddPodContainerResources(container *v1.Container)

AddPodContainerResources from *v1.Pod.Spec.Containers to Metrics Object - Requests and Limits Resources

func (*PodMetrics) AddPodMetrics

func (pm *PodMetrics) AddPodMetrics(pmNew *PodMetrics)

AddPodMetrics add PodMetrics to an existing PodMetrics

type Utilization

type Utilization struct {
	PercentageCPU float64
	PercentageRAM float64
	Score         float64
}

Utilization percentage of total requests on a node over its allocatable

func CalculateUtilizationPercentage

func CalculateUtilizationPercentage(podMetrics *PodMetrics, nodeMetrics *NodeMetrics) Utilization

CalculateUtilizationPercentage do the arithmetics to create a utilization metrics for a node

Jump to

Keyboard shortcuts

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