@@ -403,8 +403,9 @@ func (t versionedTracker) update(gvr schema.GroupVersionResource, obj runtime.Ob
403
403
if err := copyStatusFrom (obj , oldObject ); err != nil {
404
404
return fmt .Errorf ("failed to copy non-status field for object with status subresouce: %w" , err )
405
405
}
406
-
407
- obj = oldObject .DeepCopyObject ().(client.Object )
406
+ passedRV := accessor .GetResourceVersion ()
407
+ reflect .ValueOf (obj ).Elem ().Set (reflect .ValueOf (oldObject .DeepCopyObject ()).Elem ())
408
+ accessor .SetResourceVersion (passedRV )
408
409
} else { // copy status from original object
409
410
if err := copyStatusFrom (oldObject , obj ); err != nil {
410
411
return fmt .Errorf ("failed to copy the status for object with status subresource: %w" , err )
@@ -437,14 +438,6 @@ func (t versionedTracker) update(gvr schema.GroupVersionResource, obj runtime.Ob
437
438
intResourceVersion ++
438
439
accessor .SetResourceVersion (strconv .FormatUint (intResourceVersion , 10 ))
439
440
440
- // obtain the current obj accessor's pointer,
441
- // so we can make an update on the current obj
442
- currentAccessor , err := meta .Accessor (obj )
443
- if err != nil {
444
- return fmt .Errorf ("failed to get accessor for object: %w" , err )
445
- }
446
- currentAccessor .SetResourceVersion (strconv .FormatUint (intResourceVersion , 10 ))
447
-
448
441
if ! deleting && ! deletionTimestampEqual (accessor , oldAccessor ) {
449
442
return fmt .Errorf ("error: Unable to edit %s: metadata.deletionTimestamp field is immutable" , accessor .GetName ())
450
443
}
0 commit comments