Skip to content

fix(controller): propagate context during backup request preparation - #10621

Open
abhayrajjais01 wants to merge 1 commit into
velero-io:mainfrom
abhayrajjais01:fix/backup-request-context
Open

abhayrajjais01 wants to merge 1 commit into
velero-io:mainfrom
abhayrajjais01:fix/backup-request-context

Conversation

@abhayrajjais01

Copy link
Copy Markdown
Contributor

Please add a summary of your change

In pkg/controller/backup_controller.go, prepareBackupRequest receives a ctx context.Context parameter from the reconciler, but was passing context.Background() when:

  • Listing backup storage locations (storage.ListBackupStorageLocations)
  • Getting the backup storage location (b.kbClient.Get)
  • Listing excluded namespaces (b.kbClient.List)
  • Validating and getting volume snapshot locations (validateAndGetSnapshotLocations)

This change:

  1. Passes the caller's ctx through all cluster API calls during backup request preparation and snapshot location validation.
  2. Adds a unit test case to TestValidateAndGetSnapshotLocations verifying that context cancellation is properly honored.

Does your change fix a particular issue?

Fixes #10620

Please indicate you've done the following:

@abhayrajjais01
abhayrajjais01 requested a review from a team as a code owner October 2, 2026 11:24
@netlify

netlify Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

👷 Deploy request for velero pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit ad68403

Pass caller-provided context.Context through cluster API queries during backup request preparation and snapshot location validation, ensuring context cancellation and deadlines are properly respected.

Closes velero-io#10620

Signed-off-by: Abhayraj Jaiswal <abhayraj916146@gmail.com>
@abhayrajjais01
abhayrajjais01 force-pushed the fix/backup-request-context branch from 627aede to ad68403 Compare October 2, 2026 11:25
@codecov

codecov Bot commented Oct 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/controller/backup_controller.go 75.00% 0 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@Joeavaikath Joeavaikath left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is similar context threading to #10605, lgtm!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Context is not propagated during backup request preparation in backup controller

2 participants