usage

package
v0.0.0-...-8073816 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocation

type Allocation struct {
	// CPU fraction of total CPU
	CPU float64 `json:"cpu"`
	// GPU fraction of total GPU
	GPU float64 `json:"gpu,omitempty"`
	// memory fraction of total memory
	Memory float64 `json:"memory"`
	// storage fraction of total storage
	Storage float64 `json:"storage,omitempty"`
	// ephemeral storage fraction of total ephemeral storage
	StorageEphemeral float64 `json:"storage_ephemeral,omitempty"`
}

type Allocations

type Allocations struct {
	Requests Allocation `json:"requests"`
	Limits   Allocation `json:"limits"`
}

type Ask

type Ask struct {
	CPU              int64 `json:"cpu,omitempty"`
	Memory           int64 `json:"memory,omitempty"`
	Storage          int64 `json:"storage,omitempty"`
	StorageEphemeral int64 `json:"storage_ephemeral,omitempty"`
	GPU              int64 `json:"gpu,omitempty"`
}

type Capacity

type Capacity struct {
	// CPU millicores
	CPU int64 `json:"cpu"`
	// GPU int64 `json:"gpu"`
	GPU int64 `json:"gpu,omitempty"`
	// memory Kibibytes
	Memory int64 `json:"memory"`
	// maximum number of Pods (depends on number of ENI
	Pods int64 `json:"pods,omitempty"`
	// local storage in Kibibytes
	Storage int64 `json:"storage,omitempty"`
	// ephemeral storage in Kibibytes
	StorageEphemeral int64 `json:"storage_ephemeral,omitempty"`
}

type Cost

type Cost struct {
	// Hourly cost of instance (on-demand, spot, or reserved)
	InstanceHour float64 `json:"instance_hour"`
	// Unit-cost-per-resource = Hourly-instance-cost/((Memory-weight * Memory-available) + (CPU-weight * CPU-available) + (GPU-weight * GPU-available))
	UnitCostResource float64 `json:"unit_cost_resource"`
	// Cost-per-vCPU-hour = CPU-weight * Unit-cost-per-resource
	VCPUHour float64 `json:"vcpu_hour"`
	// Cost-per-memory-hour = Memory-weight * Unit-cost-per-resource
	MemoryHour float64 `json:"memory_hour"`
	// Cost-per-GPU-hour = GPU-weight * Unit-cost-per-resource
	GPUHour float64 `json:"gpu_hour"`
}

Cost is the cost of an instance per hour per resource

type NodeInfo

type NodeInfo struct {
	ID           string `json:"id"`
	Name         string `json:"name"`
	Cluster      string `json:"cluster"`
	Nodegroup    string `json:"nodegroup,omitempty"`
	InstanceType string `json:"type,omitempty"`
	// ComputeType: fargate or ec2
	ComputeType string `json:"compute_type,omitempty"`
	// CapacityType: SPOT or ON_DEMAND
	CapacityType   string    `json:"capacity_type,omitempty"`
	Region         string    `json:"region"`
	Zone           string    `json:"zone"`
	Arch           string    `json:"arch"`
	OS             string    `json:"os"`
	OSImage        string    `json:"os_image"`
	KernelVersion  string    `json:"kernel"`
	KubeletVersion string    `json:"kubelet"`
	Runtime        string    `json:"runtime"`
	Allocatable    Capacity  `json:"allocatable"`
	Capacity       Capacity  `json:"capacity"`
	Created        time.Time `json:"created"`
	Cost           Cost      `json:"cost"`
}

func NodeInfoFromNode

func NodeInfoFromNode(cluster string, node *v1.Node) NodeInfo

type PodInfo

type PodInfo struct {
	Name        string            `json:"name"`
	Namespace   string            `json:"namespace"`
	Labels      map[string]string `json:"labels,omitempty"`
	Node        NodeInfo          `json:"node"`
	QosClass    string            `json:"qos_class"`
	StartTime   time.Time         `json:"start_time"`
	BeginTime   time.Time         `json:"begin_time"`
	EndTime     time.Time         `json:"end_time"`
	Resources   Resources         `json:"resources,omitempty"`
	Allocations Allocations       `json:"allocations,omitempty"`
}

func GetPodInfo

func GetPodInfo(log *logrus.Entry, pod *v1.Pod, beginTime, endTime time.Time, node *NodeInfo) *PodInfo

type Resources

type Resources struct {
	Requests Ask `json:"requests,omitempty"`
	Limits   Ask `json:"limits,omitempty"`
}

Jump to

Keyboard shortcuts

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