Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add periodSeconds logic #368

Merged
merged 2 commits into from
Apr 29, 2022
Merged

Add periodSeconds logic #368

merged 2 commits into from
Apr 29, 2022

Conversation

nvandanapu
Copy link
Contributor

No description provided.


scaleUp_stabilizationWindow := time.Duration(vsp.Spec.Behavior.ScaleUp.StabilizationWindowSeconds) * time.Second
scaleDown_stabilizationWindow := time.Duration(vsp.Spec.Behavior.ScaleDown.StabilizationWindowSeconds) * time.Second

// If there is a larger instance type available, check if we want to vertically scale up the IG
if hasLargerInstanceType && vsp.Status != nil && time.Since(vsp.Status.TargetStatuses[igName].LastTransitionTime.Time) > scaleUp_stabilizationWindow {
if hasLargerInstanceType && vsp.Status != nil && time.Since(vsp.Status.TargetStatuses[namespacedIGName].LastTransitionTime.Time) > scaleUp_stabilizationWindow {
nextBiggerInstance := instanceTypeRange.InstanceTypes[currInstanceTypeIndex+1]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we create and use a nextSmallerInstance with valueinstanceTypeRange.InstanceTypes[currInstanceTypeIndex-1] as well?

}

if time.Since(memoryAboveScaleUpThreshold.LastTransitionTime.Time) > time.Duration(scaleUpOnMemoryUtilizationPolicy.PeriodSeconds) {
r.ManagerContext.ComputedTypes[namespacedIGName] = instanceTypeRange.InstanceTypes[currInstanceTypeIndex+1]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use nextBiggerInstance here

}
}
}

vsp.Status.TargetStatuses[namespacedIGName] = &v1alpha1.TargetStatus{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is outside of the nil check for vsp.Status so we should check here as well?

@nvandanapu nvandanapu merged commit 42e6e81 into vna Apr 29, 2022
@tekenstam tekenstam deleted the vna-periodSeconds branch September 18, 2023 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants