state

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 18 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(ctx context.Context, client client.Client, cp cloudprovider.CloudProvider) *Cluster

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.

type HostPortUsage added in v0.11.0

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

HostPortUsage tracks HostPort usage within a node. On a node, each <hostIP, hostPort, protocol> used by pods bound to the node must be unique. We need to track this to keep an accurate concept of what pods can potentially schedule together.

func NewHostPortUsage added in v0.11.0

func NewHostPortUsage() *HostPortUsage

func (*HostPortUsage) Add added in v0.11.0

func (u *HostPortUsage) Add(pod *v1.Pod) error

Add adds a port to the HostPortUsage, returning an error in the case of a conflict

func (*HostPortUsage) Copy added in v0.11.0

func (u *HostPortUsage) Copy() *HostPortUsage

Copy creates a copy of the HostPortUsage. It's not a deep copy as some of the internal state is reused, but that state is read-only so changes made to the copy or the original don't affect each other.

func (*HostPortUsage) DeletePod added in v0.11.0

func (u *HostPortUsage) DeletePod(key types.NamespacedName)

DeletePod deletes all host port usage from the HostPortUsage that were created by the pod with the given name.

type Node

type Node struct {
	Node *v1.Node
	// Capacity is the total amount of resources on the node.  The available resources are the capacity minus overhead
	// minus anything allocated to pods.
	Capacity v1.ResourceList
	// Available is the total amount of resources that are available on the node.  This is the Allocatable minus the
	// resources requested by all pods bound to the node.
	Available v1.ResourceList
	// DaemonSetRequested is the total amount of resources that have been requested by daemon sets.  This allows users
	// of the Node to identify the remaining resources that we expect future daemonsets to consume.  This is already
	// included in the calculation for Available.
	DaemonSetRequested v1.ResourceList
	// HostPort usage of all pods that are bound to the node
	HostPortUsage *HostPortUsage
	// Provisioner is the provisioner used to create the node.
	Provisioner *v1alpha5.Provisioner

	InstanceType cloudprovider.InstanceType
	// 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.

type NodeController

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

NodeController reconciles nodes for the purpose of maintaining state regarding nodes that is expensive to compute.

func NewNodeController

func NewNodeController(kubeClient client.Client, cluster *Cluster) *NodeController

NewNodeController constructs a controller instance

func (*NodeController) Reconcile

func (*NodeController) Register

func (c *NodeController) Register(ctx context.Context, m manager.Manager) error

type PodController

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

PodController reconciles pods for the purpose of maintaining state regarding pods that is expensive to compute.

func NewPodController

func NewPodController(kubeClient client.Client, cluster *Cluster) *PodController

func (*PodController) Reconcile

func (c *PodController) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)

func (*PodController) Register

func (c *PodController) Register(ctx context.Context, m manager.Manager) error

Jump to

Keyboard shortcuts

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