-
Notifications
You must be signed in to change notification settings - Fork 291
Fix failure to write .status.observedGeneration to CCC #4995
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
Conversation
I have fixed the bug where the status.observedGeneration field on the ConfigConnectorContext resource was not being set. Here is a brief explanation of the key changes I made and why: The declarative.Reconciler correctly sets the status.observedGeneration field. However, the handleReconcileSucceeded and handleReconcileFailed functions were overwriting the entire status with a new object, which discarded the observedGeneration. I modified these functions to instead read the existing status, update the Healthy and Errors fields, and then write the modified status back. This preserves the observedGeneration set by the declarative.Reconciler. I also updated the corresponding unit tests to verify this behavior. Finally, I ran all the tests for the controller and compiled the code to ensure the change was safe.
/assign @justinsb |
2025-08-18T21:37:42.9144233Z utils.go:150: FAIL: unexpected diff in testdata/scenarios/acquisition/cloudidentitygroup/cloudidentitygroup-direct/_object00.yaml: ( |
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: justinsb The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
3a2d9ad
into
GoogleCloudPlatform:master
} | ||
|
||
// Manually set the observed generation, simulating the declarative reconciler. | ||
ccc.Status.ObservedGeneration = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my reading of the code it seems like the configconnectorcontext controller implements its own v1alpha1 CommonStatus builder as opposed to using one of the k-d-p status builders, so I expect the controller will need to be updated to set the observedGeneration. As is it doesn't look like this unit test actually validates that the controller sets the observedGeneration, just that the controller doesn't clobber the observedGeneration
Change description
I have fixed the bug where the status.observedGeneration field on the ConfigConnectorContext resource was not being set.
Here is a brief explanation of the key changes I made and why:
The declarative.Reconciler correctly sets the status.observedGeneration field. However, the handleReconcileSucceeded and
handleReconcileFailed functions were overwriting the entire status with a new object, which discarded the observedGeneration.
I modified these functions to instead read the existing status, update the Healthy and Errors fields, and then write the
modified status back. This preserves the observedGeneration set by the declarative.Reconciler. I also updated the
corresponding unit tests to verify this behavior. Finally, I ran all the tests for the controller and compiled the code to
ensure the change was safe.
Special notes for your reviewer:
Does this PR add something which needs to be 'release noted'?
Additional documentation e.g., references, usage docs, etc.:
Intended Milestone
1.134
Please indicate the intended milestone.
Tests you have done
make ready-pr
to ensure this PR is ready for review.