Skip to content

clusterapi: set resource slice count for DRA scale-from-zero - #10200

Open
dlanov wants to merge 1 commit into
kubernetes:masterfrom
dlanov:fix-10199-dra-resource-slice-count
Open

clusterapi: set resource slice count for DRA scale-from-zero#10200
dlanov wants to merge 1 commit into
kubernetes:masterfrom
dlanov:fix-10199-dra-resource-slice-count

Conversation

@dlanov

@dlanov dlanov commented Aug 26, 2026

Copy link
Copy Markdown

What type of PR is this?

/kind bug

What this PR does / why we need it:

Cluster API scale-from-zero generates a synthetic ResourceSlice for node
groups configured with DRA capacity annotations.

The generated ResourcePool currently leaves ResourceSliceCount at its
zero value. The DRA allocator treats that pool as incomplete, so its devices
are ignored and DRA workloads cannot trigger scale-from-zero.

Set ResourceSliceCount to 1, matching the single ResourceSlice generated
for the synthetic node.

The existing TestAnnotations coverage is updated to verify the generated
resource slice contains the correct pool metadata.

Which issue(s) this PR fixes:

Fixes #10199

Special notes for your reviewer:

Verified that the updated test fails when the production change is removed:
the expected ResourceSliceCount is 1 while the generated value remains 0.

Validation:

go test -race -vet=all ./cloudprovider/clusterapi/...

The separate MIG device-attribute limitation mentioned in #10199 is outside
the scope of this change.

Does this PR introduce a user-facing change?

Fixed Cluster API DRA scale-from-zero by generating ResourceSlices with a valid resource slice count.

@kubernetes-prow kubernetes-prow Bot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 26, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

This issue is currently awaiting triage.

If SIG Autoscaling contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 26, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Welcome @dlanov!

It looks like this is your first PR to kubernetes/autoscaler 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/autoscaler has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@kubernetes-prow kubernetes-prow Bot added the do-not-merge/needs-area Indicates that a PR should not merge because it lacks an area label. label Aug 26, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dlanov
Once this PR has been reviewed and has the lgtm label, please assign hardikdr for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 26, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @dlanov. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added area/cluster-autoscaler Issues or PRs related to the Cluster Autoscaler component area/provider/cluster-api Issues or PRs related to Cluster API provider and removed do-not-merge/needs-area Indicates that a PR should not merge because it lacks an area label. labels Aug 26, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from elmiko and enxebre August 26, 2026 17:57
@kubernetes-prow kubernetes-prow Bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Aug 26, 2026
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: af94989d-dffd-44f2-a7f2-a44e9720f55e

📥 Commits

Reviewing files that changed from the base of the PR and between d5a1b90 and a5af0e5.

📒 Files selected for processing (2)
  • cluster-autoscaler/cloudprovider/clusterapi/clusterapi_unstructured.go
  • cluster-autoscaler/cloudprovider/clusterapi/clusterapi_unstructured_test.go

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The cluster API provider now sets ResourceSliceCount to 1 for generated GPU resource pools. TestAnnotations verifies the updated ResourcePool value.

Changes

DRA resource slice pool

Layer / File(s) Summary
Set and validate the resource slice pool count
cluster-autoscaler/cloudprovider/clusterapi/clusterapi_unstructured.go, cluster-autoscaler/cloudprovider/clusterapi/clusterapi_unstructured_test.go
Generated GPU resource slices set ResourceSliceCount to 1. TestAnnotations expects the same value.

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

Merge Risk: ⚪ Minimal · up to a5af0

This localized change sets the generated resource slice count to match the single slice produced for scale-from-zero, enabling DRA workloads to trigger node scaling; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: choraden

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning 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 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #10199 by setting ResourceSliceCount to 1 for the single synthetic ResourceSlice and updating TestAnnotations accordingly. The separate MIG device attribute limitation remain…
Out of Scope Changes check ✅ Passed The pull request changes only the synthetic ResourcePool metadata and its corresponding test. No unrelated code changes are present.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: setting the DRA resource slice count for Cluster API scale-from-zero.
Full details: Linked Issues check

Explanation

The changes satisfy issue #10199 by setting ResourceSliceCount to 1 for the single synthetic ResourceSlice and updating TestAnnotations accordingly. The separate MIG device attribute limitation remains outside this issue's scope.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cluster-autoscaler Issues or PRs related to the Cluster Autoscaler component area/provider/cluster-api Issues or PRs related to Cluster API provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clusterapi: DRA pods never trigger scale-from-zero on CA 1.35+

1 participant