Repository navigation
Conversation
velero schedule get, velero schedule describe, velero schedule pause/unpause and velero repo get built a ctrlclient.ListOptions with a LabelSelector but no Namespace, so the list ran across every namespace in the cluster. Their single-name paths in the same functions already scope to f.Namespace(), and every sibling command (backup get, restore get, backup describe, restore describe, snapshot-location get, schedule delete) passes Namespace too, so the omission was an oversight rather than intent. The read commands print another installation's Schedules and BackupRepositories. runPause is worse: velero schedule pause --all and velero schedule unpause --all fetch Schedules from every namespace and then write Spec.Paused on each, so pausing one installation's schedules pauses every other installation's schedules as well. Add Namespace: f.Namespace() to the four List calls: pkg/cmd/cli/schedule/get.go:61 pkg/cmd/cli/schedule/describe.go:59 pkg/cmd/cli/schedule/pause.go:114 pkg/cmd/cli/repo/get.go:61 Neither pkg/cmd/cli/schedule nor pkg/cmd/cli/repo had any tests, so the regression tests are new files. Each seeds a fake client with one object in the Velero namespace and one in another-velero, and asserts the second is neither listed, described, nor paused. Signed-off-by: Max Freedom Pollard <[email protected]>
👷 Deploy request for velero pending review.Visit the deploys page to approve it
|
Signed-off-by: Max Freedom Pollard <[email protected]>
blackpiglet
approved these changes
Sep 7, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
sseago
approved these changes
Sep 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please add a summary of your change
velero schedule get,velero schedule describe,velero schedule pause,velero schedule unpauseandvelero repo getlist across every namespace in the cluster instead of the Velero namespace. Each of them builds actrlclient.ListOptionsthat carries aLabelSelectorand noNamespace:pkg/cmd/cli/schedule/get.go:61,pkg/cmd/cli/schedule/describe.go:59,pkg/cmd/cli/schedule/pause.go:115andpkg/cmd/cli/repo/get.go:61.The named-object branch a few lines above each of those already scopes to
f.Namespace()(schedule/get.go:51,schedule/describe.go:49,schedule/pause.go:98,repo/get.go:51), andschedule deletescopes its list atpkg/cmd/cli/schedule/delete.go:101, as dobackup get,restore get,backup describe,restore describeandsnapshot-location get. Sovelero schedule get fooandvelero schedule getdisagree about which namespace they are reading from.On the three read commands the effect is that another installation's Schedules and BackupRepositories appear in the output.
runPausealso writes.velero schedule pause --all -n velerocollects Schedules from every namespace and then setsSpec.Pausedon each one (pause.go:141andpause.go:143), so it pauses the schedules belonging to every other Velero installation in the cluster and printsSchedule <name> paused successfullyfor them.velero schedule unpause --allunpauses them through the same function.The fix is
Namespace: f.Namespace()on those four List calls.Neither
pkg/cmd/cli/schedulenorpkg/cmd/cli/repohad a test file, so the regression tests are new. Each seeds a fake controller-runtime client with one object invelero-testand one inanother-velero, points the factory atvelero-test, and asserts the object inanother-velerois not listed, not described and not paused. All five fail onmain:and pass with the change:
go test ./pkg/cmd/...passes, andgolangci-lint run --config .golangci.yaml ./pkg/cmd/cli/schedule/... ./pkg/cmd/cli/repo/...on v2.12.0 reports nothing.Does your change fix a particular issue?
No issue filed for this one.
Please indicate you've done the following:
make new-changelog) or comment/kind changelog-not-requiredon this PR.site/content/docs/main.