continue rather than return for non-matching restore action label #4890
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.
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 therestoreItem
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:
/kind changelog-not-required
as a comment on this pull request.site/content/docs/main
.