Skip to content

feat(aqc): add EnableBypassCPUSetAdjustment flag for CPU plugin - #204

Open
luomingmeng wants to merge 2 commits into
kubewharf:mainfrom
luomingmeng:dev/support-bypass-cpuset-adjustment
Open

feat(aqc): add EnableBypassCPUSetAdjustment flag for CPU plugin#204
luomingmeng wants to merge 2 commits into
kubewharf:mainfrom
luomingmeng:dev/support-bypass-cpuset-adjustment

Conversation

@luomingmeng

@luomingmeng luomingmeng commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What type of PR is this?

/kind feature

What this PR does / why we need it

Add a new boolean field EnableBypassCPUSetAdjustment to CPUPluginConfig in AdminQoSConfiguration to allow bypassing cpuset backfill in QRM CPU plugin's PackAllocationResponse for shared_cores, reclaimed_cores and system_cores pools.

When enabled, QRM will not populate cpuset for those pools during allocation, and cpuset adjustment is delegated to the reconcile plugin instead. Dedicated pools are unaffected by this flag.

This enables a cleaner separation between allocation-time decisions (kept in QRM) and runtime cpuset reconciliation (moved to the reconcile plugin), which is required by the follow-up work in katalyst-core.

Changes

  • Add EnableBypassCPUSetAdjustment *bool field to CPUPluginConfig (pkg/apis/config/v1alpha1/adminqos.go).
  • Regenerate zz_generated.deepcopy.go for the new pointer field.
  • Update CRD schema config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml accordingly.

Which issue(s) this PR fixes

None.

Special notes for your reviewer

  • The field is +optional and defaults to unset (equivalent to false), so existing behavior is preserved.
  • The corresponding consumer logic will land in a follow-up katalyst-core PR.

Summary by CodeRabbit

  • New Features
    • Added a new optional configuration flag to bypass CPU-set adjustment for QoS-wide resource allocation behavior, with GetResourcesAllocation and pod allocation treated consistently when enabled.
  • Documentation
    • Updated the configuration schema and descriptions to clarify the exact cpuset behavior difference between GetResourcesAllocation results and Allocate/AllocateForPod responses when the flag is turned on.

Add a new boolean field EnableBypassCPUSetAdjustment to CPUPluginConfig
to allow bypassing cpuset adjustment in QRM for shared/reclaimed/system
pools, delegating the work to reconcile plugin instead. Also generate
deepcopy functions for the new field and update CRD schema.
@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds the optional EnableBypassCPUSetAdjustment field to CPUPluginConfig, updates its CRD schema and documentation, and adds deep-copy handling for the pointer field.

Changes

EnableBypassCPUSetAdjustment Field Addition

Layer / File(s) Summary
Field definition, CRD schema, and deepcopy support
pkg/apis/config/v1alpha1/adminqos.go, config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml, pkg/apis/config/v1alpha1/zz_generated.deepcopy.go
Adds the optional EnableBypassCPUSetAdjustment *bool field, its boolean CRD schema property and behavior description, and nil-guarded deepcopy handling.

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 clearly describes the main change: adding the EnableBypassCPUSetAdjustment flag to the CPU plugin.
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.

luomingmeng added a commit to luomingmeng/katalyst-core that referenced this pull request Jul 3, 2026
Temporarily uses a replace directive pointing to the fork branch dev/support-bypass-cpuset-adjustment (kubewharf/katalyst-api#204). Once the API PR is merged, this commit will be squashed and replaced with a proper version bump against kubewharf/katalyst-api.

(cherry picked from commit 25587f9)

@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 `@config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml`:
- Around line 820-825: Update the Go field comment for
enableBypassCPUSetAdjustment to state that PackAllocationResponse skips cpuset
population for shared_cores, reclaimed_cores, and system_cores, while dedicated
pools remain unaffected; then regenerate the CRD so its description matches.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7e064476-6427-4890-b087-1ad4549eb0a2

📥 Commits

Reviewing files that changed from the base of the PR and between dc80502 and cfd2ee7.

📒 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

Comment on lines +820 to +825
enableBypassCPUSetAdjustment:
description: |-
EnableBypassCPUSetAdjustment controls whether GetResourcesAllocation clears
CPU AllocationResult for all QoS classes. Allocation responses returned by
Allocate/AllocateForPod keep their cpuset unchanged.
type: boolean

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail
rg -n -C 4 'EnableBypassCPUSetAdjustment|PackAllocationResponse|GetResourcesAllocation' \
  pkg/apis/config/v1alpha1 config

Repository: kubewharf/katalyst-api

Length of output: 3713


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Locate relevant symbols and their surrounding structure.
fd -a '.*\.go$' pkg | sed 's#^\./##' | while read -r f; do
  if rg -n 'EnableBypassCPUSetAdjustment|PackAllocationResponse|GetResourcesAllocation' "$f" >/dev/null 2>&1; then
    echo "### $f"
    ast-grep outline "$f" --view expanded || true
  fi
done

Repository: kubewharf/katalyst-api

Length of output: 37299


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

# Find all references and print compact context.
rg -n -C 6 'EnableBypassCPUSetAdjustment|PackAllocationResponse|GetResourcesAllocation' .

Repository: kubewharf/katalyst-api

Length of output: 5866


🌐 Web query:

"EnableBypassCPUSetAdjustment PackAllocationResponse shared_cores reclaimed_cores system_cores"

💡 Result:

EnableBypassCPUSetAdjustment is a configuration feature within the Katalyst QoS Resource Manager (QRM) CPU plugin, designed to optimize how CPU sets (cpusets) are managed for specific Quality of Service (QoS) classes [1]. When this feature is enabled, the QRM CPU plugin skips the backfilling of the cpuset string in the ResourceAllocationResponse (the PackAllocationResponse) returned to the kubelet for pods belonging to the shared_cores, reclaimed_cores, and system_cores pools [1]. By bypassing this backfill process, the system allows the reconcile plugin to take ownership of cpuset delivery, rather than having it set during the initial allocation response [1]. Key aspects of this feature include: - Scope: It specifically impacts shared_cores, reclaimed_cores, and system_cores pools [1]. Dedicated_cores pools remain unaffected by this bypass [1]. - Implementation: It acts as a response post-processing step within the dynamic policy of the QRM CPU plugin [1]. It uses internal helpers (such as shouldBypassCPUSetAdjustment and applyCPUSetBypass) to clear the cpuset string in the AllocationResult while preserving other critical information like TopologyAssignments, AllocatedQuantity, annotations, and hints [1]. - Purpose: This mechanism provides more flexibility in how CPU isolation is managed at runtime, enabling the reconcile loops to handle cpuset updates more effectively without conflicts from the initial allocation fast-path [1]. Katalyst is a Kubernetes-based resource management system that implements these distinct QoS levels (dedicated, shared, reclaimed, and system) to improve workload colocation and resource efficiency [2][3]. The EnableBypassCPUSetAdjustment switch is disabled by default [1].

Citations:


Align the enableBypassCPUSetAdjustment description with the actual scope. It should say this skips cpuset population during PackAllocationResponse for shared_cores, reclaimed_cores, and system_cores; dedicated pools are unaffected. Update the Go field comment and regenerate the CRD.

🤖 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 `@config/crd/bases/config.katalyst.kubewharf.io_adminqosconfigurations.yaml`
around lines 820 - 825, Update the Go field comment for
enableBypassCPUSetAdjustment to state that PackAllocationResponse skips cpuset
population for shared_cores, reclaimed_cores, and system_cores, while dedicated
pools remain unaffected; then regenerate the CRD so its description matches.

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