podautoscaler

package
v0.0.0-...-db5eef7 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

Package podautoscaler contains logic for autoscaling number of pods based on metrics observed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultHPARateLimiter

func NewDefaultHPARateLimiter(interval time.Duration) workqueue.RateLimiter

NewDefaultHPARateLimiter 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

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
}

HorizontalController is responsible for the synchronizing HPA objects stored in the system with the actual deployments/replication controllers they control.

func NewHorizontalController

func NewHorizontalController(
	evtNamespacer v1core.EventsGetter,
	scaleNamespacer scaleclient.ScalesGetter,
	hpaNamespacer autoscalingclient.HorizontalPodAutoscalersGetter,
	mapper apimeta.RESTMapper,
	replicaCalc *ReplicaCalculator,
	hpaInformer autoscalinginformers.HorizontalPodAutoscalerInformer,
	resyncPeriod time.Duration,
	upscaleForbiddenWindow time.Duration,
	downscaleForbiddenWindow time.Duration,

) *HorizontalController

NewHorizontalController creates a new HorizontalController.

func (*HorizontalController) Run

func (a *HorizontalController) Run(stopCh <-chan struct{})

Run begins watching and syncing.

type ReplicaCalculator

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

func NewReplicaCalculator

func NewReplicaCalculator(metricsClient metricsclient.MetricsClient, podsGetter v1coreclient.PodsGetter, tolerance float64) *ReplicaCalculator

func (*ReplicaCalculator) GetExternalMetricReplicas

func (c *ReplicaCalculator) GetExternalMetricReplicas(currentReplicas int32, targetUtilization int64, metricName, namespace string, metricSelector *metav1.LabelSelector, podSelector labels.Selector) (replicaCount int32, utilization int64, timestamp time.Time, err error)

GetExternalMetricReplicas calculates the desired replica count based on a target metric value (as a milli-value) for the external metric in the given namespace, and the current replica count.

func (*ReplicaCalculator) GetExternalPerPodMetricReplicas

func (c *ReplicaCalculator) GetExternalPerPodMetricReplicas(currentReplicas int32, targetUtilizationPerPod int64, metricName, namespace string, metricSelector *metav1.LabelSelector) (replicaCount int32, utilization int64, timestamp time.Time, err error)

GetExternalPerPodMetricReplicas calculates the desired replica count based on a target metric value per pod (as a milli-value) for the external metric in the given namespace, and the current replica count.

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, selector labels.Selector) (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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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