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

[Epic] add support for restore hooks #2116

Closed
marccampbell opened this issue Dec 10, 2019 · 11 comments
Closed

[Epic] add support for restore hooks #2116

marccampbell opened this issue Dec 10, 2019 · 11 comments
Labels
Enhancement/User End-User Enhancement to Velero Epic
Milestone

Comments

@marccampbell
Copy link
Contributor

Describe the problem/challenge you have
When backing up some volumes, we have a pre and post backup hook implemented. This is useful when we have a process that has a lock on a file and we need to copy data between volumes to ensure that the data Velero is backing up will be uncorrupted and usable. But on a restore, there is no hook to execute a pre or post restore script. This makes automating a restore a little difficult because we need to rely on a separate set of tools when restoring vs when backing up.

Describe the solution you'd like
One possible solution to this is to add restore hooks, so they can be specified similar to how backup hooks are specified. If we are restoring data that was collected using a pre-hook, then we could write the reverse post-restore hook in the configuration to put the data back into the format or restart a process.

@skriss skriss added the Enhancement/User End-User Enhancement to Velero label Dec 19, 2019
@konvergence
Copy link

For a postgres dump done with a pre-hook backup : pg_dumpall --clean > ${DATA_FOLDER}/dumpall.out
it will usefull to run a restore post hook to run a psql < ${DATA_FOLDER}/dumpall.out

@konvergence
Copy link

If there was post hook for restore I could use it to restore a dump previously done with pre hook backup.

Example if we have this annotation for pre hook backup

kubectl -n bitamani-postgres-11-hook  annotate pod/postgres-hook-postgresql-0   backup.velero.io/backup-volumes=data --overwrite
kubectl -n bitamani-postgres-11-hook  annotate pod/postgres-hook-postgresql-0 pre.hook.backup.velero.io/timeout=3600s --overwrite
kubectl -n bitamani-postgres-11-hook  annotate pod/postgres-hook-postgresql-0   pre.hook.backup.velero.io/command='["bash", "-c", "mkdir -p /bitnami/postgresql/dumps; eval export PGPASSWORD=${POSTGRES_PASSWORD}; pg_dumpall --clean --username=postgres | gzip -4 > /bitnami/postgresql/dumps/dumpall.out.gz" ]' --overwrite

the following post hook restore could be used to restore the dump

kubectl -n bitamani-postgres-11-hook  annotate pod/postgres-hook-postgresql-0 post.hook.restore.velero.io/timeout=3600s --overwrite
kubectl -n bitamani-postgres-11-hook  annotate pod/postgres-hook-postgresql-0   post.hook.restore.velero.io/command='["bash", "-c", ""bash", "-c", "eval export PGPASSWORD=${POSTGRES_PASSWORD}; cat /bitnami/postgresql/dumps/dumpall.out.gz | gunzip | psql --username=postgres" ]' --overwrite

@nrb
Copy link
Contributor

nrb commented Mar 20, 2020

@skriss @michmike I think this is a good candidate for v1.5; though we allow for backup quiescing, we don't really allow for unquiescing that data, which makes it less than useful in the case of databases, as the OP points out.

@aclevername
Copy link

This is would be really neat, we are also in the same spot as @konvergence where we are planning on using the hooks to trigger the database dump during backup, and would love to be able to automate restore as well

@skriss
Copy link
Contributor

skriss commented Apr 14, 2020

@marccampbell I think we'd definitely like to do this, but it's not currently prioritized. If you're interested in taking the lead on a design proposal, let us know and we can help provide input!

@marccampbell
Copy link
Contributor Author

@skriss i'd love to take the lead on a design proposal for this.

@aclevername
Copy link

@skriss i'd love to take the lead on a design proposal for this.

We (@cloudfoundry-incubator/bosh-backup-and-restore-team) would love to help contribute on this too :)

@skriss
Copy link
Contributor

skriss commented Apr 21, 2020

@marccampbell @aclevername that'd be great!

we have a design docs directory here: https://github.com/vmware-tanzu/velero/tree/master/design

There's a template, as well as all of our existing docs.

I'd recommend first putting up a draft PR with an incomplete design doc that covers goals/non-goals and high-level design, so folks have a chance to comment on those high-level sections before you spend time going into more detail.

@skriss skriss added this to the v1.5 milestone May 28, 2020
@skriss skriss added the Epic label Jun 4, 2020
@skriss skriss changed the title Consider adding support for restore hooks [Epic] add support for restore hooks Jun 4, 2020
stephbman added a commit to stephbman/velero that referenced this issue Jun 22, 2020
@stephbman
Copy link
Contributor

@marccampbell we'll be moving the deep dive out by a few days to mid/late next week. I will send details your way on that.

@michael-niemand
Copy link

I'd appreciate a feature like this as well!

stephbman added a commit that referenced this issue Jul 8, 2020
This file contains the MVP use cases and product requirements tied the Restore Hooks Design Proposal #2465.

This requirements document ties to Epic: #2116
And is related to issue:  #2678
ashish-amarnath pushed a commit that referenced this issue Jul 24, 2020
This file contains the MVP use cases and product requirements tied the Restore Hooks Design Proposal #2465.

This requirements document ties to Epic: #2116
And is related to issue:  #2678

Signed-off-by: Stephane Bauman <bstephanie@vmware.com>
ashish-amarnath pushed a commit that referenced this issue Jul 24, 2020
This file contains the MVP use cases and product requirements tied the Restore Hooks Design Proposal #2465.

This requirements document ties to Epic: #2116
And is related to issue:  #2678

Signed-off-by: Stephane Bauman <bstephanie@vmware.com>1
ashish-amarnath added a commit that referenced this issue Jul 24, 2020
This file contains the MVP use cases and product requirements tied the Restore Hooks Design Proposal #2465.

This requirements document ties to Epic: #2116
And is related to issue:  #2678

Signed-off-by: Stephane Bauman <bstephanie@vmware.com>
Co-authored-by: Ashish Amarnath <ashisham@vmware.com>
ashish-amarnath added a commit that referenced this issue Jul 24, 2020
This file contains the MVP use cases and product requirements tied the Restore Hooks Design Proposal #2465.

This requirements document ties to Epic: #2116
And is related to issue:  #2678

Signed-off-by: Stephanie Bauman <bstephanie@vmware.com>
Co-authored-by: Ashish Amarnath <ashisham@vmware.com>
@nrb
Copy link
Contributor

nrb commented Sep 17, 2020

Closing issue with the release of v1.5.1

@nrb nrb closed this as completed Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement/User End-User Enhancement to Velero Epic
Projects
None yet
Development

No branches or pull requests

7 participants