-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat(remote-restore): enabling restore in different namespace #72
Conversation
Refactoring will be taken in next PR. |
Signed-off-by: mayank <[email protected]>
Test output:
|
Signed-off-by: mayank <[email protected]>
Signed-off-by: mayank <[email protected]>
84dd514
to
7c0dc23
Compare
Signed-off-by: mayank <[email protected]>
Signed-off-by: mayank <[email protected]>
pkg/cstor/cstor.go
Outdated
s := strings.Split(snapshotID, "-velero-bkp-") | ||
volumeID := s[0] | ||
snapName := s[1] | ||
volumeID, snapName := getInfoFromSnapshotID(snapshotID) | ||
|
||
snapType := "cloud" |
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 this be cloud or remote?
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.
remote
@@ -0,0 +1,32 @@ | |||
package velero |
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.
Can you add another task to verify copyright checks, something to the effect of https://github.com/openebs/maya/blob/master/buildscripts/travis-build.sh#L41
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.
done. I'll address it in separate PR.
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// GetRestoreNamespace return the namespace mapping for the given namespace |
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.
The comment can be modified to make it clear that target namespace is returned by this function.
GetRestoreNamespace return the target namespace for restoring from the backup (bkpName).
If namespace mapping was provided to the restore command then target namespace is returned.
If namespace mapping was not provided to the restore command, source namespace (ns) will be returned.
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.
return "", errors.Wrapf(err, "failed to get list of restore") | ||
} | ||
|
||
sort.Sort(sort.Reverse(RestoreByCreationTimestamp(list.Items))) |
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.
Can you comment above this line to indicate why sort was used?
- This logic seems to work because only one restore is active on a given backup name. Is this true.
- Also is it not possible to pass the restore id or something to this function. If not, specify in the comment that velero doesn't send the restore id, so we have to depend on the backup name and the order of invocation. And at any given time there will ideally be only one RestorePhaseInProgress for a given backup name.
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. I'll add the comment similar to PR description.
The changes look good. But I have few questions, which may not be related to this PR. Can you point me to a doc link that answers the following: (a) Can the namespace-mapping be only provided to remote restores? Also a suggestion for future reviews: going through the code, I see the flow for restore involves creating PVC and PV (or at least returning those specs to velero to go ahead and create them). Can you include in the PR details a link to the high-level steps during restore in this repository? Maybe a .md or a wiki page. This will help the reviewer to get into the context faster - especially when reviewing the code after a long time or to first-time reviewers. |
Signed-off-by: mayank <[email protected]>
@kmova
https://github.com/openebs/velero-plugin/blob/master/README.md
https://docs.google.com/document/d/1-4WsM0AjLORb3lTCUUGyYOY_LNdTOATFesi7kTAr7SA/edit |
The above doc link helps @mynktl if we can convert that into a design doc on GitHub/wiki and make sure we update it as new features are added will be really helpful! |
Changes:
When restore, for cstor volume, is performed for remote-backup then velero-plugin find the velero relevant restore resource and get the namespace mapping and creates a pvc in that namespace.
plugin find the relevant restore from the sorted list(creationTimestamp in decreasing order) of restore resource using following criteria:
fixes: #67
Signed-off-by: mayank [email protected]