Skip to content

Conversation

cheftako
Copy link
Collaborator

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'?

status.oservedGeneration is now being set on the ConfigConnectorContext.
  • Reviewer reviewed release note.

Additional documentation e.g., references, usage docs, etc.:

NONE

Intended Milestone

1.134

Please indicate the intended milestone.

  • Reviewer tagged PR with the actual milestone.

Tests you have done

  • Run make ready-pr to ensure this PR is ready for review.
  • Perform necessary E2E testing for changed resources.

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.
@cheftako
Copy link
Collaborator Author

/assign @justinsb

@cheftako
Copy link
Collaborator Author

2025-08-18T21:37:42.9144233Z utils.go:150: FAIL: unexpected diff in testdata/scenarios/acquisition/cloudidentitygroup/cloudidentitygroup-direct/_object00.yaml: (
2025-08-18T21:37:42.9145710Z """
2025-08-18T21:37:42.9146218Z ... // 31 identical lines
2025-08-18T21:37:42.9146821Z additionalGroupKeys:
2025-08-18T21:37:42.9147780Z - id: ${uniqueId}-group@${ISOLATED_TEST_ORG_NAME}
2025-08-18T21:37:42.9148852Z + - id: ${uniqueId}-group@${ISOLATED_TEST_ORG_NAME}.test-google-a.com
2025-08-18T21:37:42.9149695Z updateTime: "1970-01-01T00:00:00Z"
2025-08-18T21:37:42.9150195Z """
2025-08-18T21:37:42.9150559Z )

@cheftako
Copy link
Collaborator Author

/retest

@google-oss-prow google-oss-prow bot added the lgtm label Aug 18, 2025
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@cheftako cheftako added this to the 1.134 milestone Aug 18, 2025
@google-oss-prow google-oss-prow bot merged commit 3a2d9ad into GoogleCloudPlatform:master Aug 18, 2025
210 of 211 checks passed
}

// Manually set the observed generation, simulating the declarative reconciler.
ccc.Status.ObservedGeneration = 1
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants