diff --git a/pkg/restore/restore.go b/pkg/restore/restore.go index 2a5f79bdf..94a1f252a 100644 --- a/pkg/restore/restore.go +++ b/pkg/restore/restore.go @@ -740,6 +740,12 @@ func (ctx *context) restoreResource(resource, namespace, resourcePath string) (a } } + // clear out non-core metadata fields & status + if obj, err = resetMetadataAndStatus(obj); err != nil { + addToResult(&errs, namespace, err) + continue + } + for _, action := range applicableActions { if !action.selector.Matches(labels.Set(obj.GetLabels())) { continue @@ -765,12 +771,6 @@ func (ctx *context) restoreResource(resource, namespace, resourcePath string) (a obj = unstructuredObj } - // clear out non-core metadata fields & status - if obj, err = resetMetadataAndStatus(obj); err != nil { - addToResult(&errs, namespace, err) - continue - } - // necessary because we may have remapped the namespace // if the namespace is blank, don't create the key originalNamespace := obj.GetNamespace()