Documentation
¶
Index ¶
- type Cluster
- func (c *Cluster) ConsolidationState() time.Time
- func (c *Cluster) DeleteDaemonSet(key types.NamespacedName)
- func (c *Cluster) DeleteNode(name string)
- func (c *Cluster) DeleteNodeClaim(key nodeclaimutil.Key)
- func (c *Cluster) DeletePod(podKey types.NamespacedName)
- func (c *Cluster) ForEachNode(f func(n *StateNode) bool)
- func (c *Cluster) ForPodsWithAntiAffinity(fn func(p *v1.Pod, n *v1.Node) bool)
- func (c *Cluster) GetDaemonSetPod(daemonset *appsv1.DaemonSet) *v1.Pod
- func (c *Cluster) IsNodeNominated(providerID string) bool
- func (c *Cluster) MarkForDeletion(providerIDs ...string)
- func (c *Cluster) MarkUnconsolidated() time.Time
- func (c *Cluster) Nodes() StateNodes
- func (c *Cluster) NominateNodeForPod(ctx context.Context, providerID string)
- func (c *Cluster) Reset()
- func (c *Cluster) Synced(ctx context.Context) bool
- func (c *Cluster) UnmarkForDeletion(providerIDs ...string)
- func (c *Cluster) UpdateDaemonSet(ctx context.Context, daemonset *appsv1.DaemonSet) error
- func (c *Cluster) UpdateNode(ctx context.Context, node *v1.Node) error
- func (c *Cluster) UpdateNodeClaim(nodeClaim *v1beta1.NodeClaim)
- func (c *Cluster) UpdatePod(ctx context.Context, pod *v1.Pod) error
- type StateNode
- func (in *StateNode) Allocatable() v1.ResourceList
- func (in *StateNode) Annotations() map[string]string
- func (in *StateNode) Available() v1.ResourceList
- func (in *StateNode) Capacity() v1.ResourceList
- func (in *StateNode) DaemonSetLimits() v1.ResourceList
- func (in *StateNode) DaemonSetRequests() v1.ResourceList
- func (in *StateNode) DeepCopy() *StateNode
- func (in *StateNode) DeepCopyInto(out *StateNode)
- func (in *StateNode) GetLabels() map[string]string
- func (in *StateNode) HostName() string
- func (in *StateNode) HostPortUsage() *scheduling.HostPortUsage
- func (in *StateNode) Initialized() bool
- func (in *StateNode) Labels() map[string]string
- func (in *StateNode) Managed() bool
- func (in *StateNode) MarkedForDeletion() bool
- func (in *StateNode) Name() string
- func (in *StateNode) Nominate(ctx context.Context)
- func (in *StateNode) Nominated() bool
- func (in *StateNode) OwnerKey() nodepoolutil.Key
- func (in *StateNode) PodLimits() v1.ResourceList
- func (in *StateNode) PodRequests() v1.ResourceList
- func (in *StateNode) Pods(ctx context.Context, c client.Client) ([]*v1.Pod, error)
- func (in *StateNode) ProviderID() string
- func (in *StateNode) Registered() bool
- func (in *StateNode) Taints() []v1.Taint
- func (in *StateNode) VolumeUsage() *scheduling.VolumeUsage
- type StateNodes
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) ConsolidationState ¶ added in v0.30.0
ConsolidationState returns a timestamp of the last time that the cluster state with respect to consolidation changed. If nothing changes, this timestamp resets after five minutes to force watchers that use this to defer work to occasionally revalidate that nothing external (e.g. an instance type becoming available) has changed that now makes it possible for them to operate. Time was chosen as the type here as it allows comparisons using the built-in monotonic clock.
func (*Cluster) DeleteDaemonSet ¶ added in v0.25.0
func (c *Cluster) DeleteDaemonSet(key types.NamespacedName)
func (*Cluster) DeleteNode ¶
func (*Cluster) DeleteNodeClaim ¶ added in v0.30.0
func (c *Cluster) DeleteNodeClaim(key nodeclaimutil.Key)
func (*Cluster) DeletePod ¶
func (c *Cluster) DeletePod(podKey types.NamespacedName)
func (*Cluster) ForEachNode ¶
ForEachNode calls the supplied function once per node object that is being tracked. It is not safe to store the state.StateNode object, it should be only accessed from within the function provided to this method.
func (*Cluster) ForPodsWithAntiAffinity ¶
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 (*Cluster) IsNodeNominated ¶
IsNodeNominated returns true if the given node was expected to have a pod bound to it during a recent scheduling batch
func (*Cluster) MarkForDeletion ¶
MarkForDeletion marks the node as pending deletion in the internal cluster state
func (*Cluster) MarkUnconsolidated ¶ added in v0.30.0
MarkUnconsolidated marks the cluster state as being unconsolidated. This should be called in any situation where something in the cluster has changed such that the cluster may have moved from a non-consolidatable to a consolidatable state.
func (*Cluster) Nodes ¶ added in v0.24.0
func (c *Cluster) Nodes() StateNodes
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 ¶
NominateNodeForPod records that a node was the target of a pending pod during a scheduling batch
func (*Cluster) Synced ¶ added in v0.24.0
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 ¶
UnmarkForDeletion removes the marking on the node as a node the controller intends to delete
func (*Cluster) UpdateDaemonSet ¶ added in v0.25.0
func (*Cluster) UpdateNodeClaim ¶ added in v0.30.0
type StateNode ¶ added in v0.27.1
type StateNode struct { Node *v1.Node NodeClaim *v1beta1.NodeClaim // contains filtered or unexported fields }
StateNode 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 nolint: revive
func (*StateNode) Allocatable ¶ added in v0.27.1
func (in *StateNode) Allocatable() v1.ResourceList
func (*StateNode) Annotations ¶ added in v0.27.1
func (*StateNode) Available ¶ added in v0.27.1
func (in *StateNode) Available() v1.ResourceList
Available is allocatable minus anything allocated to pods.
func (*StateNode) Capacity ¶ added in v0.27.1
func (in *StateNode) Capacity() v1.ResourceList
func (*StateNode) DaemonSetLimits ¶ added in v0.27.1
func (in *StateNode) DaemonSetLimits() v1.ResourceList
func (*StateNode) DaemonSetRequests ¶ added in v0.27.1
func (in *StateNode) DaemonSetRequests() v1.ResourceList
func (*StateNode) DeepCopy ¶ added in v0.27.1
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StateNode.
func (*StateNode) DeepCopyInto ¶ added in v0.27.1
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*StateNode) GetLabels ¶ added in v0.30.0
GetLabels exists to conform to the GetLabels() function on the metav1.Object interface
func (*StateNode) HostPortUsage ¶ added in v0.27.1
func (in *StateNode) HostPortUsage() *scheduling.HostPortUsage
func (*StateNode) Initialized ¶ added in v0.27.1
func (*StateNode) MarkedForDeletion ¶ added in v0.27.1
func (*StateNode) OwnerKey ¶ added in v0.30.0
func (in *StateNode) OwnerKey() nodepoolutil.Key
func (*StateNode) PodLimits ¶ added in v0.27.1
func (in *StateNode) PodLimits() v1.ResourceList
func (*StateNode) PodRequests ¶ added in v0.27.1
func (in *StateNode) PodRequests() v1.ResourceList
func (*StateNode) Pods ¶ added in v0.27.1
Pods gets the pods assigned to the Node based on the kubernetes api-server bindings
func (*StateNode) ProviderID ¶ added in v0.30.0
ProviderID is the key that is used to map this StateNode If the Node and NodeClaim have a providerID, this should map to a real providerID If the Node does not have a providerID, this will map to the node name
func (*StateNode) Registered ¶ added in v0.29.1
func (*StateNode) VolumeUsage ¶ added in v0.27.1
func (in *StateNode) VolumeUsage() *scheduling.VolumeUsage
type StateNodes ¶ added in v0.27.1
type StateNodes []*StateNode
StateNodes is a typed version of a list of *Node nolint: revive
func (StateNodes) Active ¶ added in v0.27.1
func (n StateNodes) Active() StateNodes
Active filters StateNodes that are not in a MarkedForDeletion state
func (StateNodes) Deleting ¶ added in v0.27.1
func (n StateNodes) Deleting() StateNodes
Deleting filters StateNodes that are in a MarkedForDeletion state