-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 API implementation #5442
Conversation
690a755
to
e0e1e80
Compare
Codecov Report
@@ Coverage Diff @@
## main #5442 +/- ##
==========================================
- Coverage 40.62% 40.43% -0.20%
==========================================
Files 236 240 +4
Lines 20449 20826 +377
==========================================
+ Hits 8308 8421 +113
- Misses 11532 11790 +258
- Partials 609 615 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
4a3b3be
to
ff748cc
Compare
This PR closes #5488 |
my very newb scan of this leaves me w/ just a thought and I don't have a strong opinion here. |
@weshayutin I'm not seeing any funcs named |
updatedItem, additionalItemIdentifiers, err := action.Execute(obj, ib.backupRequest.Backup) | ||
// Note: we're ignoring the operationID returned from Execute for now, it will be used | ||
// with the async plugin action implementation | ||
updatedItem, additionalItemIdentifiers, _, err := action.Execute(obj, ib.backupRequest.Backup) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the Execute
method is called, the method may return in a short time but the async operation is still ongoing.
As to the backup workflow, I guess the caller needs to call the Progress
method to wait the completion of the async operation.
For different items in the same backup, multiple Execute
methods may be called successively before their async operations complete, so before the backup workflow ends, multiple async operations should be waited for completion.
Will we handle this logic in the current PR or we do it in later PRs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Lyndon-Li This PR is just the API definition. It adds the appropriate functions to the various BackupItemAction-related packages. Implmeenting the controller workflow changes to actually call Progress, wait, maintain a list of items waited for, etc. will be implemented in a separate PR (there's a separate github issue to track that work).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 @sseago
biav2 "github.com/vmware-tanzu/velero/pkg/plugin/velero/backupitemaction/v2" | ||
) | ||
|
||
// AdaptedBackupItemAction is a backup item action adapted to the v1 BackupItemAction API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v1->v2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll reword it to make it clearer. "is a v1 BackupItemAction adapted to implement the v2 API"
} | ||
|
||
// Execute restarts the plugin's process if needed, then delegates the call. | ||
func (r *RestartableBackupItemAction) Execute(item runtime.Unstructured, backup *api.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, string, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking of some plugin process restart cases:
- If the plugin process quits unexpectedly (i.e. crash) during a method calling, the call will fail on the client side, so the backup/restore will fail because of the BIA/RIA method fails. Is that right?
- Since the plugin runs some async operations, the plugin may quit outside a method calling, for example, the
Execute
method returns successfully but during running the async operation afterwards, the plugin crashes. In this case, I think the client side gets no notification from the plugin framework, but the specific BIA/RIA implementation needs to tell the caller during the later method calling (i.e.,Progress
method) if it wants to fail the current backup/restore? Or if we want the plugin implementation has the ability to recover from the quit, what is it like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It should result in a partial failure, as the GRPC call itself will error out, but that's not any different from what happens with v1 plugins
- If the plugin crashes without restarting, then the Progress method will return an error (similar to the Execute error in your first question), so this will push us to partial failure. If the plugin crashes but restarts, then it's up to the plugin to handle this. For example, for a datamover plugin which creates a separate datamover CR (where the actual async operation happens in a separate controller), a plugin restart after creating the datamover CR won't affect progress, as long as the plugin is running again by the time velero calls Progress next, since it just checks the datamover CR status. If the plugin is itself running the operation in a background thread of the plugin process, then a crash will probably result in an operation failure, so Progress will return an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, either way is allowed, the behavior is up to the specific plugin.
Signed-off-by: Scott Seago <[email protected]>
LGTM ! Thank you @sseago |
Signed-off-by: Scott Seago [email protected]
Thank you for contributing to Velero!
Please add a summary of your change
Does your change fix a particular issue?
Fixes #5488
Please indicate you've done the following:
/kind changelog-not-required
as a comment on this pull request.site/content/docs/main
.