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

BackupItemAction v2 design #5382

Merged
merged 1 commit into from
Dec 8, 2022
Merged

BackupItemAction v2 design #5382

merged 1 commit into from
Dec 8, 2022

Conversation

sseago
Copy link
Collaborator

@sseago sseago commented Sep 22, 2022

This includes necessary changes to support async item action monitoring.

This includes the design for the BackupItemAction v2 API which is to be implemented in the Velero 1.11 dev cycle.

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.

@sseago
Copy link
Collaborator Author

sseago commented Sep 22, 2022

/kind changelog-not-required

@github-actions github-actions bot added the Area/Design Design Documents label Sep 22, 2022
@github-actions github-actions bot added the kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes label Sep 22, 2022
@blackpiglet blackpiglet added kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes and removed kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes labels Sep 23, 2022
@sseago
Copy link
Collaborator Author

sseago commented Sep 26, 2022

I'm going to update this to use the google.protobuf.Empty predefined type rather than defining my own empty message type.

@Lyndon-Li
Copy link
Contributor

Can we also consider this change in BIA V2 #5274?

@sseago
Copy link
Collaborator Author

sseago commented Sep 30, 2022

@Lyndon-Li I commented on the issue you linked -- it's not clear to me what you'd like added to the interface, but if we can identify the changes required, I can include them in this design (and in the RestoreItemAction v2 design).

@sseago
Copy link
Collaborator Author

sseago commented Oct 11, 2022

Working through a draft implementation of this, I realized that I'm missing a couple fields in the OperationProgress struct as specified in the item action progress monitoring design. I'll update this PR shortly.

This includes necessary changes to support async item action monitoring.

Signed-off-by: Scott Seago <[email protected]>
@sseago
Copy link
Collaborator Author

sseago commented Dec 6, 2022

Now that the overall design changes have been approved, this PR is ready for review.

@weshayutin
Copy link
Contributor

@dsu-igeek @ywk253100 @blackpiglet @qiuming-best @Lyndon-Li @reasonerjt Please review as time permits, thank you!

rpc AppliesTo(BackupItemActionAppliesToRequest) returns (BackupItemActionAppliesToResponse);
rpc Execute(ExecuteRequest) returns (ExecuteResponse);
rpc Progress(BackupItemActionProgressRequest) returns (BackupItemActionProgressResponse);
rpc Cancel(BackupItemActionCancelRequest) returns (google.protobuf.Empty);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm new to this, but is it a common pattern to use google.protobuf.Empty for golang's error type?
Is it documented somewhere? I tried to quickly search but not found a good reference.

Will this cause information loss if the func in plugin implementation returns an error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@reasonerjt "empty" isn't for error. The golang api has no return value other than the error that all api funcs have, but the protobuf infrastructure requires something. Empty is just a standard way of doing this vs. creating a custom struct with no elements in it. Note that none of the protobuf definitions include the error return in the protobuf signature, but the corresponding golang apis (in pkg/plugin/velero) have the error return.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I noticed that.

I think we need to understand if this causes problems like the info in the error returned by plugin code is propagated correctly to the client, and that's beyond the scope of this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The error return isn't covered by this for any of the methods. If you compare this to AppliesTo or Execute, you'll see that those repsonse messages include everything but the error return. Compare to the golang files in pkg/plugin/generated for the existing v1 API code and you'll see the error resposes there.

Basically the actual grpc Invoke call puts the input and output structs as args to Invoke, and error is returned by Invoke. So the protobuf output structs don't include their error returns since that's a separate return from invoke, and the error is added to the generated golang funcs for all of the api methods.

@Lyndon-Li Lyndon-Li self-requested a review December 8, 2022 02:11
@sseago sseago merged commit 09098f8 into vmware-tanzu:main Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Design Design Documents area/progress-monitoring kind/changelog-not-required PR does not require a user changelog. Often for docs, website, or build changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants