model

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	// contains filtered or unexported fields
}

func NewCluster

func NewCluster() *Cluster

func (*Cluster) AddNode

func (c *Cluster) AddNode(node *Node) *Node

func (*Cluster) AddPod

func (c *Cluster) AddPod(pod *Pod) (totalPods int)

func (*Cluster) DeleteNode

func (c *Cluster) DeleteNode(name string)

func (*Cluster) DeletePod

func (c *Cluster) DeletePod(namespace, name string) (totalPods int)

func (*Cluster) ForEachNode

func (c *Cluster) ForEachNode(f func(n *Node))

func (*Cluster) GetNode

func (c *Cluster) GetNode(name string) (*Node, bool)

func (*Cluster) GetPod

func (c *Cluster) GetPod(namespace string, name string) (*Pod, bool)

func (*Cluster) Populate

func (c *Cluster) Populate(ctx context.Context, cs *kubernetes.Clientset) error

func (*Cluster) Stats

func (c *Cluster) Stats() Stats

type Node

type Node struct {
	Price float64
	// contains filtered or unexported fields
}

func NewNode

func NewNode(n *v1.Node) *Node

func (*Node) Allocatable

func (n *Node) Allocatable() v1.ResourceList

func (*Node) BindPod

func (n *Node) BindPod(pod *Pod)

func (*Node) CapacityType

func (n *Node) CapacityType() NodeCapacityType

func (*Node) Cordoned

func (n *Node) Cordoned() bool

func (*Node) Created

func (n *Node) Created() time.Time

func (*Node) DeletePod

func (n *Node) DeletePod(namespace string, name string)

func (*Node) Deleting

func (n *Node) Deleting() bool

func (*Node) HasPrice

func (n *Node) HasPrice() bool

func (*Node) Hide

func (n *Node) Hide()

func (*Node) InstanceType

func (n *Node) InstanceType() string

func (*Node) IsFargate

func (n *Node) IsFargate() bool

func (*Node) IsOnDemand

func (n *Node) IsOnDemand() bool

func (*Node) IsSpot

func (n *Node) IsSpot() bool

func (*Node) Name

func (n *Node) Name() string

func (*Node) NumPods

func (n *Node) NumPods() int

func (*Node) Pods

func (n *Node) Pods() []*Pod

func (*Node) Ready

func (n *Node) Ready() bool

func (*Node) Region

func (n *Node) Region() string

func (*Node) Show

func (n *Node) Show()

func (*Node) Status added in v0.2.0

func (n *Node) Status() NodeStatus

func (*Node) Update

func (n *Node) Update(node *v1.Node)

func (*Node) UpdatePrice

func (n *Node) UpdatePrice(pricingRepository *pricing.Repository)

func (*Node) Used

func (n *Node) Used() v1.ResourceList

func (*Node) Visible

func (n *Node) Visible() bool

func (*Node) Zone

func (n *Node) Zone() string

type NodeCapacityType

type NodeCapacityType string
const (
	NodeUnknownCapacityType NodeCapacityType = ""
	NodeOnDemand            NodeCapacityType = "on-demand"
	NodeSpot                NodeCapacityType = "spot"
	NodeFargate             NodeCapacityType = "fargate"
)

func (NodeCapacityType) String

func (nct NodeCapacityType) String() string

type NodeStatus added in v0.2.0

type NodeStatus string
const (
	NodeStatusUnknown    NodeStatus = "Unknown"
	NodeCordonedDeleting NodeStatus = "Cordoned/Deleting"
	NodeDeleting         NodeStatus = "Deleting"
	NodeCordoned         NodeStatus = "Cordoned"
	NodeReady            NodeStatus = "Ready"
)

func (NodeStatus) String added in v0.2.0

func (ns NodeStatus) String() string

type Pod

type Pod struct {
	// contains filtered or unexported fields
}

Pod is our pod model used for internal storage and display.

func NewPod

func NewPod(n *v1.Pod) *Pod

NewPod constructs a pod model based off of the K8s pod object.

func (*Pod) FargateCapacityProvisioned

func (p *Pod) FargateCapacityProvisioned() (float64, float64, bool)

func (*Pod) IsScheduled

func (p *Pod) IsScheduled() bool

IsScheduled returns true if the pod has been scheduled to a node.

func (*Pod) Name

func (p *Pod) Name() string

Name returns the name of the pod.

func (*Pod) Namespace

func (p *Pod) Namespace() string

Namespace returns the namespace of the pod.

func (*Pod) NodeName

func (p *Pod) NodeName() string

NodeName returns the node that the pod is scheduled against, or an empty string.

func (*Pod) Phase

func (p *Pod) Phase() v1.PodPhase

Phase returns the pod phase.

func (*Pod) Requested

func (p *Pod) Requested() v1.ResourceList

Requested returns the sum of the resources requested by the pod. This doesn't include any init containers as we are interested in the steady state usage of the pod.

func (*Pod) Update

func (p *Pod) Update(pod *v1.Pod)

Update updates the pod model, replacing it with a shallow copy of the provided pod.

type Stats

type Stats struct {
	NumNodes             int
	AllocatableResources v1.ResourceList
	UsedResources        v1.ResourceList
	PercentUsedResoruces map[v1.ResourceName]float64
	Nodes                []*Node
	TotalPods            int
	PodsByPhase          map[v1.PodPhase]int
	BoundPodCount        int
	TotalPrice           float64
}

Jump to

Keyboard shortcuts

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