Skip to content

fix(deploy): round the memory and CPU limits to whole numbers - #1119

Merged
oleksandr-nc merged 1 commit into
mainfrom
fix/whole-resource-limits
Oct 16, 2026
Merged

oleksandr-nc merged 1 commit into
mainfrom
fix/whole-resource-limits

Conversation

@oleksandr-nc

@oleksandr-nc oleksandr-nc commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

The daemon settings convert the CPU limit with Number(cpus) * 1000000000, so some values come out with a fraction: 1.07 CPUs is stored as 1070000000.0000001 and 2.01 as 2009999999.9999998 (50 of the 1600 two-decimal values up to 16, among them 4.1 and 8.2). AppAPI sent the value on unchanged. On Docker every deploy and update on that daemon failed, because Docker does not accept a fraction and HaRP now refuses it before creating the container, and an update left the ExApp without a container, because the old one is removed first. On Kubernetes HaRP dropped the fractional value, so those ExApps ran without a CPU limit.

AppAPI now rounds memory and nanoCPUs to whole numbers when it builds the deploy parameters for Docker (HaRP and Docker Socket Proxy) and Kubernetes, so it also works for limits that are already stored. Kubernetes ExApps on such a daemon get the configured CPU limit with their next deploy or update. Other values are passed on unchanged.

@oleksandr-nc

Copy link
Copy Markdown
Contributor Author

/backport to stable35

@oleksandr-nc

Copy link
Copy Markdown
Contributor Author

/backport to stable34

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fafb48f7-9eb2-401b-99ee-be686d76239a
📥 Commits

Reviewing files that changed from the base of the PR and between cc9a044 and 0975efc.

📒 Files selected for processing: 3
  • tests/php/DeployActions/DockerActionsTest.php
  • tests/php/DeployActions/KubernetesActionsTest.php
  • tests/php/Service/AppAPICommonServiceTest.php

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

📝 Walkthrough

AppAPICommonService::buildResourceLimits returns an empty array when resourceLimits is not an array. For float values of memory and nanoCPUs whose absolute values are below PHP_INT_MAX, it rounds and casts the values to integers. Other entries remain unchanged. Docker and Kubernetes deployment parameter builders now use this method. Tests cover these cases.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to 0975e

Fractional UI-derived limits are normalized to integer bytes and nanocpus before deployment. The inspected consumers support those units, and no actionable merge-blocking risk is established; merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title clearly and concisely describes the main change: rounding memory and CPU resource limits to whole numbers.
Description check Passed The description directly explains the fractional resource-limit problem, the affected deployment paths, and the implemented rounding behavior.
  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 38e3131a-720a-49c9-88b3-53b421c0c818
📥 Commits

Reviewing files that changed from the base of the PR and between 590ed3f and cc9a044.

📒 Files selected for processing: 4
  • lib/DeployActions/DockerActions.php
  • lib/DeployActions/KubernetesActions.php
  • lib/Service/AppAPICommonService.php
  • tests/php/Service/AppAPICommonServiceTest.php

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Comment thread lib/Service/AppAPICommonService.php
Signed-off-by: Oleksandr Piskun <oleksandr2088@icloud.com>
@oleksandr-nc
oleksandr-nc force-pushed the fix/whole-resource-limits branch from cc9a044 to 0975efc Compare October 16, 2026 08:24
@oleksandr-nc
oleksandr-nc merged commit 2c10550 into main Oct 16, 2026
54 checks passed
@oleksandr-nc
oleksandr-nc deleted the fix/whole-resource-limits branch October 16, 2026 09:51
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.

1 participant