mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-03 11:45:20 +00:00
When restoring resources with GenerateName (where name is empty and K8s assigns the actual name), the managed fields patch was failing with error "name is required" because it was using obj.GetName() which returns empty for GenerateName resources. The fix uses createdObj.GetName() instead, which contains the actual name assigned by Kubernetes after resource creation. This affects any resource using GenerateName for restore, including: - PersistentVolumeClaims restored by kubevirt-velero-plugin - Secrets and ConfigMaps created with generateName - Any custom resources using generateName Changes: - Line 1707: Use createdObj.GetName() instead of obj.GetName() in Patch call - Lines 1702, 1709, 1713, 1716: Use createdObj in error/info messages for accuracy This is a backwards-compatible fix since: - For resources WITHOUT generateName: obj.GetName() == createdObj.GetName() - For resources WITH generateName: createdObj.GetName() has the actual name The managed fields patch was already correctly using createdObj (lines 1698-1700), only the Patch() call was incorrectly using obj. Fixes restore status showing FinalizingPartiallyFailed with "name is required" error when restoring resources with GenerateName. Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>