Skip to content

ACK.ResourceSynced condition gets removed in ACK runtime v0.16.0 #1133

@vijtrip2

Description

@vijtrip2

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)

  1. Revert the precursor change, and fall back to old behavior. Add this change back when AWSResourceManager.IsResourceSynced() method is implemented

  2. Keep the precursor change but instead of adding ACK.ResourceSynced=Unknown when condition is missing at the end, Set True or False depending on whether there was any reconciler error or not.

  3. Complete the implementation of determining the ACK.ResourceSynced condition from AWSResourceManager.IsResourceSynced() method and not rely on hook code from various Create/Update methods.

Metadata

Metadata

Assignees

Labels

area/runtimeIssues or PRs as related to controller runtime, common reconciliation logic, etckind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions