File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -403,6 +403,7 @@ 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
+
406
407
obj = oldObject .DeepCopyObject ().(client.Object )
407
408
} else { // copy status from original object
408
409
if err := copyStatusFrom (oldObject , obj ); err != nil {
@@ -436,6 +437,14 @@ func (t versionedTracker) update(gvr schema.GroupVersionResource, obj runtime.Ob
436
437
intResourceVersion ++
437
438
accessor .SetResourceVersion (strconv .FormatUint (intResourceVersion , 10 ))
438
439
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
+
439
448
if ! deleting && ! deletionTimestampEqual (accessor , oldAccessor ) {
440
449
return fmt .Errorf ("error: Unable to edit %s: metadata.deletionTimestamp field is immutable" , accessor .GetName ())
441
450
}
You can’t perform that action at this time.
0 commit comments