You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug fixes for status patching and late initialization patching (#168)
Description of changes:
Commit#1
- Adds the implementation of AWSResource.DeepCopy() method. aws-controllers-k8s/runtime#48
Commit#2
- Fixes the patching bug in lateInitialize code to unblock sagemaker team
- BUG: rm.LateInitialize() method was adding lateInitialized fields to the same object passed in the parameter and returning as output.
```go
lateInitializedLatest, err := rm.LateInitialize(ctx, latest)
rlog.Exit("rm.LateInitialize", err)
// Always patch after late initialize because some fields may have been initialized while
// others require a retry after some delay.
// This patching does not hurt because if there is no diff then 'patchResourceMetadataAndSpec'
// acts as a no-op.
if ackcompare.IsNotNil(lateInitializedLatest) {
patchErr := r.patchResourceMetadataAndSpec(ctx, latest, lateInitializedLatest)
// Throw the patching error if reconciler is unable to patch the resource with late initializations
if patchErr != nil {
err = patchErr
}
}
```
- Since lateInitializedLatest and latest were same object, above `patchResourceMetadataAndSpec` call sees no diff and does not patch lateInitialized fields into etcd.
- This PR solves the bug by adding lateInitialized fields in a copy of latest and returning that copy (without modifying latest)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
0 commit comments