Skip to content

Commit 8d7e9fa

Browse files
authored
Patch the correct observed state after a rm.ReadOne call (#76)
Issue aws-controllers-k8s/community#807 For some controllers we noticed an incorrect reconciliation behaviour when a custom hook code was returning a `RequeueNeededAfter` error. More precisely `resourceManager.ReadOne` was not returning the correct observed state when `sdkFind` returns with an error. Which was causing the reconciler to patch to wrong state (`desird` instead `observed`). This patch fixes this issue by passing the correct observed state to `onError`. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent c459288 commit 8d7e9fa

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

templates/pkg/resource/manager.go.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ func (rm *resourceManager) ReadOne(
7474
}
7575
observed, err := rm.sdkFind(ctx, r)
7676
if err != nil {
77+
if observed != nil {
78+
return rm.onError(observed, err)
79+
}
7780
return rm.onError(r, err)
7881
}
7982
return rm.onSuccess(observed)

0 commit comments

Comments
 (0)