Skip to content

feat(aqc): add max reclaimed resource for memory and cpu#205

Open
JustinChengLZ wants to merge 1 commit into
kubewharf:mainfrom
JustinChengLZ:dev/reclaim-resource-max
Open

feat(aqc): add max reclaimed resource for memory and cpu#205
JustinChengLZ wants to merge 1 commit into
kubewharf:mainfrom
JustinChengLZ:dev/reclaim-resource-max

Conversation

@JustinChengLZ

@JustinChengLZ JustinChengLZ commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Special notes for your reviewer:

Summary by CodeRabbit

  • New Features
    • Added new admin QoS configuration options to control the maximum reclaimable CPU and per-NUMA maximum reclaimable memory headroom.
    • You can now set reclaimed CPU and reclaimed memory ratios, each constrained to a value between 0 and 1.
    • These settings help fine-tune how much CPU and memory can be reclaimed at any time.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b0c3660e-6443-41ce-8cc1-fca42177b0bb

📥 Commits

Reviewing files that changed from the base of the PR and between 10f1404 and 78a7ab0.

📒 Files selected for processing (3)
  • config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml
  • pkg/apis/config/v1alpha1/adminqos.go
  • pkg/apis/config/v1alpha1/zz_generated.deepcopy.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/apis/config/v1alpha1/zz_generated.deepcopy.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/apis/config/v1alpha1/adminqos.go

📝 Walkthrough

Walkthrough

Admin QoS configuration adds optional CPU and memory reclaim ratio fields to the API types and CRD schema. The generated deepcopy code now copies both new pointer fields.

Changes

Admin QoS reclaim ratio fields

Layer / File(s) Summary
API and CRD fields
pkg/apis/config/v1alpha1/adminqos.go, config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml
Adds optional CPU and memory reclaim ratio fields with 0-1 validation in the Go types and CRD schema.
DeepCopy support
pkg/apis/config/v1alpha1/zz_generated.deepcopy.go
Updates deepcopy logic to copy the new CPU and memory reclaim ratio pointer fields when set.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the change: adding max reclaimed resource settings for both CPU and memory.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@JustinChengLZ JustinChengLZ force-pushed the dev/reclaim-resource-max branch from 1039b1c to 10f1404 Compare July 3, 2026 08:14

@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.

🧹 Nitpick comments (2)
pkg/apis/config/v1alpha1/adminqos.go (2)

254-259: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Comment ordering differs from sibling fields.

Validation markers precede the description here, whereas other fields (e.g. FreeBasedRatio at Line 284) place the description first. Functionally harmless since controller-gen still produced the correct CRD description, but worth aligning for consistency.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/apis/config/v1alpha1/adminqos.go` around lines 254 - 259, The comment
order for ReclaimedCPUMaxRatio is inconsistent with sibling fields like
FreeBasedRatio in AdminQOSSpec. Reorder the kubebuilder validation markers and
field description so the human-readable description comes first, followed by the
validation tags and +optional, matching the style used by the other fields in
this struct.

254-259: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

JSON tag drops the "Ratio" suffix present in the Go field name.

ReclaimedCPUMaxRatio/ReclaimedMemoryMaxRatio map to reclaimedCPUMax/reclaimedMemoryMax, while sibling fields keep full name correspondence (e.g. FreeBasedRatiofreeBasedRatio, CacheBasedRatiocacheBasedRatio). Consider aligning the JSON key naming convention for consistency, though this is a cosmetic API surface choice rather than a defect.

Also applies to: 313-318

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pkg/apis/config/v1alpha1/adminqos.go` around lines 254 - 259, Align the JSON
field names for the AdminQoS ratio fields so they consistently preserve the
“Ratio” suffix like the other ratio properties. Update the ReclaimedCPUMaxRatio
and ReclaimedMemoryMaxRatio struct tags in adminqos.go to use matching JSON
keys, and verify the same naming convention is applied wherever these fields are
defined or referenced, including the duplicate declaration noted by the review.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@pkg/apis/config/v1alpha1/adminqos.go`:
- Around line 254-259: The comment order for ReclaimedCPUMaxRatio is
inconsistent with sibling fields like FreeBasedRatio in AdminQOSSpec. Reorder
the kubebuilder validation markers and field description so the human-readable
description comes first, followed by the validation tags and +optional, matching
the style used by the other fields in this struct.
- Around line 254-259: Align the JSON field names for the AdminQoS ratio fields
so they consistently preserve the “Ratio” suffix like the other ratio
properties. Update the ReclaimedCPUMaxRatio and ReclaimedMemoryMaxRatio struct
tags in adminqos.go to use matching JSON keys, and verify the same naming
convention is applied wherever these fields are defined or referenced, including
the duplicate declaration noted by the review.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fe4f41c9-97f9-4611-a1cd-a35fad60141c

📥 Commits

Reviewing files that changed from the base of the PR and between 1039b1c and 10f1404.

📒 Files selected for processing (3)
  • config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml
  • pkg/apis/config/v1alpha1/adminqos.go
  • pkg/apis/config/v1alpha1/zz_generated.deepcopy.go
✅ Files skipped from review due to trivial changes (1)
  • pkg/apis/config/v1alpha1/zz_generated.deepcopy.go

@JustinChengLZ JustinChengLZ force-pushed the dev/reclaim-resource-max branch from 10f1404 to 78a7ab0 Compare July 3, 2026 08:25
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