Skip to content

Feat(numa cpu pressure eviction config) add upper and lower bound - #209

Merged
cheney-lin merged 1 commit into
kubewharf:mainfrom
chuyingzhi:feat(NumaCPUPressureEvictionConfig)--add-upper-and-lower-bound
Jul 20, 2026
Merged

Feat(numa cpu pressure eviction config) add upper and lower bound#209
cheney-lin merged 1 commit into
kubewharf:mainfrom
chuyingzhi:feat(NumaCPUPressureEvictionConfig)--add-upper-and-lower-bound

Conversation

@chuyingzhi

@chuyingzhi chuyingzhi commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

change for katalyst qrm plugin numa_cpu_pressure_eviction update
updated plugin will evict workload by bound instead of prior threshold

Special notes for your reviewer:

Summary by CodeRabbit

  • New Features
    • Added two configurable NUMA CPU pressure eviction ratio thresholds: lowerBoundRatio (soft) and upperBoundRatio (hard).
    • Both thresholds are validated to be between 0 and 1.
    • When the NUMA CPU usage ratio crosses these thresholds, behavior changes accordingly: soft threshold reports softer pressure handling, while the hard threshold enables eviction (including NoSchedule taint behavior) for candidate pods.

@CLAassistant

CLAassistant commented Jul 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@chuyingzhi, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ede3f63b-2320-4316-bd71-785a87290edc

📥 Commits

Reviewing files that changed from the base of the PR and between 97b1a5b and 74ef6f1.

📒 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
📝 Walkthrough

Walkthrough

The NUMA CPU pressure eviction configuration adds optional soft and hard threshold ratios, validates them between 0 and 1 in the API and CRD, and updates generated deepcopy logic to preserve both values.

Changes

NUMA CPU pressure eviction ratios

Layer / File(s) Summary
Ratio configuration contract and deepcopy
pkg/apis/config/v1alpha1/adminqos.go, config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml, pkg/apis/config/v1alpha1/zz_generated.deepcopy.go
Adds optional lowerBoundRatio and upperBoundRatio fields with [0,1] validation, documents their soft and hard threshold semantics in the API and CRD, and deep-copies both pointer values.

Estimated code review effort: 1 (Trivial) | ~5 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 is clearly related to the main change: adding upper and lower bounds to NUMA CPU pressure eviction config.
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

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

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

Inline comments:
In `@pkg/apis/config/v1alpha1/adminqos.go`:
- Around line 536-552: Add cross-field validation enforcing each lower threshold
to be less than or equal to its corresponding upper threshold in the AdminQOS
configuration, including the ratio fields and all load/usage upper/lower pairs
in AdminQOSConfiguration. Update the API validation markers and regenerate
config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml so
admission rejects invalid threshold ordering; the CRD site requires only the
generated validation output.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b379d464-67e3-4487-889a-10a30d4ee36e

📥 Commits

Reviewing files that changed from the base of the PR and between 2186c66 and 6d72327.

📒 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

Comment on lines +536 to +552
// UpperBoundRatio is the hard threshold ratio (0~1) applied to the NUMA CPU
// usage ratio. When enough recent samples cross this bound, the plugin reports
// HARD_MET together with a NodeCondition + NoSchedule taint, which allows the
// eviction manager to actually evict candidate pods.
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1
// +optional
UpperBoundRatio *float64 `json:"upperBoundRatio,omitempty"`

// LowerBoundRatio is the soft threshold ratio (0~1) applied to the NUMA CPU
// usage ratio. When enough recent samples cross this bound but the upper bound
// is not yet reached, the plugin reports SOFT_MET together with a NodeCondition and
// NoSchedule taint, which only prevents new scheduling without evicting pods.
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=1
// +optional
LowerBoundRatio *float64 `json:"lowerBoundRatio,omitempty"`

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate relevant symbols =="
rg -n "UpperBoundRatio|LowerBoundRatio|validation:.*(UpperBoundRatio|LowerBoundRatio)|CEL|XValidation|cross-field|upper.*lower|lower.*upper" \
  pkg/apis/config/v1alpha1 config/crd/bases -S

echo
echo "== file size =="
wc -l pkg/apis/config/v1alpha1/adminqos.go config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml

echo
echo "== ast-grep outline for adminqos.go =="
ast-grep outline pkg/apis/config/v1alpha1/adminqos.go --view expanded | sed -n '1,220p'

echo
echo "== relevant CRD excerpt around lower/upper =="
sed -n '240,330p' config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml

Repository: kubewharf/katalyst-api

Length of output: 27476


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== search for cross-field validation annotations =="
rg -n "XValidation|x-kubernetes-validations|kubebuilder:validation:.*(XValidation|oneOf|anyOf)|rule:" pkg/apis/config/v1alpha1 config/crd/bases -S

echo
echo "== inspect load and usage bound pairs in adminqos.go =="
sed -n '424,450p' pkg/apis/config/v1alpha1/adminqos.go
echo
sed -n '807,845p' pkg/apis/config/v1alpha1/adminqos.go

echo
echo "== inspect corresponding CRD excerpts =="
sed -n '188,230p' config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml
echo
sed -n '378,430p' config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml

Repository: kubewharf/katalyst-api

Length of output: 212


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== cross-field validation annotations (if any) =="
rg -n "XValidation|x-kubernetes-validations|kubebuilder:validation:.*(oneOf|anyOf|allOf)|rule:" \
  pkg/apis/config/v1alpha1 config/crd/bases -S || true

echo
echo "== NUMA and system CPU pressure snippets =="
sed -n '498,555p' pkg/apis/config/v1alpha1/adminqos.go
echo
sed -n '807,845p' pkg/apis/config/v1alpha1/adminqos.go

echo
echo "== generated CRD snippets =="
sed -n '250,310p' config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml
echo
sed -n '404,435p' config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml

Repository: kubewharf/katalyst-api

Length of output: 10468


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== usages of upper/lower bound ratios in repo =="
rg -n "UpperBoundRatio|LowerBoundRatio|loadUpperBoundRatio|loadLowerBoundRatio|usageUpperBoundRatio|usageLowerBoundRatio" -S .

echo
echo "== inspect likely implementation file(s) if present =="
fd -a -e go . | rg "evict|pressure|qos|adminqos|numa|load|usage" | head -n 50

Repository: kubewharf/katalyst-api

Length of output: 8094


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== read the utility helpers =="
sed -n '1,260p' pkg/utils/adminqos.go

echo
echo "== check for ratio-related logic in eviction helpers =="
sed -n '1,260p' pkg/utils/eviction.go

echo
echo "== any cross-field checks in API package =="
rg -n ">=|<=|lower.*upper|upper.*lower|compare|validate|normalize" pkg/apis/config/v1alpha1 pkg/utils -S

Repository: kubewharf/katalyst-api

Length of output: 3244


Enforce lower ≤ upper for these ratio fields.
LowerBoundRatio can still exceed UpperBoundRatio here, and the same gap exists for the load/usage upper/lower pairs in pkg/apis/config/v1alpha1/adminqos.go. Add cross-field validation and regenerate config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml so invalid threshold order is rejected at admission.

📍 Affects 2 files
  • pkg/apis/config/v1alpha1/adminqos.go#L536-L552 (this comment)
  • config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml#L262-L270
🤖 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 536 - 552, Add cross-field
validation enforcing each lower threshold to be less than or equal to its
corresponding upper threshold in the AdminQOS configuration, including the ratio
fields and all load/usage upper/lower pairs in AdminQOSConfiguration. Update the
API validation markers and regenerate
config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml so
admission rejects invalid threshold ordering; the CRD site requires only the
generated validation output.

@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 (1)
pkg/apis/config/v1alpha1/zz_generated.deepcopy.go (1)

2226-2235: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Remove the duplicate ratio deepcopy blocks.

UpperBoundRatio and LowerBoundRatio are already deep-copied at Lines 2216-2225. These blocks allocate and copy both pointers again, then overwrite the first allocations. Regenerate this file and keep one deepcopy block per field.

🤖 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/zz_generated.deepcopy.go` around lines 2226 - 2235,
Remove the duplicate UpperBoundRatio and LowerBoundRatio deepcopy blocks from
the generated deepcopy method, retaining exactly one allocation-and-copy block
for each field. Regenerate the file so the method does not repeat or overwrite
those pointer copies.
🤖 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/zz_generated.deepcopy.go`:
- Around line 2226-2235: Remove the duplicate UpperBoundRatio and
LowerBoundRatio deepcopy blocks from the generated deepcopy method, retaining
exactly one allocation-and-copy block for each field. Regenerate the file so the
method does not repeat or overwrite those pointer copies.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a219f69-419a-4b40-9407-1ee3a45a242c

📥 Commits

Reviewing files that changed from the base of the PR and between 6d72327 and 56d55ac.

📒 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 as they are similar to previous changes (2)
  • config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml
  • pkg/apis/config/v1alpha1/adminqos.go

@chuyingzhi
chuyingzhi force-pushed the feat(NumaCPUPressureEvictionConfig)--add-upper-and-lower-bound branch 2 times, most recently from 4993224 to c9c3bb2 Compare July 20, 2026 03:56
fix: generate crd and fix deepcopy function
@chuyingzhi
chuyingzhi force-pushed the feat(NumaCPUPressureEvictionConfig)--add-upper-and-lower-bound branch from 97b1a5b to 74ef6f1 Compare July 20, 2026 04:56
@cheney-lin
cheney-lin merged commit cf114a7 into kubewharf:main Jul 20, 2026
2 checks passed
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.

3 participants