Documentation ¶
Overview ¶
Package podautoscaler contains logic for autoscaling number of pods based on metrics observed.
Index ¶
- func NewDefaultHPARateLimiter(interval time.Duration) workqueue.RateLimiter
- func NewFixedItemIntervalRateLimiter(interval time.Duration) workqueue.RateLimiter
- func UnsafeConvertToVersionVia(obj runtime.Object, externalVersion schema.GroupVersion) (runtime.Object, error)
- type FixedItemIntervalRateLimiter
- type HorizontalController
- type ReplicaCalculator
- func (c *ReplicaCalculator) GetMetricReplicas(currentReplicas int32, targetUtilization int64, metricName string, ...) (replicaCount int32, utilization int64, timestamp time.Time, err error)
- func (c *ReplicaCalculator) GetObjectMetricReplicas(currentReplicas int32, targetUtilization int64, metricName string, ...) (replicaCount int32, utilization int64, timestamp time.Time, err error)
- func (c *ReplicaCalculator) GetRawResourceReplicas(currentReplicas int32, targetUtilization int64, resource v1.ResourceName, ...) (replicaCount int32, utilization int64, timestamp time.Time, err error)
- func (c *ReplicaCalculator) GetResourceReplicas(currentReplicas int32, targetUtilization int32, resource v1.ResourceName, ...) (replicaCount int32, utilization int32, rawUtilization int64, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDefaultHPARateLimiter ¶
func NewDefaultHPARateLimiter(interval time.Duration) workqueue.RateLimiter
NewDefaultHPARateLimitter creates a rate limitter which limits overall (as per the default controller rate limiter), as well as per the resync interval
func NewFixedItemIntervalRateLimiter ¶
func NewFixedItemIntervalRateLimiter(interval time.Duration) workqueue.RateLimiter
func UnsafeConvertToVersionVia ¶
func UnsafeConvertToVersionVia(obj runtime.Object, externalVersion schema.GroupVersion) (runtime.Object, error)
UnsafeConvertToVersionVia is like api.Scheme.UnsafeConvertToVersion, but it does so via an internal version first. We use it since working with v2alpha1 is convenient here, but we want to use the v1 client (and can't just use the internal version). Note that conversion mutates the object, so you need to deepcopy *before* you call this if the input object came out of a shared cache.
Types ¶
type FixedItemIntervalRateLimiter ¶
type FixedItemIntervalRateLimiter struct {
// contains filtered or unexported fields
}
FixedItemIntervalRateLimiter limits items to a fixed-rate interval
func (*FixedItemIntervalRateLimiter) Forget ¶
func (r *FixedItemIntervalRateLimiter) Forget(item interface{})
func (*FixedItemIntervalRateLimiter) NumRequeues ¶
func (r *FixedItemIntervalRateLimiter) NumRequeues(item interface{}) int
func (*FixedItemIntervalRateLimiter) When ¶
func (r *FixedItemIntervalRateLimiter) When(item interface{}) time.Duration
type HorizontalController ¶
type HorizontalController struct {
// contains filtered or unexported fields
}
func NewHorizontalController ¶
func NewHorizontalController( evtNamespacer v1core.EventsGetter, scaleNamespacer extensionsclient.ScalesGetter, hpaNamespacer autoscalingclient.HorizontalPodAutoscalersGetter, replicaCalc *ReplicaCalculator, hpaInformer autoscalinginformers.HorizontalPodAutoscalerInformer, resyncPeriod time.Duration, upscaleForbiddenWindow time.Duration, downscaleForbiddenWindow time.Duration, ) *HorizontalController
func (*HorizontalController) Run ¶
func (a *HorizontalController) Run(stopCh <-chan struct{})
type ReplicaCalculator ¶
type ReplicaCalculator struct {
// contains filtered or unexported fields
}
func NewReplicaCalculator ¶
func NewReplicaCalculator(metricsClient metricsclient.MetricsClient, podsGetter v1coreclient.PodsGetter) *ReplicaCalculator
func (*ReplicaCalculator) GetMetricReplicas ¶
func (c *ReplicaCalculator) GetMetricReplicas(currentReplicas int32, targetUtilization int64, metricName string, namespace string, selector labels.Selector) (replicaCount int32, utilization int64, timestamp time.Time, err error)
GetMetricReplicas calculates the desired replica count based on a target metric utilization (as a milli-value) for pods matching the given selector in the given namespace, and the current replica count
func (*ReplicaCalculator) GetObjectMetricReplicas ¶
func (c *ReplicaCalculator) GetObjectMetricReplicas(currentReplicas int32, targetUtilization int64, metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference) (replicaCount int32, utilization int64, timestamp time.Time, err error)
GetObjectMetricReplicas calculates the desired replica count based on a target metric utilization (as a milli-value) for the given object in the given namespace, and the current replica count.
func (*ReplicaCalculator) GetRawResourceReplicas ¶
func (c *ReplicaCalculator) GetRawResourceReplicas(currentReplicas int32, targetUtilization int64, resource v1.ResourceName, namespace string, selector labels.Selector) (replicaCount int32, utilization int64, timestamp time.Time, err error)
GetRawResourceReplicas calculates the desired replica count based on a target resource utilization (as a raw milli-value) for pods matching the given selector in the given namespace, and the current replica count
func (*ReplicaCalculator) GetResourceReplicas ¶
func (c *ReplicaCalculator) GetResourceReplicas(currentReplicas int32, targetUtilization int32, resource v1.ResourceName, namespace string, selector labels.Selector) (replicaCount int32, utilization int32, rawUtilization int64, timestamp time.Time, err error)
GetResourceReplicas calculates the desired replica count based on a target resource utilization percentage of the given resource for pods matching the given selector in the given namespace, and the current replica count