Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

continue rather than return for non-matching restore action label #4890

Merged
merged 1 commit into from
May 9, 2022

Conversation

sseago
Copy link
Collaborator

@sseago sseago commented May 5, 2022

When iterating over applicable restore actions, if a non-matching label
selector is found, velero should continue to the next action rather than
returning from the restoreItem func, which ends up preventing the item's
restore entirely.

Signed-off-by: Scott Seago sseago@redhat.com

Thank you for contributing to Velero!

Please add a summary of your change

When restore was refactored to add additionalItems a few years ago, a bug was introduced. At the beginning of each run through the loop that executes RestoreItemActions, there's a label selector check. The previous code had a continue call for non-matching labels, meaning that the action would be skipped, moving on to the next. The refactored code returns from the restoreItem func instead, meaning that a single action for the resource with a non-matching label selector included will prevent restore from happening at all. This fix restores the correct behavior.

Does your change fix a particular issue?

Fixes #(issue)

Please indicate you've done the following:

  • [x ] Accepted the DCO. Commits without the DCO will delay acceptance.
  • [x ] Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

When iterating over applicable restore actions, if a non-matching label
selector is found, velero should continue to the next action rather than
returning from the restoreItem func, which ends up preventing the item's
restore entirely.

Signed-off-by: Scott Seago <sseago@redhat.com>
Copy link
Contributor

@reasonerjt reasonerjt left a comment

Choose a reason for hiding this comment

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

Thanks @sseago !

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.

None yet

4 participants