state

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 28 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
}

Cluster maintains cluster state that is often needed but expensive to compute.

func NewCluster

func NewCluster(clk clock.Clock, client client.Client, cp cloudprovider.CloudProvider) *Cluster

func (*Cluster) Consolidated added in v0.24.0

func (c *Cluster) Consolidated() bool

ClusterConsolidationState returns a number representing the state of the cluster with respect to consolidation. If consolidation can't occur and this number hasn't changed, there is no point in re-attempting consolidation. This allows reducing overall CPU utilization by pausing consolidation when the cluster is in a static state.

func (*Cluster) DeleteDaemonSet added in v0.25.0

func (c *Cluster) DeleteDaemonSet(key types.NamespacedName)

func (*Cluster) DeleteMachine added in v0.24.0

func (c *Cluster) DeleteMachine(name string)

func (*Cluster) DeleteNode

func (c *Cluster) DeleteNode(name string)

func (*Cluster) DeletePod

func (c *Cluster) DeletePod(podKey types.NamespacedName)

func (*Cluster) ForEachNode

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

ForEachNode calls the supplied function once per node object that is being tracked. It is not safe to store the state.Node object, it should be only accessed from within the function provided to this method.

func (*Cluster) ForPodsWithAntiAffinity

func (c *Cluster) ForPodsWithAntiAffinity(fn func(p *v1.Pod, n *v1.Node) bool)

ForPodsWithAntiAffinity calls the supplied function once for each pod with required anti affinity terms that is currently bound to a node. The pod returned may not be up-to-date with respect to status, however since the anti-affinity terms can't be modified, they will be correct.

func (*Cluster) GetDaemonSetPod added in v0.25.0

func (c *Cluster) GetDaemonSetPod(daemonset *appsv1.DaemonSet) *v1.Pod

func (*Cluster) IsNodeNominated

func (c *Cluster) IsNodeNominated(name string) bool

IsNodeNominated returns true if the given node was expected to have a pod bound to it during a recent scheduling batch

func (*Cluster) MarkForDeletion

func (c *Cluster) MarkForDeletion(names ...string)

MarkForDeletion marks the node as pending deletion in the internal cluster state

func (*Cluster) Nodes added in v0.24.0

func (c *Cluster) Nodes() Nodes

Nodes creates a DeepCopy of all state nodes. NOTE: This is very inefficient so this should only be used when DeepCopying is absolutely necessary

func (*Cluster) NominateNodeForPod

func (c *Cluster) NominateNodeForPod(ctx context.Context, name string)

NominateNodeForPod records that a node was the target of a pending pod during a scheduling batch

func (*Cluster) Reset

func (c *Cluster) Reset()

Reset the cluster state for unit testing

func (*Cluster) SetConsolidated added in v0.24.0

func (c *Cluster) SetConsolidated(consolidated bool)

func (*Cluster) Synced added in v0.24.0

func (c *Cluster) Synced(ctx context.Context) bool

Synced validates that the Machines and the Nodes that are stored in the apiserver have the same representation in the cluster state. This is to ensure that our view of the cluster is as close to correct as it can be when we begin to perform operations utilizing the cluster state as our source of truth

func (*Cluster) UnmarkForDeletion

func (c *Cluster) UnmarkForDeletion(names ...string)

UnmarkForDeletion removes the marking on the node as a node the controller intends to delete

func (*Cluster) UpdateDaemonSet added in v0.25.0

func (c *Cluster) UpdateDaemonSet(ctx context.Context, daemonset *appsv1.DaemonSet) error

func (*Cluster) UpdateMachine added in v0.24.0

func (c *Cluster) UpdateMachine(machine *v1alpha5.Machine)

func (*Cluster) UpdateNode

func (c *Cluster) UpdateNode(ctx context.Context, node *v1.Node) error

func (*Cluster) UpdatePod

func (c *Cluster) UpdatePod(ctx context.Context, pod *v1.Pod) error

type Node

type Node struct {
	Node    *v1.Node
	Machine *v1alpha5.Machine
	// contains filtered or unexported fields
}

Node is a cached version of a node in the cluster that maintains state which is expensive to compute every time it's needed. This currently contains node utilization across all the allocatable resources, but will soon be used to compute topology information. +k8s:deepcopy-gen=true

func NewNode added in v0.24.0

func NewNode() *Node

func (*Node) Allocatable

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

func (*Node) Annotations added in v0.24.0

func (in *Node) Annotations() map[string]string

func (*Node) Available

func (in *Node) Available() v1.ResourceList

Available is allocatable minus anything allocated to pods.

func (*Node) Capacity

func (in *Node) Capacity() v1.ResourceList

func (*Node) DaemonSetLimits

func (in *Node) DaemonSetLimits() v1.ResourceList

func (*Node) DaemonSetRequests added in v0.22.0

func (in *Node) DaemonSetRequests() v1.ResourceList

func (*Node) DeepCopy

func (in *Node) DeepCopy() *Node

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Node.

func (*Node) DeepCopyInto

func (in *Node) DeepCopyInto(out *Node)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Node) HostName added in v0.24.0

func (in *Node) HostName() string

func (*Node) HostPortUsage

func (in *Node) HostPortUsage() *scheduling.HostPortUsage

func (*Node) Initialized added in v0.22.0

func (in *Node) Initialized() bool

Initialized always implies that the node is there. If something is initialized, we are guaranteed that the Node exists inside of cluster state. If the node is not initialized, it is possible that it is represented by a Node or by a Machine inside of cluster state

func (*Node) Labels added in v0.24.0

func (in *Node) Labels() map[string]string

func (*Node) MarkedForDeletion

func (in *Node) MarkedForDeletion() bool

func (*Node) Name added in v0.24.0

func (in *Node) Name() string

func (*Node) Nominate added in v0.22.0

func (in *Node) Nominate(ctx context.Context)

func (*Node) Nominated added in v0.22.0

func (in *Node) Nominated() bool

func (*Node) Owned added in v0.22.0

func (in *Node) Owned() bool

func (*Node) PodLimits added in v0.22.0

func (in *Node) PodLimits() v1.ResourceList

func (*Node) PodRequests added in v0.22.0

func (in *Node) PodRequests() v1.ResourceList

func (*Node) Pods added in v0.24.0

func (in *Node) Pods(ctx context.Context, c client.Client) ([]*v1.Pod, error)

Pods gets the pods assigned to the Node based on the kubernetes api-server bindings

func (*Node) Taints added in v0.22.0

func (in *Node) Taints() []v1.Taint

func (*Node) VolumeLimits

func (in *Node) VolumeLimits() scheduling.VolumeCount

func (*Node) VolumeUsage

func (in *Node) VolumeUsage() *scheduling.VolumeUsage

type Nodes added in v0.24.0

type Nodes []*Node

Nodes is a typed version of a list of *Node

func (Nodes) Active added in v0.24.0

func (n Nodes) Active() Nodes

Active filters nodes that are not in a MarkedForDeletion state

func (Nodes) Deleting added in v0.24.0

func (n Nodes) Deleting() Nodes

Deleting filters nodes that are in a MarkedForDeletion state

func (Nodes) Pods added in v0.24.0

func (n Nodes) Pods(ctx context.Context, c client.Client) ([]*v1.Pod, error)

Pods gets the pods assigned to all Nodes based on the kubernetes api-server bindings

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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