model

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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(providerID string)

func (*Cluster) DeletePod

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

func (*Cluster) ForEachNode added in v0.2.1

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

func (*Cluster) GetNode

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

func (*Cluster) GetNodeByName added in v0.6.0

func (c *Cluster) GetNodeByName(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 NewNodeFromNodeClaim added in v0.6.0

func NewNodeFromNodeClaim(nc *v1beta1.NodeClaim) *Node

func (*Node) Allocatable

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

func (*Node) BindPod

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

func (*Node) ComputeLabel added in v0.3.0

func (n *Node) ComputeLabel(labelName string) string

ComputeLabel computes dynamic labels

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 added in v0.2.0

func (n *Node) HasPrice() bool

func (*Node) Hide

func (n *Node) Hide()

func (*Node) InstanceID added in v0.6.0

func (n *Node) InstanceID() string

func (*Node) InstanceType

func (n *Node) InstanceType() string

func (*Node) IsFargate added in v0.2.0

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) NotReadyTime added in v0.4.3

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

NotReadyTime is the time that the node went NotReady, or when it was created if it hasn't been marked as NotReady.

func (*Node) NumPods

func (n *Node) NumPods() int

func (*Node) Pods added in v0.2.0

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

func (*Node) ProviderID added in v0.6.0

func (n *Node) ProviderID() string

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 added in v0.2.1

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) FargateCapacityProvisioned added in v0.2.0

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
}

type Style added in v0.5.0

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

func ParseStyle added in v0.5.0

func ParseStyle(style string) (*Style, error)

type UIModel

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

func NewUIModel

func NewUIModel(extraLabels []string, nodeSort string, style *Style) *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