Skip to content

Fix --dry-run flag ignored in kueuectl resume/stop localqueue and clusterqueue - #12617

Merged
kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
carterpewpew:fix/dry-run-localqueue-clusterqueue
Jun 29, 2026
Merged

kubernetes-prow[bot] merged 1 commit into
kubernetes-sigs:mainfrom
carterpewpew:fix/dry-run-localqueue-clusterqueue

Conversation

@carterpewpew

@carterpewpew carterpewpew commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

The --dry-run flag is registered as a PersistentFlag on the parent resume and stop commands, making it available to all subcommands including localqueue and clusterqueue. However, these subcommands ignored the flag entirely, always performing the server-side Patch regardless of --dry-run=client or --dry-run=server.

This PR brings LocalQueue and ClusterQueue handling in line with the existing Workload implementation in UpdateWorkloadActivationOptions, which correctly gates the Patch call on DryRunStrategy:

  • --dry-run=client: skip the Patch call entirely, print the locally-modified object.
  • --dry-run=server: pass DryRun: []string{metav1.DryRunAll} to PatchOptions.
  • --dry-run=none (default): behavior is unchanged.

Which issue(s) this PR fixes:

Fixes #12565

Special notes for your reviewer:

The fix applies the identical pattern across 4 files (resume_localqueue.go, resume_clusterqueue.go, stop_localqueue.go, stop_clusterqueue.go). Each change is structurally the same:

  1. Add DryRunStrategy dryrun.Strategy field to the options struct.
  2. Resolve the strategy in Complete() via dryrun.GetStrategy(cmd) and dryrun.PrintFlagsWithStrategy().
  3. Gate the Patch() call in Run() behind o.DryRunStrategy != dryrun.Client, and set opts.DryRun for server-side dry-run.
  4. The Complete() parameter order follows the existing codebase convention (clientGetter, cmd, args).
    Integration tests cover both --dry-run=client and --dry-run=server for all four affected subcommands.

Does this PR introduce a user-facing change?

CLI: Fix --dry-run flag being silently ignored in kueuectl resume/stop localqueue and clusterqueue subcommands.

Summary by CodeRabbit

  • New Features

    • Added --dry-run support to kueuectl resume and kueuectl stop for both LocalQueue and ClusterQueue commands.
    • Dry-run behavior now respects client-side and server-side modes while keeping command output consistent.
  • Tests

    • Added integration coverage to verify queues remain unchanged when stop/resume is run with dry-run enabled.

…sterqueue

The --dry-run flag is registered on the parent resume/stop commands via
flags.AddDryRunFlag as a PersistentFlag, making it available to all
subcommands. However, the LocalQueue and ClusterQueue subcommands
ignored this flag entirely, always performing the server-side Patch
regardless of the user's --dry-run=client or --dry-run=server setting.

This brings LocalQueue and ClusterQueue handling in line with the
existing Workload implementation in UpdateWorkloadActivationOptions,
which correctly gates the Patch call on DryRunStrategy.

For --dry-run=client: skip the Patch call entirely.
For --dry-run=server: pass DryRun: []string{metav1.DryRunAll} to PatchOptions.
For --dry-run=none (default): behavior is unchanged.

Signed-off-by: Jathavedhan M <jathavedhan.m@ibm.com>
@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 Jun 29, 2026
@netlify

netlify Bot commented Jun 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for kubernetes-sigs-kueue ready!

Name Link
🔨 Latest commit 4707722
🔍 Latest deploy log https://app.netlify.com/projects/kubernetes-sigs-kueue/deploys/6a41f65f3c23020008e97d46
😎 Deploy Preview https://deploy-preview-12617--kubernetes-sigs-kueue.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubernetes-prow

Copy link
Copy Markdown

Hi @carterpewpew. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 29, 2026
@kubernetes-prow
kubernetes-prow Bot requested review from PBundyra and mimowo June 29, 2026 04:36
@coderabbitai

coderabbitai Bot commented Jun 29, 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

Run ID: c312c58e-1dd8-4c7d-85bd-18c5a0ba881b

📥 Commits

Reviewing files that changed from the base of the PR and between 9e54a79 and 4707722.

📒 Files selected for processing (6)
  • cmd/kueuectl/app/resume/resume_clusterqueue.go
  • cmd/kueuectl/app/resume/resume_localqueue.go
  • cmd/kueuectl/app/stop/stop_clusterqueue.go
  • cmd/kueuectl/app/stop/stop_localqueue.go
  • test/integration/singlecluster/kueuectl/resume_test.go
  • test/integration/singlecluster/kueuectl/stop_test.go

📝 Walkthrough

Walkthrough

Adds --dry-run support to kueuectl stop and kueuectl resume for ClusterQueue and LocalQueue. Each command's Complete method now resolves a DryRunStrategy from the Cobra command; Run skips the Kubernetes patch for client dry-run and sets DryRunAll for server dry-run. Integration tests verify no state mutation occurs under both strategies.

Changes

Dry-run support for stop/resume commands

Layer / File(s) Summary
resume ClusterQueue and LocalQueue dry-run wiring
cmd/kueuectl/app/resume/resume_clusterqueue.go, cmd/kueuectl/app/resume/resume_localqueue.go
Adds DryRunStrategy field to options structs, updates Complete to accept *cobra.Command and parse the strategy via dryrun.GetStrategy, applies dryrun.PrintFlagsWithStrategy, and gates the merge-patch call on the resolved strategy in Run.
stop ClusterQueue and LocalQueue dry-run wiring
cmd/kueuectl/app/stop/stop_clusterqueue.go, cmd/kueuectl/app/stop/stop_localqueue.go
Same pattern applied to the stop commands: DryRunStrategy field, updated Complete signature and strategy resolution, and conditional patch execution with metav1.DryRunAll for server mode.
Integration tests for --dry-run no-op behavior
test/integration/singlecluster/kueuectl/resume_test.go, test/integration/singlecluster/kueuectl/stop_test.go
Adds DescribeTable tests parameterized over client and server strategies; each creates a queue, runs the command with --dry-run, and uses gomega.Consistently to assert Spec.StopPolicy is unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Suggested labels

area/testing

Suggested reviewers

  • mbobrovskyi
  • mimowo
  • tenzen-y

Poem

🐇 Hop, hop, no patch shall fly,
When --dry-run waves its flag up high!
ClusterQueue and LocalQueue stay,
Untouched through client and server's way.
The rabbit checks twice, then skips the call —
Dry-run is safe now, no changes at all! 🎉

🚥 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing ignored --dry-run handling in kueuectl resume/stop for localqueue and clusterqueue.
Linked Issues check ✅ Passed The changes implement the requested dry-run handling for resume localqueue: they read the strategy, skip client-side patching, and set server-side dry-run options.
Out of Scope Changes check ✅ Passed The stop-command updates and integration tests align with the stated broader objective and do not appear unrelated to the dry-run fix.
✨ 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.

@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jun 29, 2026
@pajakd

pajakd commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

@kubernetes-prow kubernetes-prow Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 29, 2026
@mimowo

mimowo commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

/lgtm
/approve
Thank you for fixing Kueuectl 👍

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

Copy link
Copy Markdown

LGTM label has been added.

DetailsGit tree hash: d6f4db0ba30fb1367f88acfc2b16cf6134723569

@mimowo

mimowo commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

/cherrypick release-0.18
/cherrypick release-0.17

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

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

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:

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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 29, 2026
@k8s-infra-cherrypick-robot

Copy link
Copy Markdown
Contributor

@mimowo: once the present PR merges, I will cherry-pick it on top of release-0.17, release-0.18 in new PRs and assign them to you.

Details

In response to this:

/cherrypick release-0.18
/cherrypick release-0.17

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 merged commit 571fa9b into kubernetes-sigs:main Jun 29, 2026
55 checks passed
@kubernetes-prow kubernetes-prow Bot added this to the v0.19 milestone Jun 29, 2026
@k8s-infra-cherrypick-robot

Copy link
Copy Markdown
Contributor

@mimowo: new pull request created: #12624

Details

In response to this:

/cherrypick release-0.18
/cherrypick release-0.17

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.

@k8s-infra-cherrypick-robot

Copy link
Copy Markdown
Contributor

@mimowo: new pull request created: #12627

Details

In response to this:

/cherrypick release-0.18
/cherrypick release-0.17

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.

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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

kueuectl resume localqueue ignores --dry-run flag leading to unintended state mutation in cmd/kueuectl/app/resume/resume_localqueue.go

5 participants