Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

ComputeClass request downscaling for overprovisioning (#2381) #2394

Merged
merged 2 commits into from
Jan 3, 2024
Merged

ComputeClass request downscaling for overprovisioning (#2381) #2394

merged 2 commits into from
Jan 3, 2024

Conversation

keyallis
Copy link
Contributor

@keyallis keyallis commented Jan 2, 2024

#2381

Add support for scaling down memory requests for acorns in relation to memory limits. We handle ComputeClasses that do not have this field set (ie legacy ComputeClasses) as having a 1:1 mapping. This means all existing tests should continue to work and behave as expected, so all new tests are only used to cover the new field itself.

Checklist

  • The title of this PR would make a good line in Acorn's Release Note's Changelog
  • The title of this PR ends with a link to the main issue being address in parentheses, like: This is a title (#1216). Here's an example
  • All relevant issues are referenced in the PR description. NOTE: don't use GitHub keywords that auto-close issues
  • Commits follow contributing guidance
  • Automated tests added to cover the changes. If tests couldn't be added, an explanation is provided in the Verification and Testing section
  • Changes to user-facing functionality, API, CLI, and upgrade impacts are clearly called out in PR description
  • PR has at least two approvals before merging (or a reasonable exception, like it's just a docs change)

Copy link
Contributor

@thedadams thedadams left a comment

Choose a reason for hiding this comment

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

One nit. Otherwise, looks good to me.

pkg/computeclasses/computeclasses.go Outdated Show resolved Hide resolved
Copy link
Contributor

@tylerslaton tylerslaton left a comment

Choose a reason for hiding this comment

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

This looks good, I'm trying to imagine a situation where we want to scale up above the defined memory such that 1.25 would be a valid scalar. The thing I'm imagining is where an admin wants to allocate more memory than the user defined. Is that something we'd want?

If not this is good to go in my mind.

}

if computeClass != nil {
cpuQuantity, err := computeclasses.CalculateCPU(*computeClass, memDefault, memoryQuantity)
cpuQuantity, err := computeclasses.CalculateCPU(*computeClass, memDefault, memoryRequest)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should also rename this to be cpuRequest as well?

@g-linville
Copy link
Contributor

I'm just now starting to look at the code, but one thing I am noticing is that scalar needs to be replaced with scaler everywhere it appears. We're calling it a "scaler" because it determines the scale of the memory request in comparison to the limit. Mathematically speaking it is also a "scalar" since it is a single numerical value and not a vector, but that is not what we should name it lol.

Copy link
Contributor

@g-linville g-linville left a comment

Choose a reason for hiding this comment

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

Lgtm other than the naming change that I mentioned in my previous comment.

@keyallis keyallis requested a review from g-linville January 3, 2024 19:05
@keyallis keyallis merged commit 33ee3ee into acorn-io:main Jan 3, 2024
5 checks passed
@keyallis keyallis deleted the issue-2381 branch January 3, 2024 20:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants