-
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
Velero should support incremental restores #4066
Comments
@pradeep288 thanks for the issue. Could you please give us a more concrete example regarding the |
@reasonerjt If it already exists, the code below that line determines whether the in-cluster resource is different than the resource in the backup. However, only service accounts are actually patched when differences are found. For everything else, the difference between the cluster version being the same and it being different from the backup just changes the log message. Velero doesn't currently attempt to update resources in the general case. When velero runs a restore and there are non-serviceaccount resources that already exist in the cluster, you'll see in velero logs the message from this line: |
Backup of X: Create a source cluster called A Backup of X + Delta: Switch to cluster A. Velero restores 4 pods but doesn't change the replicaSet with this hence we end up with 3 replicas as replicaSet kills extra pod
|
In general we have avoided this because it has the potential to seriously disrupt a working cluster. Our general advice has been to restore into a new cluster/namespace rather than trying to overwrite an existing installation. The opposite problem of what you are describing may happen in that case - for example you have increased your replica set to 5 after the backup and 4 was in the backup. At that point, if we are modifying resources, we would set it back to 4. @pradeep288 Would you give some examples of use cases for why you would to modify an existing installation with a restore rather than simply creating a new install? |
@dsu-igeek asked,
We would like to set up a backup cluster that is identical to a running production cluster, but with one difference: all the replicas in the backup cluster has been scaled down to zero; it has been quiesced. Essentially, the backup cluster is a dormant version of the production cluster. The reason for a current, yet dormant cluster is in the case of a disaster, this backup cluster can be quickly unquiesced and become the new production cluster. In order to keep such a quiesced backup cluster updated, we would like to be able to take backups on a schedule and use Velero restore to update the backup cluster on a similar schedule. What you suggested, "simply creating a new install" would not work for us as that would require clearing an entire cluster only to restore it again in its entirety and repeatedly. We would like a solution where an incremental restore is possible. It would be much faster to update a dormant copy of a production cluster than restore it from scratch based on an updated backup. I hope that answers your question. |
Solution BrainstormingSummaryThough not perfect, I suggest when The alternative is not to attempt an update, but rather a delete followed by a create. However, delete has potential for too much disruption to a cluster. It is feasible to be able to do a delete/create but perhaps in a future issue/PR after finalizers and owner references with cascading deletes can be considered. For now, being able to force restore and consequently update a destination cluster with a small number of immutable resources left untouched will be good enough. Consider Updating ResourcesVelero restore uses dynamic client from client-go to create backed up objects on the destination cluster. Currently, the method called on the dynamic client is "Create" located in restore.go line 1234. Perhaps for this issue, I can create a If one of those flags is used, and the "Create" method returns a "Already Exists" error, then restore will call client-go's In short, if the
Consider Deleting and Recreating ResourcesThis issue is similar to #469 and the idea there is to delete and create a resource if the backup object and what's on the destination cluster are the same. See the comments in the issue for thoughts on this method of tackling the solution. Concerns and Questions Regarding PUT
Failure: Secret \"immutable\" is invalid: data: Forbidden: field is immutable when `immutable` is set
Failure: Service \"my-nginx-2\" is invalid: [metadata.resourceVersion: Invalid value: \"\": must be specified for an update, spec.clusterIPs[0]: Invalid value: []string(nil): primary clusterIP can not be unset, spec.ipFamilies[0]: Invalid value: []core.IPFamily{\"IPv6\"}: may not change once set] It seems the error originates from Kubernetes validation, but I can't track down what is doing the validation. Is it the admissions mutating webhooks? It seems the error ultimately is reported here.
Concerns and Questions Regarding Delete and Create
|
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. |
I would like to see this feature pushed forwards. I would see some benefit in being able to have more granular control over the backup/restore process to force the updates to a certain subset of resources. |
What work is left here for 1.10? My understanding is that |
I agree with @dymurray @pradeep288 could you clarify? |
I'm closing this issue as the |
Is |
@lxs137 Not exactly, if you set it to update and you are trying to update an immutable spec then the restore will error for that particular k8s resource. |
Our use-case is exactly the same as described by @codegold79. For me it's unclear if
@codegold79 Since about 1.5 year has passed since your last post. Have you pursued an alternative solution? |
For restic, you'd need to delete the mounting pod prior to restore, since restic requires an initcontainer added at pod startup. If you do that, velero should perform a restic restore for any volumes mounted by the newly-created pod. With that done, existingResourcePolicy is probably irrelevant for Restic, since that field addresses kubernetes metadata update, not content on volumes. |
Sorry for the delayed response @boedy. Shortly after I made the post, I moved to a different team and project and haven't been working on backup/restore since. |
@codegold79 your scenario is very good use case of velero: to build a Active-standby cluster. so far thanks to @dymurray I think the other thing left is some kind of more flexiable "override-policy" --- we can learn from karmada , which provides powerful "override policy" |
Restoring data in situ should be a very common scenario? Would we consider it? |
Describe the problem/challenge you have
Currently, Velero doesn't support incremental restore. What i mean by incremental is if I have restored X already and after some time if i want to restore X+ delta X, velero doesn't have support for this.
Describe the solution you'd like
During restore, Velero should find difference between X and X+ DeltaX and should restore only DeltaX.
Environment:
velero version
): 1.6.1kubectl version
):1.20/etc/os-release
):MACVote on this issue!
This is an invitation to the Velero community to vote on issues, you can see the project's top voted issues listed here.
Use the "reaction smiley face" up to the right of this comment to vote.
The text was updated successfully, but these errors were encountered: