Add --cpu-quota flag to set systemd's CPUQuota for fleetd on Linux - #53069
Add --cpu-quota flag to set systemd's CPUQuota for fleetd on Linux#53069lucasmrod wants to merge 1 commit into
--cpu-quota flag to set systemd's CPUQuota for fleetd on Linux#53069Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Add a successful Linux package test verifying that a non-default quota reaches the generated systemd unit.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
Adds --cpu-quota support for configuring systemd CPU limits in Linux fleetd packages, preserving the 20% default.
Changes:
- Adds the packaging option and CLI validation.
- Renders configurable
CPUQuotain the systemd unit. - Adds unit and integration tests.
File summaries
| File | Description |
|---|---|
orbit/pkg/packaging/packaging.go |
Adds the CPU quota packaging option. |
orbit/pkg/packaging/linux_shared.go |
Renders configurable systemd CPU quotas. |
orbit/pkg/packaging/linux_shared_test.go |
Tests default and custom quotas. |
cmd/fleetctl/integrationtest/package/package_test.go |
Tests package types and invalid flag usage. |
cmd/fleetctl/fleetctl/package.go |
Defines and validates the CLI flag. |
Review details
Files excluded by content exclusion policy (1)
- changes/fleetctl-package-cpu-quota
Suppressed comments (1)
cmd/fleetctl/fleetctl/package.go:343
- The new CLI path is only exercised by validation failures, so no test verifies that an accepted non-default value reaches the generated Linux package. A regression in the flag destination or in passing
opttobuildFuncwould still leave these tests green; add a successful Linux package test that inspects the systemd unit and asserts, for example,CPUQuota=1%.
if c.IsSet("cpu-quota") {
switch c.String("type") {
case "deb", "rpm", "pkg.tar.zst":
default:
return errors.New("--cpu-quota is only supported for deb/rpm/pkg.tar.zst packages")
}
if opt.CPUQuota == 0 {
return errors.New("--cpu-quota must be greater than 0")
}
}
- Files reviewed: 5/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. WalkthroughThe Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The Linux package CPU quota option is validated and rendered consistently, with default and custom values covered by tests. 🚥 Pre-merge checks | ✅ 2 | ❌ 5❌ Failed checks (5 warnings)
✅ Passed checks (2 passed)
Full details: Linked Issues checkExplanation The PR claims to resolve issue Full details: Linked Issues checkExplanation Issue Full details: Out of Scope Changes checkExplanation The changed files implement Linux package CPU quota configuration through Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 5 files. (1 skipped: 1 unsupported.) Full details: Description checkExplanation The description includes the related issue, changes file, automated testing, manual testing, platform details, and fleetd compatibility checks. However, it does not explain how this CPU quota change addresses issue
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #53069 +/- ##
==========================================
+ Coverage 76.06% 76.07% +0.01%
==========================================
Files 4123 4126 +3
Lines 249892 249984 +92
Branches 14247 14247
==========================================
+ Hits 190076 190177 +101
+ Misses 59640 59631 -9
Partials 176 176
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Resolves #49925.
changes/,orbit/changes/oree/fleetd-chrome/changes.Testing
Tested on arm64 (Ubuntu 25.04) and amd64 (Omarchy Quattro) without Fleet Desktop (feature planned to run on servers)
fleetd/orbit/Fleet Desktop
runtime.GOOSis used as needed to isolate changesSummary by CodeRabbit
New Features
--cpu-quotaoption tofleetctl packagefor configuring the CPU limit applied to the Linux service.Bug Fixes