model

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 10, 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, pprov *pricing.Provider) (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) GetNode

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

func (*Cluster) GetPod

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

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) 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) 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) Ready

func (n *Node) Ready() bool

func (*Node) Show

func (n *Node) Show()

func (*Node) Update

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

func (*Node) UpdatePrice

func (n *Node) UpdatePrice(pricing *pricing.Provider)

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 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) 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
}

type UIModel

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

func NewUIModel

func NewUIModel(extraLabels []string) *UIModel

func (*UIModel) Cluster

func (u *UIModel) Cluster() *Cluster

func (*UIModel) Init

func (u *UIModel) Init() tea.Cmd

func (*UIModel) SetResources

func (u *UIModel) SetResources(resources []string)

func (*UIModel) Update

func (u *UIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*UIModel) View

func (u *UIModel) View() string

Jump to

Keyboard shortcuts

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