mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 11:45:20 +00:00
restore flow changes
Signed-off-by: Anshul Ahuja <anshulahuja@microsoft.com>
This commit is contained in:
@@ -48,6 +48,7 @@ import (
|
||||
|
||||
"github.com/vmware-tanzu/velero/internal/credentials"
|
||||
"github.com/vmware-tanzu/velero/internal/hook"
|
||||
"github.com/vmware-tanzu/velero/internal/resourcemodifiers"
|
||||
velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1"
|
||||
"github.com/vmware-tanzu/velero/pkg/archive"
|
||||
"github.com/vmware-tanzu/velero/pkg/client"
|
||||
@@ -305,6 +306,7 @@ func (kr *kubernetesRestorer) RestoreWithResolvers(
|
||||
hooksCancelFunc: hooksCancelFunc,
|
||||
kbClient: kr.kbClient,
|
||||
itemOperationsList: req.GetItemOperationsList(),
|
||||
resourceModifiers: req.ResourceModifiers,
|
||||
}
|
||||
|
||||
return restoreCtx.execute()
|
||||
@@ -350,6 +352,7 @@ type restoreContext struct {
|
||||
hooksCancelFunc go_context.CancelFunc
|
||||
kbClient crclient.Client
|
||||
itemOperationsList *[]*itemoperation.RestoreOperation
|
||||
resourceModifiers *resourcemodifiers.ResourceModifiers
|
||||
}
|
||||
|
||||
type resourceClientKey struct {
|
||||
@@ -1340,6 +1343,12 @@ func (ctx *restoreContext) restoreItem(obj *unstructured.Unstructured, groupReso
|
||||
// and which backup they came from.
|
||||
addRestoreLabels(obj, ctx.restore.Name, ctx.restore.Spec.BackupName)
|
||||
|
||||
if ctx.resourceModifiers != nil {
|
||||
if err := ctx.resourceModifiers.ApplyResourceModifierRules(obj, ctx.log); err != nil {
|
||||
errs.Add(namespace, err)
|
||||
}
|
||||
}
|
||||
|
||||
ctx.log.Infof("Attempting to restore %s: %v", obj.GroupVersionKind().Kind, name)
|
||||
createdObj, restoreErr := resourceClient.Create(obj)
|
||||
if restoreErr == nil {
|
||||
|
||||
Reference in New Issue
Block a user