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

Adds support for allowing a RestoreItemAction to skip item restore #1336

Merged
merged 3 commits into from
Apr 4, 2019

Conversation

sseago
Copy link
Collaborator

@sseago sseago commented Mar 31, 2019

Fixes #1335

Adds support for allowing a RestoreItemAction to skip item restore

This allows a RestoreItemAction plugin to signal to velero that
the returned item should be skipped rather than restored to the
cluster.

To support this, a boolean SkipRestore attribute is added to
RestoreItemActionExecuteOutput. If restore.restoreResource finds
this set to true, any remaining actions on this item are skipped,
and restore on this item is skipped. Execution continues with
the next item of this resource type.

To signal this for a particular item, the RestoreItemAction's
Execute method should call WithoutRestore() on the
RestoreItemActionExecuteOutput before returning it.

The autogenerated code may need to be redone. I don't know if I'm using the wrong protoc version or missing a flag of some sort, because it changed a lot more than just around the code changes for this PR.

sseago added a commit to sseago/velero that referenced this pull request Mar 31, 2019
Signed-off-by: Scott Seago <sseago@redhat.com>
@sseago
Copy link
Collaborator Author

sseago commented Mar 31, 2019

Addresses #1335

@sseago
Copy link
Collaborator Author

sseago commented Apr 1, 2019

In our velero fork repo, instead of the full "Autogenerated code to support SkipRestore" commit, I applied a much smaller commit, basically just taking the subset of protoc-generated output that was relevant to my code changes. Instead of a bunch of changes across several files, it only modifies one file, adding SkipRestore to type RestoreItemActionExecuteResponse, and adding func (m *RestoreItemActionExecuteResponse) GetSkipRestore() bool while discarding all the other changes from hack/generate-proto.sh. So far everything seems to work with this more limited commit, but I wasn't sure which approach was recommended

Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @sseago! Generally looks reasonable to me. I recall someone else having similar issues when updating proto - one note is that you need to use the protoc plugin protoc-gen-go v1.0.0 -- which is not the latest version. These instructions may help. Separately, we should probably both containerize and update the go plugin for proto updates.

@carlisia, please take a look as well.

pkg/plugin/framework/restore_item_action_server.go Outdated Show resolved Hide resolved
pkg/plugin/framework/restore_item_action_server.go Outdated Show resolved Hide resolved
pkg/plugin/velero/restore_item_action.go Show resolved Hide resolved
@skriss
Copy link
Member

skriss commented Apr 2, 2019

Output of protoc --version for me:

libprotoc 3.6.1

@skriss
Copy link
Member

skriss commented Apr 2, 2019

I did a quick proto update with the field you added - you can grab skriss@2293e00 if that's easier

@sseago
Copy link
Collaborator Author

sseago commented Apr 3, 2019

@skriss Looks like grabbing protoc-gen-go v1.0.0 was all I needed. My proto output now matches the one you linked above.

This allows a RestoreItemAction plugin to signal to velero that
the returned item should be skipped rather than restored to the
cluster.

To support this, a boolean SkipRestore attribute is added to
RestoreItemActionExecuteOutput. If restore.restoreResource finds
this set to true, any remaining actions on this item are skipped,
and restore on this item is skipped. Execution continues with
the next item of this resource type.

To signal this for a particular item, the RestoreItemAction's
Execute method should call WithoutRestore() on the
RestoreItemActionExecuteOutput before returning it.

Signed-off-by: Scott Seago <sseago@redhat.com>
Signed-off-by: Scott Seago <sseago@redhat.com>
Signed-off-by: Scott Seago <sseago@redhat.com>
@sseago sseago force-pushed the abandon-item-restore-upstream branch from a8a53c2 to 666d5a2 Compare April 3, 2019 20:31
@sseago
Copy link
Collaborator Author

sseago commented Apr 3, 2019

I've made the suggested changes and fixed the generated code output.

Copy link
Contributor

@carlisia carlisia left a comment

Choose a reason for hiding this comment

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

This looks good, very useful 👍

Copy link
Member

@skriss skriss left a comment

Choose a reason for hiding this comment

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

LGTM. @carlisia, note we should do another update to the plugin-example repo to capture this.

@skriss skriss merged commit a519547 into vmware-tanzu:master Apr 4, 2019
jessestuart pushed a commit to jessestuart/velero that referenced this pull request May 28, 2019
…mware-tanzu#1336)

* Adds support for allowing a RestoreItemAction to skip item restore

This allows a RestoreItemAction plugin to signal to velero that
the returned item should be skipped rather than restored to the
cluster.

To support this, a boolean SkipRestore attribute is added to
RestoreItemActionExecuteOutput. If restore.restoreResource finds
this set to true, any remaining actions on this item are skipped,
and restore on this item is skipped. Execution continues with
the next item of this resource type.

To signal this for a particular item, the RestoreItemAction's
Execute method should call WithoutRestore() on the
RestoreItemActionExecuteOutput before returning it.

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

* Autogenerated code to support SkipRestore

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

* Added changelog for vmware-tanzu#1336

Signed-off-by: Scott Seago <sseago@redhat.com>
nrb added a commit to nrb/velero that referenced this pull request Apr 28, 2021
Scott Seago has made a lot of contributions to Velero, including in
testing, coding, and design.

Some examples of his contributions include a [design for plugin
improvements](https://github.com/vmware-tanzu/velero/blob/main/design/wait-for-additional-items.md),
[added skip support to
RestoreItemActions](vmware-tanzu#1336),
and [reporting important
issues](vmware-tanzu#2948).

He's also been active in the community meetings for the last few years,
and has had thoughtful feedback.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
nrb added a commit to nrb/velero that referenced this pull request Apr 28, 2021
Scott Seago has made a lot of contributions to Velero, including in
testing, coding, and design.

Some examples of his contributions include a [design for plugin
improvements](https://github.com/vmware-tanzu/velero/blob/main/design/wait-for-additional-items.md),
[added skip support to
RestoreItemActions](vmware-tanzu#1336),
and [reporting important
issues](vmware-tanzu#2948).

He's also been active in the community meetings for the last few years,
and has had thoughtful feedback.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
@nrb nrb mentioned this pull request Apr 28, 2021
3 tasks
dsu-igeek pushed a commit that referenced this pull request Apr 29, 2021
* Propose Scott Seago as a maintainer

Scott Seago has made a lot of contributions to Velero, including in
testing, coding, and design.

Some examples of his contributions include a [design for plugin
improvements](https://github.com/vmware-tanzu/velero/blob/main/design/wait-for-additional-items.md),
[added skip support to
RestoreItemActions](#1336),
and [reporting important
issues](#2948).

He's also been active in the community meetings for the last few years,
and has had thoughtful feedback.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Fix up file assignments

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
ywk253100 pushed a commit to ywk253100/velero that referenced this pull request Jun 29, 2021
* Propose Scott Seago as a maintainer

Scott Seago has made a lot of contributions to Velero, including in
testing, coding, and design.

Some examples of his contributions include a [design for plugin
improvements](https://github.com/vmware-tanzu/velero/blob/main/design/wait-for-additional-items.md),
[added skip support to
RestoreItemActions](vmware-tanzu#1336),
and [reporting important
issues](vmware-tanzu#2948).

He's also been active in the community meetings for the last few years,
and has had thoughtful feedback.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Fix up file assignments

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
gyaozhou pushed a commit to gyaozhou/velero-read that referenced this pull request May 14, 2022
* Propose Scott Seago as a maintainer

Scott Seago has made a lot of contributions to Velero, including in
testing, coding, and design.

Some examples of his contributions include a [design for plugin
improvements](https://github.com/vmware-tanzu/velero/blob/main/design/wait-for-additional-items.md),
[added skip support to
RestoreItemActions](vmware-tanzu#1336),
and [reporting important
issues](vmware-tanzu#2948).

He's also been active in the community meetings for the last few years,
and has had thoughtful feedback.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Fix up file assignments

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants