-
Notifications
You must be signed in to change notification settings - Fork 271
Description
Describe the bug
ACK.ResourceSynced gets removed after successful creation of the resource in ACK runtime v0.16.0
Context
In the new release v0.16.0, ACK runtime had a change to reset(remove) old Status.Conditions at the start of reconciler loop, and set latest Status.Conditions again during reconciliation. The latest Status.Conditions are then patched into the K8s object status at end of reconciler loop.
If at the end of reconciler loop, there is no ACK.ResourceSynced condition present inside Status.Conditions, then ACK.ResourceSynced=Unknown condition gets added.
ACK.ResourceSynced condition is an important condition for customers to determine whether the resource is synced or still under reconciliation process. The above mentioned change was made as a precursor change for a new feature to determine ACK.ResourceSynced condition by introspecting Spec/Status field values, or invoking AWS APIs, and NOT just relying on whether any error occurred during reconciliation loop or not.
Problem
While the proposed feature for setting ACK.ResourceSynced condition by introspecting Spec/Status fields is still under development, there is a side-effect from the precursor change causing test failures in various controllers(with new runtime) that assert on resource condition.
The side-effect is that, Even if ACK.ResourceSynced condition was set correctly during Create operation, the following reconciler loops remove this condition at beginning of loop. If the Update operation uses hooks to set this condition again, there are no problems but following edge case is still not handled.
Edge Case:
When a resource is first created, a finalizer is added and metadata of K8s resource is patched, which triggers a second reconciliation loop. During the second reconciliation loop, conditions are removed at beginning and since resource neither gets created, nor gets updated in this second loop, the ACK.ResourceSynced condition is never set and default to ACK.ResourceSynced=Unknown which is problematic, when resource has been successfully created.
Proposed Solutions (Sorted in order of speed of implementation)
-
Revert the precursor change, and fall back to old behavior. Add this change back when
AWSResourceManager.IsResourceSynced()method is implemented -
Keep the precursor change but instead of adding
ACK.ResourceSynced=Unknownwhen condition is missing at the end, SetTrue or Falsedepending on whether there was anyreconciler erroror not. -
Complete the implementation of determining the
ACK.ResourceSyncedcondition fromAWSResourceManager.IsResourceSynced()method and not rely on hook code from various Create/Update methods.