Documentation
¶
Index ¶
- func CreateMergePatch(original, new interface{}) ([]byte, error)
- func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)
- func GetPodConditionFromList(conditions []v1.PodCondition, conditionType v1.PodConditionType) (int, *v1.PodCondition)
- func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition
- func IsPodReady(pod *v1.Pod) bool
- func IsPodReadyConditionTrue(status v1.PodStatus) bool
- func NewDefaultGPARateLimiter(interval time.Duration) workqueue.RateLimiter
- func NewFixedItemIntervalRateLimiter(interval time.Duration) workqueue.RateLimiter
- type FixedItemIntervalRateLimiter
- type GeneralController
- type NormalizationArg
- type ReplicaCalculator
- func (c *ReplicaCalculator) GetExternalMetricReplicas(currentReplicas int32, targetUtilization int64, metricName, namespace string, ...) (replicaCount int32, utilization int64, timestamp time.Time, err error)
- func (c *ReplicaCalculator) GetExternalPerPodMetricReplicas(statusReplicas int32, targetUtilizationPerPod int64, ...) (replicaCount int32, utilization int64, timestamp time.Time, err error)
- 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) GetObjectPerPodMetricReplicas(statusReplicas int32, targetAverageUtilization 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 CreateMergePatch ¶
CreateMergePatch return patch generated from original and new interfaces
func GetPodCondition ¶
func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)
GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetPodConditionFromList ¶
func GetPodConditionFromList(conditions []v1.PodCondition, conditionType v1.PodConditionType) (int, *v1.PodCondition)
GetPodConditionFromList extracts the provided condition from the given list of condition and returns the index of the condition and the condition. Returns -1 and nil if the condition is not present.
func GetPodReadyCondition ¶
func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition
GetPodReadyCondition extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.
func IsPodReady ¶
IsPodReady returns true if a pod is ready; false otherwise.
func IsPodReadyConditionTrue ¶
IsPodReadyConditionTrue returns true if a pod is ready; false otherwise.
func NewDefaultGPARateLimiter ¶
func NewDefaultGPARateLimiter(interval time.Duration) workqueue.RateLimiter
NewDefaultGPARateLimiter creates a rate limiter 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
NewFixedItemIntervalRateLimiter creates a new instance of a RateLimiter using a fixed interval
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{})
Forget indicates that an item is finished being retried.
func (*FixedItemIntervalRateLimiter) NumRequeues ¶
func (r *FixedItemIntervalRateLimiter) NumRequeues(item interface{}) int
NumRequeues returns back how many failures the item has had
func (*FixedItemIntervalRateLimiter) When ¶
func (r *FixedItemIntervalRateLimiter) When(item interface{}) time.Duration
When returns the interval of the rate limiter
type GeneralController ¶
type GeneralController struct {
// contains filtered or unexported fields
}
GeneralController is responsible for the synchronizing GPA objects stored in the system with the actual deployments/replication controllers they control.
func NewGeneralController ¶
func NewGeneralController( evtNamespacer v1core.EventsGetter, scaleNamespacer scaleclient.ScalesGetter, gpaNamespacer autoscalingclient.GeneralPodAutoscalersGetter, mapper apimeta.RESTMapper, metricsClient metricsclient.MetricsClient, gpaInformer autoscalinginformers.GeneralPodAutoscalerInformer, podInformer coreinformers.PodInformer, resyncPeriod time.Duration, downscaleStabilisationWindow time.Duration, tolerance float64, cpuInitializationPeriod, delayOfInitialReadinessStatus time.Duration, ) *GeneralController
NewGeneralController creates a new GeneralController.
func (*GeneralController) Run ¶
func (a *GeneralController) Run(stopCh <-chan struct{})
Run begins watching and syncing.
type NormalizationArg ¶
type NormalizationArg struct { Key string ScaleUpBehavior *autoscaling.GPAScalingRules ScaleDownBehavior *autoscaling.GPAScalingRules MinReplicas int32 MaxReplicas int32 CurrentReplicas int32 DesiredReplicas int32 }
NormalizationArg is used to pass all needed information between functions as one structure
type ReplicaCalculator ¶
type ReplicaCalculator struct {
// contains filtered or unexported fields
}
ReplicaCalculator bundles all needed information to calculate the target amount of replicas
func NewReplicaCalculator ¶
func NewReplicaCalculator(metricsClient metricsclient.MetricsClient, podLister corelisters.PodLister, tolerance float64, cpuInitializationPeriod, delayOfInitialReadinessStatus time.Duration) *ReplicaCalculator
NewReplicaCalculator creates a new ReplicaCalculator and passes all necessary information to the new instance
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(statusReplicas 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, metricSelector 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, metricSelector 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) GetObjectPerPodMetricReplicas ¶
func (c *ReplicaCalculator) GetObjectPerPodMetricReplicas(statusReplicas int32, targetAverageUtilization int64, metricName string, namespace string, objectRef *autoscaling.CrossVersionObjectReference, metricSelector labels.Selector) (replicaCount int32, utilization int64, timestamp time.Time, err error)
GetObjectPerPodMetricReplicas 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, container string) (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, container string, computeResourceUtilizationRatioByLimits bool) (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