node

package
v0.0.0-...-9b348fc Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	Allocatable          v1.ResourceList
	RunningPodsNum       int64
	TerminatingPodsNum   int64
	FailedPodsNum        int64
	TotalResourceRequest v1.ResourceList
	TotalResourceUsage   v1.ResourceList
}

Metrics is a metrics of a Node at one point of time.

type Node

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

Node represents a simulated computing node.

func NewNode

func NewNode(node *v1.Node) Node

NewNode creates a new Node with the given v1.Node.

func (*Node) BindPod

func (node *Node) BindPod(clock clock.Clock, v1Pod *v1.Pod) (*pod.Pod, error)

BindPod accepts the given pod and try to start it. The pod will fail to be started if there is not sufficient resources. Returns the bound pod in pod.Pod representation, or error if the pod has invalid name or failed to create a simulated pod.

func (*Node) DeletePod

func (node *Node) DeletePod(clock clock.Clock, podNamespace, podName string) bool

DeletePod start deleting the given pod from this Node. Returns true if the pod is found in this Node, or false otherwise.

func (*Node) GCTerminatedPods

func (node *Node) GCTerminatedPods(clock clock.Clock)

GCTerminatedPods deletes terminated or deleted pods at the given clock from this Node.

func (*Node) Metrics

func (node *Node) Metrics(clock clock.Clock) Metrics

Metrics returns the Metrics of this Node at the given clock.

func (*Node) Pod

func (node *Node) Pod(namespace, name string) *pod.Pod

Pod returns the *pod.Pod by name that was accepted on this node. The returned pod may have failed to be started. Returns nil if the pod is not found.

func (*Node) PodList

func (node *Node) PodList() []*pod.Pod

PodList returns a list of all pods that were accepted on this Node and not terminated nor deleted. Each of the returned pods may have failed to be started.

func (*Node) PodsNum

func (node *Node) PodsNum(clock clock.Clock) int64

PodsNum returns the number of all running or terminating pods on this Node at the given clock.

func (*Node) ToNodeInfo

func (node *Node) ToNodeInfo(clock clock.Clock) *nodeinfo.NodeInfo

ToNodeInfo creates *nodeinfo.NodeInfo object from this Node.

func (*Node) ToV1

func (node *Node) ToV1() *v1.Node

ToV1 returns *v1.Node representation of this Node.

Jump to

Keyboard shortcuts

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