vmware-tanzu / velero

Backup and migrate Kubernetes applications and their persistent volumes
https://velero.io
Apache License 2.0
8.52k stars 1.38k forks source link

Resource status restore doesn't work for resources which has been exist, even though existingResourcePolicy is set to update #7994

Open nfyxhan opened 1 month ago

nfyxhan commented 1 month ago

What steps did you take and what happened:

a resource is exist in the cluster,edit its metadata and status, and then restore it, only metadata can be update, but status not

metadata:
    labels: 
       someunsync: true
status: 
    message: unsync

What did you expect to happen: both of the metadata and status should be update

Vote 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.

Lyndon-Li commented 1 month ago

Status restore is not controlled by the existingResourcePolicy. Status restore is not enabled by default either, you should use --status-include-resources restore flag to enable it for the specified resources.

Lyndon-Li commented 1 month ago

An open issue requesting the doc for --status-include-resources, #6237

nfyxhan commented 1 month ago

6237

--status-include-resources can work when the first time to restore, the second time can't work if I do not delete the resources which are the first time to restore . when fromCluster is not nil, it will return

image
Lyndon-Li commented 1 month ago

The existingResourcePolicy doesn't cover restore of status, if this is required in your case, just share more details of your scenarios, so that we can prioritize the requirement.

nfyxhan commented 1 month ago

The existingResourcePolicy doesn't cover restore of status, if this is required in your case, just share more details of your scenarios, so that we can prioritize the requirement.

We've modified the code here to rebuild a binary package that bypasses both of these issues

kaovilai commented 1 month ago

So perhaps call this update+status?

Or would this fit under existing update?

wdyt @shubham-pampattiwar

shubham-pampattiwar commented 1 month ago

@kaovilai I believe more details around the scenarios why we need this would help. The initial thought of ExistingResourcePolicy was around object's metadata and spec I believe. Also, IMO status of CR is something that is updated/patched by its controller.

nfyxhan commented 1 month ago

I have two clusters A and B, the first time I restore the CRD of cluster A to cluster B, and then the controller runs in cluster B for a period of time, and then restore the CRD to cluster A, the status needs to be restored. @Lyndon-Li @shubham-pampattiwar

Lyndon-Li commented 1 month ago

@nfyxhan We agree that the status should be restored in order to make the behavior consistent with the metadata restore; however, we also think status restore is seldomly required. Could you share your concrete requirement on status restore? Your requirement will help us to prioritize our tasks.