-
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
Support both pre and post backup hooks #243
Conversation
Odd that GitHub closed this, since all I did was force-push to my branch in my fork. Reopening. |
@@ -0,0 +1,102 @@ | |||
/* | |||
Copyright 2017 Heptio Inc. |
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.
Should probably update the copyright year now
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.
Heh, I originally wrote this in 2017 for KubeCon.
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.
code LGTM, just one nit on a comment. Didn't review the unit test changes in detail yet but looks good to continue with docs.
pkg/backup/group_backupper.go
Outdated
// These constants represent the relative priorities for resources in the core API group. We want to | ||
// ensure that we process pods, then pvcs, then pvs, then anything else. This ensures that when a | ||
// pod is backed up, we can perform a pre hook, then process pvcs and pvs (including taking a | ||
// snapshotService), then perform a post hook on the pod. |
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.
snapshotService -> snapshot
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.
Yay autocomplete. Thanks for catching.
Signed-off-by: Andy Goldstein <[email protected]>
Now w/updated docs. |
hooks: | ||
# Same content as pre below. |
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.
did you intend to fill this in or just leave it as a ref?
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.
Ref, unless you want it filled in?
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'm fine as-is.
# An array of hooks to run after all custom actions and additional items have been | ||
# processed. Currently only "exec" hooks are supported. | ||
post: | ||
# Same content as pre above. |
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.
did you intend to fill this in or just leave it as a ref?
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.
Ref, unless you want it filled in?
itself, and in the Backup spec. | ||
when that pod is being backed up. | ||
|
||
Ark versions prior to v0.7.0 only support hooks that execute prior to any custom action processing |
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 think it might be helpful to add an end-to-end outline of the steps in the backup process: first run pre hooks, then run custom actions one by one, backing up any additional items returned before moving on to the next custom action, then run post hooks, then add the item to the tarball. This would help users see the overall process and exactly where hooks fit in, which might be helpful if they're not intimately familiar with how the process proceeds.
I wonder if longer-term we should try to write out full-length docs describing in some detail how the backup and restore operations proceed. That might be helpful, but not necessary for now. cc @Bradamant3
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.
SGTM, but let's do it in another PR.
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.
OK.
None here. LMK when to squash the code review commit. |
No squashing needed here, looks good to merge |
Yeah, had my PRs mixed up |
Add `make -f Makefile.prow ci` that can be run in prow
Deprecate backup "hooks" in favor of "pre" hooks:
spec.hooks.resources.hooks
becomesspec.hooks.resources.pre
. The former is still supported, but deprecated.hook.backup.ark.heptio.com/*
becomepre.hook.backup.ark.heptio.com/*
. The former is still supported, but deprecated.Add support for "post" hooks.
Update documentation.
Fixes #244