You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/content/docs/main/restore-reference.md
+56Lines changed: 56 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -281,6 +281,62 @@ By default, Velero will remove the `status` field of an object before it's resto
281
281
282
282
You can use `--status-include-resources` and `--status-exclude-resources` flags to select the resources whose `status` field will be restored by Velero. If there are resources selected via these flags, velero will trigger another API call to update the restored object to restore `status` field after it's created.
283
283
284
+
## Object-Level Resource Status Restoration
285
+
286
+
Starting from Velero 1.16, Velero now supports object-level control over status restoration during restores. Previously, status restoration could only be configured at the resource type level using the `restoreStatus` field in the Restore CR. With this enhancement, users and controllers can now specify status restoration at the individual resource instance level using the annotation:
287
+
```yaml
288
+
metadata:
289
+
annotations:
290
+
velero.io/restore-status: "true"
291
+
```
292
+
This feature provides fine-grained control over status restoration, allowing users and controllers to mark specific objects for status restore while keeping others unaffected.
293
+
294
+
Velero determines whether to restore the status of an object based on the following precedence:
- If the annotation is present with a valid value ("true" or "false"), it overrides the global `restoreStatus` setting.
297
+
- "true"→ Status will be restored for this object, even if the resource type is not included in `restoreStatus.includedResources`.
298
+
- "false"→ Status will not be restored for this object, even if the resource type is included in `restoreStatus.includedResources`.
299
+
2. Restore CR (`restoreStatus` Field)
300
+
• If the annotation is missing or invalid, Velero falls back to the `restoreStatus` configuration in the Restore CR.
301
+
• Objects of resource types listed in `restoreStatus.includedResources` will have their status restored.
302
+
• Objects of resource types excluded from `restoreStatus.excludedResources` will not have their status restored.
303
+
3. Default Behavior
304
+
• If an object has no annotation and its resource type is not included in `restoreStatus.includedResources`, status restoration is skipped.
305
+
306
+
Let's go over some examples:
307
+
308
+
1. Restore Status for a Specific Object: If you want Velero to restore the status for a specific resource instance regardless of global restore settings, add the annotation:
309
+
```yaml
310
+
metadata:
311
+
annotations:
312
+
velero.io/restore-status: "true"
313
+
```
314
+
Even if the resource type is not listed in `restoreStatus.includedResources`, this object’s status will be restored.
315
+
316
+
2. Prevent Status Restore for a Specific Object: If you want to exclude a specific object from status restoration, even if its resource type is included in `restoreStatus.includedResources`, use:
317
+
```yaml
318
+
metadata:
319
+
annotations:
320
+
velero.io/restore-status: "false"
321
+
```
322
+
This ensures that this specific object will not have its status restored.
323
+
324
+
3. Restore Status Based on Resource Type: If you want to restore the status for all objects of a resource type, use the `restoreStatus` field in the Restore CR:
325
+
```yaml
326
+
apiVersion: velero.io/v1
327
+
kind: Restore
328
+
metadata:
329
+
name: restore-with-status
330
+
namespace: velero
331
+
spec:
332
+
restoreStatus:
333
+
includedResources:
334
+
- foo.bar.io
335
+
```
336
+
All `foo.bar.io` objects will have their status restored, except those that have `velero.io/restore-status`: "false"annotation.
337
+
338
+
4. Default Behavior (No Annotations & No Restore Spec): If no `velero.io/restore-status` annotation is set and the resource type is not listed in `restoreStatus.includedResources`, Velero skips restoring status for that object. This maintains the existing default behavior.
339
+
284
340
## Write Sparse files
285
341
If using fs-restore or CSI snapshot data movements, it's supported to write sparse files during restore by the below command:
0 commit comments