-
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
Store PodVolumeBackups in obj storage & use as source of truth #1577
Conversation
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.
Added some specific comments, but to summarize - users will still use the backup.velero.io/backup-volumes
annotation to indicate which pod volumes they want to back up using restic. That's not changing. What is changing is that we will no longer use the snapshot.velero.io/<volume-name>
annotation to store the restic snapshot ID when a backup is taken; the <backup-name>-podvolumebackups.json.gz
file will be used instead.
d49bcc0
to
0a1feaa
Compare
👍 everything so far looks fine now. I would definitely refer to the code for the A few relevant references for the current volumesnapshots code: |
I super appreciate the links, thank you! 🙏 |
Per slack we're already showing it, just labeled as "restic backups" |
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.
Few more comments - overall looks like it's headed in the right direction!
Deprecating the annotation on the pod within the backup tarball since we are going to stop using this annotation to identify which volumes are restic backups. Signed-off-by: Carlisia <carlisiac@vmware.com>
Signed-off-by: Carlisia <carlisiac@vmware.com>
Signed-off-by: Carlisia <carlisiac@vmware.com>
Signed-off-by: Carlisia <carlisiac@vmware.com>
Signed-off-by: Carlisia <carlisiac@vmware.com>
28cfac7
to
cb8f214
Compare
Signed-off-by: Carlisia <carlisiac@vmware.com>
@skriss question wrt |
The backup sync controller will need to be updated so when it's syncing a backup from object storage into the cluster, it also reads the contents of the PodVolumeBackups file and ensures that the custom resources contained in that file exist in the cluster - if they don't exist, they'll need to be created. |
Signed-off-by: Carlisia <carlisiac@vmware.com>
Signed-off-by: Carlisia <carlisiac@vmware.com>
Signed-off-by: Carlisia <carlisiac@vmware.com>
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.
Added another round of comments.
I'm thinking we may want to implement the changes to pkg/restore
in a separate PR to keep this one from getting too big. This one should be fine on its own.
Let me know if you want to talk through/pair on any of the comments! |
Signed-off-by: Carlisia <carlisiac@vmware.com>
I tried to address the comments, PTAL. I'm stuck on how to resolve this mess, any hint: https://github.com/heptio/velero/pull/1577/files#diff-d0a3ff018929aec3abbaa4c8a2c299ccR575 I'm suspecting the answer will be initialize the entire struct with mocked objects for each element? |
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's looking good! I had a few comments but they should be pretty minor.
I haven't reviewed the tests again yet - doing that next.
// // VolumeSnapshots: mock.Anything, | ||
// } | ||
// TODO: [carlisia] resolve this mock | ||
backupStore.On("PutBackup", mock.Anything).Return(nil) |
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 what you want to do here is define a function that can be used as an arg to mock.MatchedBy
-- so something like the following:
func hasNameAndCompletionTimestamp(info persistence.BackupInfo) bool {
return info.Name == test.backup.Name &&
strings.Contains(info.Metadata.String(), `"completionTimestamp": "2006-01-02T22:04:05Z"`)
}
And then this line becomes:
backupStore.On("PutBackup", mock.MatchedBy(hasNameAndCompletionTimestamp)).Return(nil)
Signed-off-by: Carlisia <carlisiac@vmware.com>
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.
Couple more comments, all test-related. If needed we can merge as-is and then follow up.
|
||
// Ensure we have a CompletionTimestamp when uploading. | ||
// Failures will display the bytes in buf. | ||
completionTimestampIsPresent := func(buf *bytes.Buffer) bool { | ||
return strings.Contains(buf.String(), `"completionTimestamp": "2006-01-02T22:04:05Z"`) | ||
completionTimestampIsPresent := func(info persistence.BackupInfo) bool { |
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.
Let's rename to hasNameAndCompletionTimestamp
, and also update the comment just above.
Thank you, making those changes! |
Signed-off-by: Carlisia <carlisiac@vmware.com>
I'm trying to make sense of this output that I'm getting intermittently: https://gist.github.com/carlisia/8eb210744758a70e41af47216a4107ae It happens when I run |
I see:
Which looks related to #1577 (comment) - you need to fully revert changes that test case. I also see a typo error related to the backup controller tests -- "mock.Anythin" (should be "mock.Anything") |
Ah yes, I had reverted that line but not If you search my diff, there's no There is no |
Signed-off-by: Carlisia <carlisiac@vmware.com>
Often this implies the tests are failing to compile - I'll try your pushed code locally |
Still getting the failure intermittently (as I expected since I didn't change anything relevant). I think it's about this:
Which I think it's complaining that the |
Everything runs fine for me - tried running things 100x to look for flakes. It's also passing CI |
What commands are you both running for these tests? |
Yeah, good to go! I think vscode was caching something. Closed it and opened it and I don't get it anymore. I ran it a few times on my terminal and ran fine. |
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.
LGTM! @nrb @prydonius PTAL. We'll be following up with #1691 for the restore side of things.
Deprecate the annotation on the pod within the backup tarball (eventually remove)
Serialize the
PodVolumeBackups
as<backup-name>-podvolumebackups.json.gz
that stores a serialized list of PodVolumeBackups and store it in object storageSync to the cluster through the backup sync controller
Modify the code that relies on original annotation to map pods and volumes to restic snapshots/Modify restore to use this source, but maintain existing code so we can restore “old” backups
Implementation needs to be backwards compatible with 1.0 ability for restoring backups
Fixes #1169.
Signed-off-by: Carlisia carlisiac@vmware.com