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

Round up fractional cpu values for ActiveProcessorsCount #944

Merged
merged 3 commits into from
Jan 30, 2025

Conversation

bianchi2
Copy link
Collaborator

@bianchi2 bianchi2 commented Jan 30, 2025

Kubernetes supports fractional units in cpu requests and limits. When we calculate ActiveProcessorsCount, and cpu request is, say, 3.1 (which is equivalent to 3200m) we don't round it up, as a result, products fail to start because ActiveProcessorsCount expects int not float.

Changes in this PR round up fractional cpu requests:

  • 0.1 becomes 1 (if it's <1 it'll be 1)
  • 2.1 becomes 2
  • 3.8 becomes 3

I decided not to round up to the closest non fractional value, so if it's 3.8 it's still not 4 cores, that's why it's safer to set 3.

Also, updating upload-action version because v3 is no longer supported. Test run with new artifacts version.

Checklist

  • I have added unit tests
  • I have applied the change to all applicable products
  • The E2E test has passed (use e2e label)

@bianchi2 bianchi2 added the e2e label Jan 30, 2025
Copy link
Member

@nanux nanux left a comment

Choose a reason for hiding this comment

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

Does make sense. LGTM

@bianchi2 bianchi2 merged commit 6973ae0 into main Jan 30, 2025
8 checks passed
@bianchi2 bianchi2 deleted the convert-fractional-cpu-units branch January 30, 2025 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants