Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Resource doesn't re-reconcile after completed update #3468

Merged
merged 7 commits into from
Nov 8, 2023

Conversation

super-harsh
Copy link
Collaborator

Closes #3451

What this PR does / why we need it:

This PR adds a latest-reconciled-generation annotation to the resource every time the reconciler receives a createOrUpdate event and further is checked in MonitorResourceCreation. We need this check in MonitorResourceCreation since when a subsequent update is received, it always has a resume-poller-token annotation which makes the reconciler think that it's monitoring the resource and the update never happened.

The generation check runs once the poller is done or runs into an error, and requeues the resource if generation set by API server does not match with the annotation or else returns successfully.

Copy link
Member

@theunrepentantgeek theunrepentantgeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That came out really cleanly.

@theunrepentantgeek theunrepentantgeek added this pull request to the merge queue Oct 29, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 29, 2023
@matthchr matthchr added this pull request to the merge queue Oct 30, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 30, 2023
@matthchr
Copy link
Member

Hmm, the added test seems to fail?

@super-harsh super-harsh self-assigned this Oct 30, 2023
@codecov-commenter
Copy link

Codecov Report

Merging #3468 (37c9b5f) into main (ee2e124) will decrease coverage by 0.07%.
Report is 43 commits behind head on main.
The diff coverage is 54.24%.

@@            Coverage Diff             @@
##             main    #3468      +/-   ##
==========================================
- Coverage   54.31%   54.25%   -0.07%     
==========================================
  Files        1545     1573      +28     
  Lines      651527   653631    +2104     
==========================================
+ Hits       353882   354600     +718     
- Misses     240078   241456    +1378     
- Partials    57567    57575       +8     
Files Coverage Δ
...nagement/customizations/api_extension_types_gen.go 100.00% <100.00%> (ø)
...tomizations/api_version_set_extension_types_gen.go 100.00% <100.00%> (ø)
...ement/customizations/policy_extension_types_gen.go 100.00% <100.00%> (ø)
...tomizations/policy_fragment_extension_types_gen.go 100.00% <100.00%> (ø)
...ment/customizations/product_extension_types_gen.go 100.00% <100.00%> (ø)
...2/api/apimanagement/v1api20220801/api_types_gen.go 49.53% <ø> (ø)
...i/apimanagement/v1api20220801/backend_types_gen.go 41.88% <ø> (ø)
...zations/disk_encryption_set_extension_types_gen.go 100.00% <ø> (ø)
...compute/customizations/disk_extension_types_gen.go 100.00% <ø> (ø)
...ompute/customizations/image_extension_types_gen.go 100.00% <ø> (ø)
... and 63 more

... and 270 files with indirect coverage changes

@@ -65,7 +67,7 @@ func Test_Latest_Reconciled_Generation_Reconciles_AllEvents(t *testing.T) {
old := agentPool.DeepCopy()
agentPool.Spec.OrchestratorVersion = to.Ptr("1.27.1")

tc.Patch(old, agentPool)
tc.PatchResourceAndWaitForState(old, agentPool, metav1.ConditionFalse, conditions.ConditionSeverityInfo)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you confirm that doing this was still able to trigger the test on the behavior we wanted (that 2 PUTs happen before the first reconcile is finished)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, It does take that - generation mismatch path on re-runs.

@matthchr matthchr added this pull request to the merge queue Nov 7, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 7, 2023
@theunrepentantgeek theunrepentantgeek added this pull request to the merge queue Nov 7, 2023
@super-harsh super-harsh removed this pull request from the merge queue due to a manual request Nov 7, 2023
github-merge-queue bot pushed a commit that referenced this pull request Nov 7, 2023
* Add latest reconciled generation check

* Add tests and minor refactor

* Add header

* Fix test race

---------

Co-authored-by: Bevan Arps <bevan.arps@microsoft.com>
@super-harsh super-harsh added this pull request to the merge queue Nov 8, 2023
Merged via the queue into main with commit 30d2292 Nov 8, 2023
8 checks passed
@super-harsh super-harsh deleted the fix/latest-reconcile branch November 8, 2023 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Bug: Resource doesn't re-reconcile after completed update
4 participants