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
A new PluginKind, `ItemBlockActionV1`, will be created, and the backup process will be modified to use this plugin kind.
105
+
A new PluginKind, `ItemBlockAction`, will be created, and the backup process will be modified to use this plugin kind.
106
106
107
107
For any BIA plugins which return additional items from `Execute()` that need to be backed up at the same time or sequentially in the same worker thread as the current items should add a new IBA plugin to return these same items (minus any which won't exist before BIA `Execute()` is called).
108
108
This mainly applies to plugins that operate on pods which reference resources which must be backed up along with the pod and are potentially affected by pod hooks or for plugins which connect multiple pods whose volumes should be backed up at the same time.
@@ -137,17 +137,21 @@ type ItemBlockItem struct {
137
137
In the `BackupWithResolvers` func, the current Velero implementation iterates over the list of items for backup returned by the Item Collector. For each item, Velero loads the item from the file created by the Item Collector, we call `backupItem`, update the GR map if successful, remove the (temporary) file containing item metadata, and update progress for the backup.
138
138
139
139
#### Modifications to the loop over ItemCollector results
140
-
The `kubernetesResource` struct used by the item collector will be modified to add an `orderedResource` bool which will be set true for all of the resources moved to the beginning of the list as a result of being ordered resources.
141
-
While the item collector already puts ordered resources first, there is no indication in the list which of these initial items are from the ordered resources list and which are the remaining (unordered) items.
142
-
Velero needs to know which resources are ordered because when we process them later, these initial resources must be processed sequentially, one at a time, before processing the remaining resources in a parallel manner.
140
+
The `kubernetesResource` struct used by the item collector will be modified to add an `orderedResource` bool which will be set true for all of the resources moved to the beginning for each GroupResource as a result of being ordered resources.
141
+
In addition, an `inItemBlock` bool is added to the struct which will be set to true later when processing the list when each item is added to an ItemBlock.
142
+
While the item collector already puts ordered resources first for each GR, there is no indication in the list which of these initial items are from the ordered resources list and which are the remaining (unordered) items.
143
+
Velero needs to know which resources are ordered because when we process them later, the ordered resources for each GroupResource must be processed sequentially in a single ItemBlock.
143
144
144
145
The current workflow within each iteration of the ItemCollector.items loop will replaced with the following:
145
146
- (note that some of the below should be pulled out into a helper func to facilitate recursive call to it for items returned from `GetRelatedItems`.)
146
-
- Before loop iteration, create a new `itemsInBlock` map of type map[velero.ResourceIdentifier]bool which represents the set of items already included in a block.
147
-
- If `item` is already in `itemsInBlock`, continue. This one has already been processed.
148
-
- Add `item` to `itemsInBlock`.
147
+
- Before loop iteration, create a pointer to a `BackupItemBlock` which will represent the current ItemBlock being processed.
148
+
- If `item` has `inItemBlock==true`, continue. This one has already been processed.
149
+
- If current `itemBlock` is nil, create it.
150
+
- Add `item` to `itemBlock`.
149
151
- Load item from ItemCollector file. Close/remove file after loading (on error return or not, possibly with similar anonymous func to current impl)
152
+
- If other versions of the same item exist (via EnableAPIGroupVersions), add these to the `itemBlock` as well (and load from ItemCollector file)
150
153
- Get matching IBA plugins for item, call `GetRelatedItems` for each. For each item returned, get full item content from ItemCollector (if present in item list, pulling from file, removing file when done) or from cluster (if not present in item list), add item to the current block, add item to `itemsInBlock` map, and then recursively apply current step to each (i.e. call IBA method, add to block, etc.)
154
+
- If current item and next item are both ordered items for the same GR, then continue to next item, adding to current `itemBlock`.
151
155
- Once full ItemBlock list is generated, call `backupItemBlock(block ItemBlock)
152
156
- Add `backupItemBlock` return values to `backedUpGroupResources` map
153
157
@@ -156,7 +160,7 @@ The current workflow within each iteration of the ItemCollector.items loop will
156
160
157
161
Method signature for new func `backupItemBlock` is as follows:
The return value is a slice of GRs for resources which were backed up. Velero tracks these to determine which CRDs need to be included in the backup. Note that we need to make sure we include in this not only those resources that were backed up directly, but also those backed up indirectly via additional items BIA execute returns.
162
166
@@ -363,4 +367,4 @@ func (a *PodAction) Name() string {
363
367
## Implementation
364
368
Phase 1 and Phase 2 could be implemented within the same Velero release cycle, but they need not be.
365
369
Phase 1 is expected to be implemented in Velero 1.15.
366
-
Phase 2 could either be in 1.15 as well, or in a later release, depending on the release timing and resource availability.
370
+
Phase 2 is expected to be implemented in Velero 1.16.
Copy file name to clipboardExpand all lines: site/content/docs/main/backup-hooks.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,9 @@ processing ("pre" hooks), or after all custom actions have been completed and an
13
13
specified by custom action have been backed up ("post" hooks). Note that hooks are _not_ executed within a shell
14
14
on the containers.
15
15
16
+
As of Velero 1.15, related items that must be backed up together are grouped into ItemBlocks, and pod hooks run before and after the ItemBlock is backed up.
17
+
In particular, this means that if an ItemBlock contains more than one pod (such as in a scenario where an RWX volume is mounted by multiple pods), pre hooks are run for all pods in the ItemBlock, then the items are backed up, then all post hooks are run.
18
+
16
19
There are two ways to specify hooks: annotations on the pod itself, and in the Backup spec.
0 commit comments