Skip to content

Automated cherry pick of #15279: Resize the StatefulSet workload when scaling up from zero to a different size - #15302

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:release-0.19from
sohankunkerkar:automated-cherry-pick-of-#15279-origin-release-0.19
Sep 9, 2026
Merged

kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:release-0.19from
sohankunkerkar:automated-cherry-pick-of-#15279-origin-release-0.19

Conversation

@sohankunkerkar

Copy link
Copy Markdown
Member

Cherry pick of #15279 on release-0.19.

#15279: Resize the StatefulSet workload when scaling up from zero to a different size

For details on the cherry pick process, see the cherry pick requests page.

What type of PR is this?

/kind bug

StatefulSet: Fixed a bug where scaling a StatefulSet to zero and then back up to a different number of replicas left the Workload with the original pod count, causing it to be admitted and charged quota for the wrong number of pods.

Copilot AI lite review requested due to automatic review settings September 8, 2026 20:28
@kubernetes-prow kubernetes-prow Bot added this to the v0.19 milestone Sep 8, 2026
@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. labels Sep 8, 2026
@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • main

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: a7654153-8738-4771-ad1f-f9d6a7d6386a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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

@netlify

netlify Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit a957235
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kueue/deploys/6aa07a8b9d946c000890b6b5

@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 8, 2026
@kubernetes-prow kubernetes-prow Bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 8, 2026
@mbobrovskyi

Copy link
Copy Markdown
Contributor

Thank you for cherry-pick!

/lgtm

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 8, 2026
@kubernetes-prow

Copy link
Copy Markdown

LGTM label has been added.

DetailsGit tree hash: 7d689c31191d56a968a354282f05382b850d2350

Copilot AI 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.

🟢 Approval recommended

The controller change is narrowly scoped to OnHold scale-up handling and is covered by a targeted integration test for the reported bug scenario.

Pull request overview

Cherry-picks the fix from #15279 onto release-0.19 to ensure StatefulSet-backed Workloads are resized correctly when a StatefulSet is scaled down to zero and then scaled back up to a different replica count, preventing incorrect pod-count quota accounting/admission.

Changes:

  • Resync Workload.spec.podSets[].count when clearing the OnHold state so re-admission uses the current StatefulSet replica count.
  • Add integration coverage for StatefulSet pod gating behavior during rollouts (current vs update revision).
  • Add an integration test validating Workload resize behavior when scaling 0 → N with a different N than the original.
File summaries
File Description
pkg/controller/jobs/statefulset/statefulset_reconciler.go Updates reconcile flow to apply desired PodSet counts before clearing OnHold, fixing stale Workload sizing on re-admission.
test/integration/singlecluster/controller/jobs/statefulset/statefulset_controller_test.go Adds integration tests for rollout gating behavior and for resizing Workload pod count after a 0 → N scale-up to a different size.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +343 to +347
g.Expect(k8sClient.Get(ctx, wlKey, wl)).Should(gomega.Succeed())
cond := findWorkloadCondition(wl, kueue.WorkloadQuotaReserved)
g.Expect(cond).ShouldNot(gomega.BeNil())
g.Expect(cond.Reason).Should(gomega.Equal(kueue.WorkloadOnHold))
}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
…ent size

Signed-off-by: Sohan Kunkerkar <sohank2602@gmail.com>
@sohankunkerkar
sohankunkerkar force-pushed the automated-cherry-pick-of-#15279-origin-release-0.19 branch from 655b27e to a957235 Compare September 8, 2026 21:13
@kubernetes-prow kubernetes-prow Bot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 8, 2026
@kubernetes-prow kubernetes-prow Bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 8, 2026
@mimowo

mimowo commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

/lgtm
/approve
/test pull-kueue-verify-release-0-19

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 9, 2026
@kubernetes-prow

Copy link
Copy Markdown

LGTM label has been added.

DetailsGit tree hash: 1a4f3472fabc4da904ca03334725c239e51d4bfc

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mimowo, sohankunkerkar

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [mimowo,sohankunkerkar]

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 merged commit dd5243d into kubernetes-sigs:release-0.19 Sep 9, 2026
61 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants