Commit 1423c20
committed
fix: do not restore PV verbatim when volume data was skipped via VolumePolicy
When a VolumePolicy action=skip is used during backup, the volume data
is intentionally not backed up. During restore, Velero was restoring
the original PV identity (same VolumeHandle) which is dangerous:
- With Delete reclaim policy: underlying storage may no longer exist
- In cross-cluster restore: two clusters would share the same storage
This adds defense-in-depth in pv_restorer.go: when no snapshot is found
and the PV has a Delete reclaim policy, return errPVNeedsReprovisioning
to trigger dynamic re-provisioning instead of restoring the PV as-is.
The callers in restore.go (both new and legacy paths) handle this error
by inserting the PV into pvsToProvision.
For Retain reclaim policy PVs without snapshots, a warning is now logged
about the risks of cross-cluster restore scenarios.
Fixes #9318
Signed-off-by: Mateen Ali Anjum <mateenali66@gmail.com>1 parent 245525c commit 1423c20
3 files changed
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| |||
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
68 | 78 | | |
69 | 79 | | |
70 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
115 | 133 | | |
116 | 134 | | |
117 | 135 | | |
| |||
135 | 153 | | |
136 | 154 | | |
137 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
138 | 159 | | |
139 | 160 | | |
140 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1223 | 1223 | | |
1224 | 1224 | | |
1225 | 1225 | | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
1226 | 1231 | | |
1227 | 1232 | | |
1228 | 1233 | | |
| |||
1270 | 1275 | | |
1271 | 1276 | | |
1272 | 1277 | | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
1273 | 1283 | | |
1274 | 1284 | | |
1275 | 1285 | | |
| |||
2557 | 2567 | | |
2558 | 2568 | | |
2559 | 2569 | | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
2560 | 2573 | | |
2561 | 2574 | | |
2562 | 2575 | | |
| |||
2600 | 2613 | | |
2601 | 2614 | | |
2602 | 2615 | | |
| 2616 | + | |
| 2617 | + | |
| 2618 | + | |
| 2619 | + | |
| 2620 | + | |
2603 | 2621 | | |
2604 | 2622 | | |
2605 | 2623 | | |
| |||
0 commit comments