Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateResourceByPriority(resourceLists []corev1.ResourceList) corev1.ResourceList
- func CalculateResourceByValue(resourceByValue corev1.ResourceList, resourcesEstimated corev1.ResourceList)
- func GetContainerTargetResource(recommendation *vpatypes.RecommendedPodResources, containerName string) corev1.ResourceList
- func GetEstimatedResourceForContainer(evpa *autoscalingapi.EffectiveVerticalPodAutoscaler, ...) (corev1.ResourceList, []autoscalingapi.ResourceEstimatorStatus)
- func GetResourceUsedRatio(oldResource, newResource corev1.ResourceList, resourceName corev1.ResourceName) (int32, error)
- func GetScaleEventKey(namespace string, workload string, container string, direction string) string
- func IsResourceListEmpty(resourceList corev1.ResourceList) bool
- func ResourceWithTolerance(resource corev1.ResourceList, target corev1.ResourceList)
- func ResourceWithToleranceCpu(resource corev1.ResourceList, target corev1.ResourceList)
- func ResourceWithToleranceMemory(resource corev1.ResourceList, target corev1.ResourceList)
- func UpdateCurrentEstimatorStatus(estimator estimator.ResourceEstimatorInstance, containerName string, ...) []autoscalingapi.ResourceEstimatorStatus
- func UpdateRecommendStatus(recommendation *vpatypes.RecommendedPodResources, containerName string, ...)
- type EffectiveVPAController
- func (c *EffectiveVPAController) CheckContainerScalingCondition(evpa *autoscalingapi.EffectiveVerticalPodAutoscaler, ...) (bool, string)
- func (c *EffectiveVPAController) CleanLastScaleTime(evpa *autoscalingapi.EffectiveVerticalPodAutoscaler)
- func (c *EffectiveVPAController) DeleteLastScaleTime(namespace string, workload string, container string, direction string)
- func (c *EffectiveVPAController) GetLastScaleTime(namespace string, workload string, container string, direction string) metav1.Time
- func (c *EffectiveVPAController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (c *EffectiveVPAController) ReconcileContainerPolicies(evpa *autoscalingapi.EffectiveVerticalPodAutoscaler, ...) (currentEstimatorStatus []autoscalingapi.ResourceEstimatorStatus, ...)
- func (c *EffectiveVPAController) SetupWithManager(mgr ctrl.Manager) error
- func (c *EffectiveVPAController) UpdateStatus(ctx context.Context, evpa *autoscalingapi.EffectiveVerticalPodAutoscaler, ...)
- type ResourceEstimatorInstanceRanked
- type ScaleDirection
Constants ¶
const ( DefaultComponentScaleDownStabWindowSeconds = int32(43200) DefaultComponentScaleUpStabWindowSeconds = int32(150) // DefaultScaleDownCPUUtilPercentageThreshold defines the cpu scaledown threshold,, // If the ratio of actual used cpu resources divided by request resources is less than DefaultScaleDownCPUUtilPercentageThreshold, // it will trigger cpu scaledown. DefaultScaleDownCPUUtilPercentageThreshold = int32(35) // DefaultScaleUpCPUUtilPercentageThreshold defines the cpu scaleup threshold,, // If the ratio of actual used cpu resources divided by limit resources is greater than DefaultScaleUpCPUUtilPercentageThreshold, // it will trigger cpu scaleup. DefaultScaleUpCPUUtilPercentageThreshold = int32(95) // DefaultScaleDownMemoryUtilPercentageThreshold defines the memory scaledown threshold,, // If the ratio of actual used memory resources divided by request resources is less than DefaultScaleDownMemoryUtilPercentageThreshold, // it will trigger memory scaledown. DefaultScaleDownMemoryUtilPercentageThreshold = int32(40) // DefaultScaleUpMemoryUtilPercentageThreshold defines the memory scaleup threshold,, // If the ratio of actual used cpu resources divided by limit resources is greater than DefaultScaleUpCPUUtilPercentageThreshold, // it will trigger memory scaleup. DefaultScaleUpMemoryUtilPercentageThreshold = int32(95) // DefaultStabWindowSeconds defines the cold down seconds between two scaling for one container. DefaultStabWindowSeconds = int32(120) // DefaultCpuToleranceMilliCores defines the tolerance cpu change when scaling DefaultCpuToleranceMilliCores = 100 // DefaultMemoryToleranceMB defines the tolerance memory change when scaling DefaultMemoryToleranceMB = 100 * 1024 * 1024 // DefaultEVPARsyncPeriod defines the rsync period for EVPA controller DefaultEVPARsyncPeriod = time.Second * 60 )
const (
EffectiveVPAConditionTypeReady = "Ready"
)
Variables ¶
var (
DefaultControlledResources = []autoscalingapi.ResourceName{autoscalingapi.ResourceName("cpu"), autoscalingapi.ResourceName("memory")}
)
Functions ¶
func CalculateResourceByPriority ¶
func CalculateResourceByPriority(resourceLists []corev1.ResourceList) corev1.ResourceList
func CalculateResourceByValue ¶
func CalculateResourceByValue(resourceByValue corev1.ResourceList, resourcesEstimated corev1.ResourceList)
func GetContainerTargetResource ¶ added in v0.4.0
func GetContainerTargetResource(recommendation *vpatypes.RecommendedPodResources, containerName string) corev1.ResourceList
func GetEstimatedResourceForContainer ¶
func GetEstimatedResourceForContainer(evpa *autoscalingapi.EffectiveVerticalPodAutoscaler, containerPolicy autoscalingapi.ContainerResourcePolicy, containerResource *corev1.ResourceRequirements, rankedEstimators []ResourceEstimatorInstanceRanked, currentEstimatorStatus []autoscalingapi.ResourceEstimatorStatus) (corev1.ResourceList, []autoscalingapi.ResourceEstimatorStatus)
GetEstimatedResourceForContainer iterate resources based on the result from estimator If priority is equal, use the larger resource value If priority is larger, use the larger estimator's value if value is not Zero
func GetResourceUsedRatio ¶
func GetResourceUsedRatio(oldResource, newResource corev1.ResourceList, resourceName corev1.ResourceName) (int32, error)
GetResourceUsedRatio get Resource used ratio from oldResource and newResource
func GetScaleEventKey ¶
GetScaleEventKey concat information for scale event key
func IsResourceListEmpty ¶
func IsResourceListEmpty(resourceList corev1.ResourceList) bool
IsResourceListEmpty loop all resource quantities in resourceList, if all resources' quantity are zero, return true, otherwise return false.
func ResourceWithTolerance ¶ added in v0.4.0
func ResourceWithTolerance(resource corev1.ResourceList, target corev1.ResourceList)
func ResourceWithToleranceCpu ¶ added in v0.4.0
func ResourceWithToleranceCpu(resource corev1.ResourceList, target corev1.ResourceList)
ResourceWithToleranceCpu handle cpu resource with tolerance
func ResourceWithToleranceMemory ¶ added in v0.4.0
func ResourceWithToleranceMemory(resource corev1.ResourceList, target corev1.ResourceList)
ResourceWithToleranceMemory handle memory resource with tolerance
func UpdateCurrentEstimatorStatus ¶
func UpdateCurrentEstimatorStatus(estimator estimator.ResourceEstimatorInstance, containerName string, resourceList corev1.ResourceList, currentEstimatorStatus []autoscalingapi.ResourceEstimatorStatus) []autoscalingapi.ResourceEstimatorStatus
func UpdateRecommendStatus ¶
func UpdateRecommendStatus(recommendation *vpatypes.RecommendedPodResources, containerName string, recommendResource corev1.ResourceList)
UpdateRecommendStatus update recommend resource
Types ¶
type EffectiveVPAController ¶
type EffectiveVPAController struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder OOMRecorder oom.Recorder EstimatorManager estimator.ResourceEstimatorManager Predictor prediction.Interface TargetFetcher target.SelectorFetcher // contains filtered or unexported fields }
EffectiveVPAController is responsible for scaling workload's replica based on EffectiveVerticalPodAutoscaler spec
func (*EffectiveVPAController) CheckContainerScalingCondition ¶
func (c *EffectiveVPAController) CheckContainerScalingCondition(evpa *autoscalingapi.EffectiveVerticalPodAutoscaler, containerPolicy autoscalingapi.ContainerResourcePolicy, scalingPolicy *autoscalingapi.ContainerScalingPolicy, direction ScaleDirection, containerResource corev1.ResourceList, recommendContainerResource corev1.ResourceList) (bool, string)
CheckContainerScalingCondition check the conditions for container with scale direction
func (*EffectiveVPAController) CleanLastScaleTime ¶ added in v0.4.0
func (c *EffectiveVPAController) CleanLastScaleTime(evpa *autoscalingapi.EffectiveVerticalPodAutoscaler)
func (*EffectiveVPAController) DeleteLastScaleTime ¶ added in v0.4.0
func (c *EffectiveVPAController) DeleteLastScaleTime(namespace string, workload string, container string, direction string)
func (*EffectiveVPAController) GetLastScaleTime ¶
func (*EffectiveVPAController) ReconcileContainerPolicies ¶
func (c *EffectiveVPAController) ReconcileContainerPolicies(evpa *autoscalingapi.EffectiveVerticalPodAutoscaler, podTemplate *corev1.PodTemplateSpec, resourceEstimators []estimator.ResourceEstimatorInstance) (currentEstimatorStatus []autoscalingapi.ResourceEstimatorStatus, recommendation *vpatypes.RecommendedPodResources, err error)
func (*EffectiveVPAController) SetupWithManager ¶
func (c *EffectiveVPAController) SetupWithManager(mgr ctrl.Manager) error
func (*EffectiveVPAController) UpdateStatus ¶
func (c *EffectiveVPAController) UpdateStatus(ctx context.Context, evpa *autoscalingapi.EffectiveVerticalPodAutoscaler, newStatus *autoscalingapi.EffectiveVerticalPodAutoscalerStatus)
type ResourceEstimatorInstanceRanked ¶
type ResourceEstimatorInstanceRanked struct { Estimators []estimator.ResourceEstimatorInstance Priority int }
func RankEstimators ¶
func RankEstimators(resourceEstimators []estimator.ResourceEstimatorInstance) []ResourceEstimatorInstanceRanked
RankEstimators return ranked estimator list
type ScaleDirection ¶
type ScaleDirection string
const ( ScaleUp ScaleDirection = "ScaleUp" ScaleDown ScaleDirection = "ScaleDown" )