mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-08-15 11:46:06 +00:00
ensure target namespace exists prior to retoring a resource (#2389)
Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
This commit is contained in:
@@ -798,6 +798,15 @@ func (ctx *context) restoreItem(obj *unstructured.Unstructured, groupResource sc
|
||||
}).Info("Not restoring item because namespace is excluded")
|
||||
return warnings, errs
|
||||
}
|
||||
|
||||
// if the namespace scoped resource should be restored, ensure that the namespace into
|
||||
// which the resource is being restored into exists.
|
||||
// This is the *remapped* namespace that we are ensuring exists.
|
||||
nsToEnsure := getNamespace(ctx.log, getItemFilePath(ctx.restoreDir, "namespaces", "", obj.GetNamespace()), namespace)
|
||||
if _, err := kube.EnsureNamespaceExistsAndIsReady(nsToEnsure, ctx.namespaceClient, ctx.resourceTerminatingTimeout); err != nil {
|
||||
errs.AddVeleroError(err)
|
||||
return warnings, errs
|
||||
}
|
||||
} else {
|
||||
if boolptr.IsSetToFalse(ctx.restore.Spec.IncludeClusterResources) {
|
||||
ctx.log.WithFields(logrus.Fields{
|
||||
|
||||
Reference in New Issue
Block a user