Documentation ¶
Overview ¶
Package trackers feature implementations that help track specific stats about Kubernetes resources, e.g., nodes and pods in the AKS property provider.
Index ¶
- Constants
- type AKSKarpenterPricingClient
- type NodeSet
- type NodeTracker
- func (nt *NodeTracker) AddOrUpdate(node *corev1.Node)
- func (nt *NodeTracker) Costs() (perCPUCoreCost, perGBMemoryCost float64, err error)
- func (nt *NodeTracker) NodeCount() int
- func (nt *NodeTracker) Remove(nodeName string)
- func (nt *NodeTracker) TotalAllocatable() corev1.ResourceList
- func (nt *NodeTracker) TotalAllocatableFor(rn corev1.ResourceName) resource.Quantity
- func (nt *NodeTracker) TotalCapacity() corev1.ResourceList
- func (nt *NodeTracker) TotalCapacityFor(rn corev1.ResourceName) resource.Quantity
- type PodTracker
- type PricingProvider
Constants ¶
const ( // AKSClusterNodeSKULabelName is the node label added by AKS, which indicated the SKU // of the node. AKSClusterNodeSKULabelName = "beta.kubernetes.io/instance-type" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AKSKarpenterPricingClient ¶
type AKSKarpenterPricingClient struct {
// contains filtered or unexported fields
}
AKSKarpenterPricingClient is a thin wrapper around the AKS Karpenter pricing client, which implements the PricingProvider interface.
func NewAKSKarpenterPricingClient ¶
func NewAKSKarpenterPricingClient(ctx context.Context, region string) *AKSKarpenterPricingClient
NewAKSKarpenterPricingClient returns a new AKS Karpenter pricing client, which implements the PricingProvider interface.
func (*AKSKarpenterPricingClient) LastUpdated ¶
func (k *AKSKarpenterPricingClient) LastUpdated() time.Time
LastUpdated returns the last time the pricing information was updated.
func (*AKSKarpenterPricingClient) OnDemandPrice ¶
func (k *AKSKarpenterPricingClient) OnDemandPrice(instanceType string) (float64, bool)
OnDemandPrice returns the on-demand price of an instance type.
type NodeTracker ¶
type NodeTracker struct {
// contains filtered or unexported fields
}
NodeTracker helps track specific stats about nodes in a Kubernetes cluster, e.g., its count.
func NewNodeTracker ¶
func NewNodeTracker(pp PricingProvider) *NodeTracker
NewNodeTracker returns a node tracker.
func (*NodeTracker) AddOrUpdate ¶
func (nt *NodeTracker) AddOrUpdate(node *corev1.Node)
AddOrUpdate starts tracking a node or updates the stats about a node that has been tracked.
func (*NodeTracker) Costs ¶
func (nt *NodeTracker) Costs() (perCPUCoreCost, perGBMemoryCost float64, err error)
Costs returns the per CPU core and per GB memory costs in the cluster.
func (*NodeTracker) NodeCount ¶
func (nt *NodeTracker) NodeCount() int
NodeCount returns the node count stat that a node tracker tracks.
func (*NodeTracker) Remove ¶
func (nt *NodeTracker) Remove(nodeName string)
Remove stops tracking a node.
func (*NodeTracker) TotalAllocatable ¶
func (nt *NodeTracker) TotalAllocatable() corev1.ResourceList
TotalAllocatable returns the total allocatable capacity of all resources that the node tracker tracks.
func (*NodeTracker) TotalAllocatableFor ¶
func (nt *NodeTracker) TotalAllocatableFor(rn corev1.ResourceName) resource.Quantity
TotalAllocatableFor returns the total allocatable capacity of a specific resource that the node tracker tracks.
func (*NodeTracker) TotalCapacity ¶
func (nt *NodeTracker) TotalCapacity() corev1.ResourceList
TotalCapacity returns the total capacity of all resources that the node tracker tracks.
func (*NodeTracker) TotalCapacityFor ¶
func (nt *NodeTracker) TotalCapacityFor(rn corev1.ResourceName) resource.Quantity
TotalCapacityFor returns the total capacity of a specific resource that the node tracker tracks.
type PodTracker ¶
type PodTracker struct {
// contains filtered or unexported fields
}
PodTracker helps track specific stats about pods in a Kubernetes cluster, e.g., the sum of its requested resources.
func (*PodTracker) AddOrUpdate ¶
func (pt *PodTracker) AddOrUpdate(pod *corev1.Pod)
AddOrUpdate starts tracking a pod or updates the stats about a pod that has been tracked.
func (*PodTracker) Remove ¶
func (pt *PodTracker) Remove(podIdentifier string)
Remove stops tracking a pod.
func (*PodTracker) TotalRequested ¶
func (pt *PodTracker) TotalRequested() corev1.ResourceList
TotalRequested returns the total requested resources of all resources that the pod tracker tracks.
func (*PodTracker) TotalRequestedFor ¶
func (pt *PodTracker) TotalRequestedFor(rn corev1.ResourceName) resource.Quantity
TotalRequestedFor returns the total requested resources of a specific resource that the pod tracker tracks.
type PricingProvider ¶
type PricingProvider interface { OnDemandPrice(instanceType string) (float64, bool) LastUpdated() time.Time }
PricingProvider is an interface that the AKS property provider uses to sync pricing information.
It helps decouple the AKS property provider from the actual pricing provider implementation; even though at this moment the property provider leverages the AKS Karpenter pricing client only.