Skip to content

feat(qrm): introduce resource package core foundation#1152

Open
luomingmeng wants to merge 10 commits into
kubewharf:mainfrom
luomingmeng:feat/qrm-resource-package-core
Open

feat(qrm): introduce resource package core foundation#1152
luomingmeng wants to merge 10 commits into
kubewharf:mainfrom
luomingmeng:feat/qrm-resource-package-core

Conversation

@luomingmeng
Copy link
Copy Markdown
Collaborator

@luomingmeng luomingmeng commented May 13, 2026

What type of PR is this?

Features

What this PR does / why we need it:

  • Adds Attributes to ResourcePackageItemConfig so RP items can carry capability/role tags ( reclaimable , irq-isolation , etc.) that downstream allocators consume.
  • Restructures the cpuadvisor protocol ( cpu.pb.go / cpu.proto ) and the sysadvisor metacache to natively model resource packages.
  • Refactors the pinned-cpuset representation in commonstate from a separate pool wrapper to a boolean ( pinnedCPUSet bool ), simplifying state transitions and persistence.
  • Centralizes NUMA topology zone-attribute names under pkg/consts/cnr.go and the topology adapter, so all plugins reference a single source of truth.
  • Adds the general.ParseSelector utility and qrm/util.go annotation-extraction helpers used by RP allocators and downstream hooks.
  • Lays the early CPU NUMA / DynamicPolicy plumbing required for the RP model to take effect.

Which issue(s) this PR fixes:

Special notes for your reviewer:

@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

❌ Patch coverage is 70.05396% with 333 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.04%. Comparing base (d301709) to head (5d48a06).

Files with missing lines Patch % Lines
...u/assembler/provisionassembler/assembler_common.go 59.43% 123 Missing and 21 partials ⚠️
...ugins/cpu/dynamicpolicy/policy_resource_package.go 79.90% 26 Missing and 15 partials ⚠️
...lugins/cpu/dynamicpolicy/policy_advisor_handler.go 38.46% 27 Missing and 5 partials ⚠️
...nt/sysadvisor/plugin/qosaware/server/cpu_server.go 60.00% 11 Missing and 7 partials ⚠️
pkg/agent/qrm-plugins/cpu/dynamicpolicy/policy.go 48.27% 13 Missing and 2 partials ⚠️
...ns/cpu/dynamicpolicy/policy_allocation_handlers.go 79.71% 9 Missing and 5 partials ⚠️
...sysadvisor/plugin/qosaware/resource/cpu/advisor.go 36.36% 12 Missing and 2 partials ⚠️
pkg/util/resource-package/util.go 87.65% 7 Missing and 3 partials ⚠️
...agent/qrm-plugins/cpu/dynamicpolicy/state/state.go 83.01% 5 Missing and 4 partials ⚠️
pkg/agent/sysadvisor/types/resource_package.go 60.86% 6 Missing and 3 partials ⚠️
... and 11 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1152      +/-   ##
==========================================
+ Coverage   61.86%   62.04%   +0.17%     
==========================================
  Files         791      796       +5     
  Lines       75113    75890     +777     
==========================================
+ Hits        46472    47089     +617     
- Misses      23550    23645      +95     
- Partials     5091     5156      +65     
Flag Coverage Δ
unittest 62.04% <70.05%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@luomingmeng luomingmeng force-pushed the feat/qrm-resource-package-core branch 3 times, most recently from fe9d2c4 to b635f7a Compare May 20, 2026 08:11
…pool to boolean

Update the resource package conversion logic to represent pinned cpuset as a boolean flag instead of a pool name
Modify test cases to reflect the new pinned cpuset representation
- Fix race condition in Start() by properly handling started flag and stop channel
- Replace sleep-based test synchronization with channel signaling
- Ensure cpuPressureEviction only runs when policy is started
…e PinnedCPUSetInfo

- Remove PinnedCPUSetInfo and related fields from QoSRegion interfaces
- Add GetResourcePackageName method to QoSRegion interface
- Introduce ResourcePackageConfig type for storing pinned cpuset info
- Update CPU server to handle resource package config from advisor requests
- Refactor region assembly to use resource package config from metacache
- Simplify region creation by removing pinnedCPUSetInfo parameter
- Add comprehensive tests for resource package config handling
Move zone attribute names used in topology adapter to a centralized consts package
to maintain consistency between CNR producers and consumers. Update all references
to use the new constants from pkg/consts.
…n pools

split the pool allocation logic into separate functions for pinned and common pools
add comprehensive tests for various allocation scenarios
remove redundant pinned CPU set parameter from generatePoolsAndIsolation
…UMA-aware allocation

- Add resource-package-name handling in region creation and metrics.
- Modify CPU allocation in policy_advisor_handler to consider both the
  resource-package pinned CPUs and any already-pinned cpusets, ensuring
  proper isolation in NUMA-aware mode.
- Simplify GetResourcePackageName to use annotations directly (drop the
  redundant unwrap step).
… package

Consider resource package when setting origin owner pool name for numa binding containers.
This ensures proper pool name wrapping when a resource package is specified and valid.
…utes

add attribute selector to filter resource packages for IRQ forbidden CPUs
add helper function to convert CNR attributes to string map
add utility function to aggregate pinned CPU sets from matching resource packages
update IRQ forbidden core logic to include resource package pinned CPUs
add tests for new functionality
…ckageState

- Add `attributes` map to ResourcePackageItemConfig proto message and
  regenerate cpu.pb.go.
- Replace direct CPUSet storage with ResourcePackageState struct on every
  consumer (state, util, irq tuner, sysadvisor metacache, advisor, assembler,
  cpu_server, types) so attribute metadata is preserved end-to-end.
- Add nil-checks where state may be absent and update IRQ-forbidden cores
  calculation accordingly.
- Update unit tests to the new structure.
@luomingmeng luomingmeng force-pushed the feat/qrm-resource-package-core branch from b635f7a to 5d48a06 Compare May 29, 2026 14:01
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.

2 participants