Skip to content

Commit

Permalink
Revert "Patch metadata and spec when handling errors (#92)" (#96)
Browse files Browse the repository at this point in the history
This reverts commit de27382.

Description of changes:
Adding a patch in `HandleReconcileError` caused subsequent test failures in the EKS controller, and ultimately did not fix the issue in the RDS controller. This PR is to revert that change so that we can roll back to a known good state for any other controllers that may have been affected.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
RedbackThomson committed Jun 17, 2022
1 parent 35dd8c1 commit 657c1c9
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions pkg/runtime/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -860,8 +860,6 @@ func (r *resourceReconciler) HandleReconcileError(
err error,
) (ctrlrt.Result, error) {
if ackcompare.IsNotNil(latest) {
// Create a copy so we don't override the spec
latestCopy := latest.DeepCopy()
// The reconciliation loop may have returned an error, but if latest is
// not nil, there may be some changes available in the CR's Status
// struct (example: Conditions), and we want to make sure we save those
Expand All @@ -875,18 +873,13 @@ func (r *resourceReconciler) HandleReconcileError(
//
// TODO(jaypipes): We ignore error handling here but I don't know if
// there is a more robust way to handle failures in the patch operation
_ = r.patchResourceStatus(ctx, desired, latestCopy)
_ = r.patchResourceStatus(ctx, desired, latest)
}
if err == nil || err == ackerr.Terminal {
return ctrlrt.Result{}, nil
}
rlog := ackrtlog.FromContext(ctx)

// Ensure that we are patching any changes to the annotations/metadata and
// the Spec that may have been set by the resource manager's successful
// Create call above.
_ = r.patchResourceMetadataAndSpec(ctx, desired, latest)

var requeueNeededAfter *requeue.RequeueNeededAfter
if errors.As(err, &requeueNeededAfter) {
after := requeueNeededAfter.Duration()
Expand Down

0 comments on commit 657c1c9

Please sign in to comment.