Documentation
¶
Overview ¶
Package capacity implements a tracker for node resource capacity.
Index ¶
- Constants
- func AddTaint(node *corev1.Node) bool
- func CmpThreshold(cap Tracker, name corev1.ResourceName, requested resource.Quantity) int
- func HasTaint(node *corev1.Node) (bool, time.Time)
- func RemoveTaint(node *corev1.Node)
- type NodeTracker
- func (c *NodeTracker) Capacity(name corev1.ResourceName) resource.Quantity
- func (c *NodeTracker) IncEvicted()
- func (c *NodeTracker) Requested(name corev1.ResourceName) resource.Quantity
- func (c *NodeTracker) SetCapacity(name corev1.ResourceName, q resource.Quantity)
- func (c *NodeTracker) SetRequested(name corev1.ResourceName, q resource.Quantity)
- func (c *NodeTracker) Threshold() float64
- func (c *NodeTracker) UseCheckpointMemory() bool
- type NoopTracker
- func (n *NoopTracker) Capacity(name corev1.ResourceName) resource.Quantity
- func (n *NoopTracker) IncEvicted()
- func (n *NoopTracker) Requested(name corev1.ResourceName) resource.Quantity
- func (n *NoopTracker) SetCapacity(name corev1.ResourceName, q resource.Quantity)
- func (n *NoopTracker) SetRequested(name corev1.ResourceName, q resource.Quantity)
- func (n *NoopTracker) Threshold() float64
- func (n *NoopTracker) UseCheckpointMemory() bool
- type SystemMemoryTracker
- func (m *SystemMemoryTracker) Capacity(name corev1.ResourceName) resource.Quantity
- func (m *SystemMemoryTracker) Requested(name corev1.ResourceName) resource.Quantity
- func (m *SystemMemoryTracker) SetCapacity(name corev1.ResourceName, q resource.Quantity)
- func (m *SystemMemoryTracker) SetRequested(name corev1.ResourceName, q resource.Quantity)
- func (m *SystemMemoryTracker) UseCheckpointMemory() bool
- type Tracker
Constants ¶
const ( TaintKey = "zeropod.ctrox.dev/at-capacity" MinTaintDuration = time.Minute MetricNodeCapacity = "node_capacity" MetricNodeRequested = "node_requested" MetricNodeEvictions = "node_evictions" )
Variables ¶
This section is empty.
Functions ¶
func CmpThreshold ¶
CmpThreshold returns 0 if requested is equal to capacity, -1 if the requested is less than capacity, or 1 if the requested is greater than capacity. Note that capacity will be multiplied by the Tracker threshold.
Types ¶
type NodeTracker ¶
type NodeTracker struct {
// contains filtered or unexported fields
}
func (*NodeTracker) Capacity ¶
func (c *NodeTracker) Capacity(name corev1.ResourceName) resource.Quantity
Capacity returns the node capacity for the corev1.ResourceName.
func (*NodeTracker) IncEvicted ¶
func (c *NodeTracker) IncEvicted()
func (*NodeTracker) Requested ¶
func (c *NodeTracker) Requested(name corev1.ResourceName) resource.Quantity
Requested returns the node requested resources for the corev1.ResourceName.
func (*NodeTracker) SetCapacity ¶
func (c *NodeTracker) SetCapacity(name corev1.ResourceName, q resource.Quantity)
SetCapacity sets the resource capacity of a node.
func (*NodeTracker) SetRequested ¶
func (c *NodeTracker) SetRequested(name corev1.ResourceName, q resource.Quantity)
SetRequested sets the requested resources of a node.
func (*NodeTracker) Threshold ¶
func (c *NodeTracker) Threshold() float64
Threshold where capacity eviction starts.
func (*NodeTracker) UseCheckpointMemory ¶
func (c *NodeTracker) UseCheckpointMemory() bool
type NoopTracker ¶
type NoopTracker struct{}
NoopTracker implements a capacity tracker that does nothing.
func (*NoopTracker) Capacity ¶
func (n *NoopTracker) Capacity(name corev1.ResourceName) resource.Quantity
Capacity implements Tracker.
func (*NoopTracker) Requested ¶
func (n *NoopTracker) Requested(name corev1.ResourceName) resource.Quantity
Requested implements Tracker.
func (*NoopTracker) SetCapacity ¶
func (n *NoopTracker) SetCapacity(name corev1.ResourceName, q resource.Quantity)
SetCapacity implements Tracker.
func (*NoopTracker) SetRequested ¶
func (n *NoopTracker) SetRequested(name corev1.ResourceName, q resource.Quantity)
SetRequested implements Tracker.
func (*NoopTracker) Threshold ¶
func (n *NoopTracker) Threshold() float64
Threshold implements Tracker.
func (*NoopTracker) UseCheckpointMemory ¶
func (n *NoopTracker) UseCheckpointMemory() bool
UseCheckpointMemory implements Tracker.
type SystemMemoryTracker ¶
type SystemMemoryTracker struct {
Tracker
}
func (*SystemMemoryTracker) Capacity ¶
func (m *SystemMemoryTracker) Capacity(name corev1.ResourceName) resource.Quantity
Capacity gets the memory capacity from the total node memory.
func (*SystemMemoryTracker) Requested ¶
func (m *SystemMemoryTracker) Requested(name corev1.ResourceName) resource.Quantity
Requested gets memory requests from the current available system memory.
func (*SystemMemoryTracker) SetCapacity ¶
func (m *SystemMemoryTracker) SetCapacity(name corev1.ResourceName, q resource.Quantity)
SetCapacity sets the memory capacity to the total node memory.
func (*SystemMemoryTracker) SetRequested ¶
func (m *SystemMemoryTracker) SetRequested(name corev1.ResourceName, q resource.Quantity)
SetRequested sets memory requests to the current available system memory.
func (*SystemMemoryTracker) UseCheckpointMemory ¶
func (m *SystemMemoryTracker) UseCheckpointMemory() bool
type Tracker ¶
type Tracker interface {
Capacity(name corev1.ResourceName) resource.Quantity
Requested(name corev1.ResourceName) resource.Quantity
SetCapacity(name corev1.ResourceName, q resource.Quantity)
SetRequested(name corev1.ResourceName, q resource.Quantity)
Threshold() float64
IncEvicted()
UseCheckpointMemory() bool
}
func NewNodeTracker ¶
func NewNodeTracker(reg prometheus.Registerer, name string, threshold float64) Tracker
NewNodeTracker creates a NodeTracker.
func NewSystemMemoryTracker ¶
func NewSystemMemoryTracker(reg prometheus.Registerer, name string, threshold float64) Tracker
NewSystemMemoryTracker creates a SystemMemoryTracker.