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

Design doc for RestoreItemAction wait for AdditionalItems to be ready #2867

Merged
merged 1 commit into from Nov 19, 2020

Conversation

sseago
Copy link
Collaborator

@sseago sseago commented Aug 26, 2020

Design for #1350


## Background

Because Velero does not wait after restoring additoonal items to
Copy link
Contributor

Choose a reason for hiding this comment

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

s/additioonal/additional

@sseago
Copy link
Collaborator Author

sseago commented Sep 1, 2020

I'm going to update this shortly with a third implementation option which should get rid of the need for making interface changes. Instead of adding a new func to either an existing or new interface, we could replace the WaitForAdditionalItems bool in my proposed changes to RestoreItemActionExecuteOutput with AdditionalItemsReadyFunc which would be a pointer to a func. If a plugin ignores it (as would any pre-existing plugins), it remains nil and velero doesn't attempt to wait. If a plugin needs to wait for AdditionalItems to be ready, instead of setting an entry in the return struct to 'true', it will return a func pointer, which will be the func that velero's restoreItem func will call in its wait method rather than a named interface func. This will remove the need for existing plugins to have to make changes here without introducing optional interfaces.

@nrb
Copy link
Contributor

nrb commented Sep 2, 2020

Thanks @sseago! I know you're working on this, so I'm likely to review after the v1.5.0 release and you're a little further along. I'll also be on vacation from Sept 4 to Sept 14th, so it's probably going to be after that, just to set expectations.

One question I do have - are you/your team able to sign up for implementation of this once approved?

@sseago
Copy link
Collaborator Author

sseago commented Sep 2, 2020

@nrb Yes, my plan was to put together a PR to implement this once we got sign-off on the design. I expect one more update to the design before it's ready to review -- to propose a third alternative which I think will eliminate both the backwards-compatibilty problem and the need to define a new optional interface, as I mention in the above comment. I may get to it today, or tomorrow at the latest. Either way I assume your current priority is getting 1.5.0 out the door.

@sseago sseago force-pushed the additionalitems-design branch 2 times, most recently from a294d15 to 19d83ad Compare September 3, 2020 20:25
Copy link
Contributor

@nrb nrb left a comment

Choose a reason for hiding this comment

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

So far I think this is reasonable.

I like the idea of making the AdditionalItemsReadyFunc a pointer so that not all RestoreItemAction plugins have to implement it.

I do still have a few questions on specific areas, and would like to hear from the rest of @vmware-tanzu/velero-maintainers

design/wait-for-additional-items.md Show resolved Hide resolved
design/wait-for-additional-items.md Show resolved Hide resolved
design/wait-for-additional-items.md Show resolved Hide resolved
@sseago
Copy link
Collaborator Author

sseago commented Sep 30, 2020

Updated with the WithItemsWait func definition added to the document.

@nrb
Copy link
Contributor

nrb commented Nov 2, 2020

@vmware-tanzu/velero-maintainers Please give this a review.

@nrb nrb added this to In progress in v1.6.0 via automation Nov 2, 2020
@nrb nrb moved this from In progress to Review in progress in v1.6.0 Nov 2, 2020
Copy link
Contributor

@ashish-amarnath ashish-amarnath left a comment

Choose a reason for hiding this comment

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

@sseago Thanks for this proposal and apologies for not looking at this sooner.
I added a couple of comments. PTAL. Happy to discuss further either in the PR or in a separate design meeting. I can schedule a design meeting if that is preferred.

design/wait-for-additional-items.md Show resolved Hide resolved
https://github.com/vmware-tanzu/velero/blob/main/pkg/restore/restore.go#L623
This func should also be defined within restore.go

Instead of the one minute CRD timeout, we'll use
Copy link
Contributor

Choose a reason for hiding this comment

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

resourceTerminatingTimeout is not meant to be used for this purpose. Suggest creating a different constant/config for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree that a different method of determining it would be better. I didn't include that in the design as I wasn't sure what made more sense. We can include it as a restore option as suggested above, although we'll need to provide a sensible default (perhaps via a new const). We could also allow plugin-level overriding, but it's not obvious whether or not we need that additional complexity and if we add it, what the priority would be for using. Perhaps first priority is to use the value set on the restore CR, if provided. Then plugin-level value (in the plugin RestoreItemExecuteOutput struct), and if both are empty, use something defined in a const.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'm missing something but what would it look like for the timeout value to be configurable at the plugin level? Is it possible under the current plugin model for specific configuration to be passed in when the plugins are being added? Or did you mean that different plugins would define how long they would wait but it would be a fixed duration?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So one way to do it which avoids having to change any existing plugins that don't need the new functionality is to add an additional (optional) timeout field to the RestoreItemActionExecuteOutput struct. When the Execute func returns, it could add this from a const defined within the plugin implementation. We already have one field we're adding to this struct to define the "wait for ready" func, and based on recent review comments, we may be adding another bool field which velero will use to decide whether to wait at all for this plugin (instead of overloading the func return value for this, to allow for a default "does Get return it?" implementation. That's what I was considering for the next update.

Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a timeout field in the RestoreItemActionExecuteOutput with a new const for a default seems reasonable to me.

Copy link
Contributor

@ashish-amarnath ashish-amarnath left a comment

Choose a reason for hiding this comment

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

This LGTM.
The only pending comment is about adding a timeout field in the RestoreItemActionExecuteOutput struct.

https://github.com/vmware-tanzu/velero/blob/main/pkg/restore/restore.go#L623
This func should also be defined within restore.go

Instead of the one minute CRD timeout, we'll use
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a timeout field in the RestoreItemActionExecuteOutput with a new const for a default seems reasonable to me.

design/wait-for-additional-items.md Show resolved Hide resolved
design/wait-for-additional-items.md Show resolved Hide resolved
design/wait-for-additional-items.md Show resolved Hide resolved
design/wait-for-additional-items.md Show resolved Hide resolved
@sseago
Copy link
Collaborator Author

sseago commented Nov 13, 2020

@ashish-amarnath I've updated the timeout section to include a new server-wide value specified in serverConfig.additionalItemsReadyTimeout (with a default const), as well as a plugin-level override value as an optional field in RestoreItemActionExecuteOutput.

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

@zubron zubron 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 your time and effort on this, @sseago! I think this proposed design looks good and I don't have any additional questions or comments. Thanks for addressing them all! 👍

Copy link
Contributor

@ashish-amarnath ashish-amarnath left a comment

Choose a reason for hiding this comment

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

This LGTM! Thanks for addressing the comments.
Leaving the merge to @nrb

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 lgtm. Deferring to @nrb.

Copy link
Contributor

@nrb nrb 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 your effort and patience on this @sseago!

v1.6.0 automation moved this from Review in progress to Reviewer approved Nov 19, 2020
@nrb nrb merged commit b876dd9 into vmware-tanzu:main Nov 19, 2020
v1.6.0 automation moved this from Reviewer approved to Done Nov 19, 2020
georgettica pushed a commit to georgettica/velero that referenced this pull request Dec 23, 2020
georgettica pushed a commit to georgettica/velero that referenced this pull request Jan 26, 2021
vadasambar pushed a commit to vadasambar/velero that referenced this pull request Feb 3, 2021
dharmab pushed a commit to dharmab/velero that referenced this pull request May 25, 2021
ywk253100 pushed a commit to ywk253100/velero that referenced this pull request Jun 29, 2021
gyaozhou pushed a commit to gyaozhou/velero-read that referenced this pull request May 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Design Design Documents
Projects
No open projects
v1.6.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants