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
Velero restore with include-resources to restore only namespace resource is not working #1970
Comments
Yeah, this is likely being caused by https://github.com/vmware-tanzu/velero/blob/master/pkg/restore/restore.go#L403-L407. This will take a little bit of investigation as I don't remember exactly why we treated namespaces that way, though likely has to do with included/excluded namespaces, namespace mappings, etc. |
Hi, Kriss. Could you give me more detail related to this namespace restore issue? Because I am a little bit confused about that part of the code. Why the namespace will be treated in this way? But when restoring namespace with other resources like PV, PVC, it works. |
@Frank51 sorry, I remember you asked me for this before in Slack :) I'll try to add more context tomorrow - I'll have to jog my own memory as to why it's implemented this way. |
Hi, Kriss. Sorry to disturb you. Do you have any idea about the implementation of the restore of namespace at that time? |
So I think there are a couple of things to consider:
I believe that the implementation approach of lazily restoring Hope that helps! |
@Frank51 were you interested in working on a fix here? |
Sure, I am quite interested in it. |
/assign @Frank51 |
This comment has been minimized.
This comment has been minimized.
This also has implications for users wanting to write RestoreItemActions for namespaces. Right now, since namespaces aren't created as part of the normal restore process but rather directly with a client call, writing a RestoreItemAction plugin for them will not get invoked. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closing the stale issue. |
not a stale |
@reasonerjt I wonder whether we want a restore field to control this behavior. Currently, velero doesn't restore empty namespaces. With the change proposed here, empty namespaces would be restored. Since that's a behavior change, would we want to give users an option to preserve prior behavior, or should we consider "velero doesn't restore an empty namespace" to be a bug instead, in which case, we wouldn't want a field, we'd just make the change for all restores. |
We'll double-check to determine if the current behavior "velero doesn't restore an empty namespace" is a bug or not, and may leave it as-is. |
Fixes vmware-tanzu#1970 Signed-off-by: Daniel Jiang <jiangd@vmware.com>
Fixes vmware-tanzu#1970 Signed-off-by: Daniel Jiang <jiangd@vmware.com>
Fixes vmware-tanzu#1970 Namespaces will be handled as cluster-scope resource, but for consistency they will still created via "Ensure namespace" flow for consistency. Signed-off-by: Daniel Jiang <jiangd@vmware.com>
@sseago |
Fixes #1970 Namespaces will be handled as cluster-scope resource, but for consistency they will still created via "Ensure namespace" flow for consistency. Signed-off-by: Daniel Jiang <jiangd@vmware.com>
What steps did you take and what happened:
Velero user could use '--include-resources' flag to specify which kind of resources need to be restored from backup. But when '--include-resources' only contains 'namespaces', the backup namespace could not be restored successfully to the Kubernetes cluster. If adding 'namespaces' and 'services' into the 'include resources', the backup could be restored correctly at this time.
What did you expect to happen:
When running 'velero restore create --from-backup --include-resources namespaces ', velero should restore only the namespace resource from the backup on the Kubernetes cluster successfully.
The output of the following commands will help us better understand what's going on:
(Pasting long output into a GitHub gist or other pastebin is fine.)
kubectl logs deployment/velero -n velero
https://gist.github.com/Frank51/5c18363b55bb593fc780068134684da7
velero backup describe <backupname>
orkubectl get backup/<backupname> -n velero -o yaml
velero backup logs <backupname>
https://gist.github.com/Frank51/62aaa98ea6a38418eb159b926e101e17
velero restore describe <restorename>
orkubectl get restore/<restorename> -n velero -o yaml
velero restore logs <restorename>
https://gist.github.com/Frank51/3e2bbdc44a5c1f1cdee91e0d65d70dd4
Anything else you would like to add:
[Miscellaneous information that will assist in solving the issue.]
Environment:
velero version
): v1.0.0velero client config get features
):kubectl version
): (Client Version : v1.16.0), (Server Version :v1.14.5 )/etc/os-release
): UbuntuThe text was updated successfully, but these errors were encountered: