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

Remove diff calculation in observe-only reconciliation #461

Merged
merged 4 commits into from
Jan 30, 2025

Conversation

mergenci
Copy link
Member

@mergenci mergenci commented Jan 16, 2025

Description of your changes

Fixes crossplane-contrib/provider-upjet-aws#1597.

While importing a DynamoDB Table, in the linked issue, Terraform executes CustomizeDiff functions when Upjet calculates the diff in Observe(). One of the CustomizeDiff functions is a validation function that checks whether the configuration that is subject to diff is valid. Because the configuration is practically empty — it only contains the resource name in the import path — validation fails and returns an error, which in turn causes our Observe() to fail.

I've checked how the behavior of managed reconciler changes for observe-only reconciliation. When Upjet always returns ResourceUpToDate = true, this block executes. Otherwise, when Upjet calculates the diff and returns ResourceUpToDate accordingly, this block executes in case ResourceUpToDate = false. The difference between those two blocks are (1) debug messages and (2) metric records.

The difference doesn't matter for the import path, in which ResourceUpToDate doesn't make much sense. We can consider ResourceUpToDate = true, by definition, which is the case in this PR. The difference might matter in observe-only reconciliation that is not an import operation.

I have:

  • Read and followed Upjet's contribution process.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

I tested manually, using the resource manifest given in the linked issue above. Here are the steps I followed:

  1. Create the resource with deletionPolicy: Orphan.
  2. Delete the resource.
  3. Import the resource with managementPolicies: ["Observe"].
  4. Check that the import succeeded without any errors in the debug console.
  5. Copy essential fields from status.atProvider to spec.forProvider.
  6. Set managementPolicies: ["*"].
  7. Add a tag to the resource and check if the update succeeded without any errors in the console.

In addition to DynamoDB Table, I tested a VPC resource as well.

I also ran Uptests in crossplane-contrib/provider-upjet-aws#1651.

@mergenci mergenci force-pushed the remove-diff-in-observe-only branch 2 times, most recently from 54e83a3 to 10d0d54 Compare January 16, 2025 20:31
mergenci added a commit to mergenci/provider-aws that referenced this pull request Jan 28, 2025
crossplane/upjet#461

Signed-off-by: Cem Mergenci <cmergenci@gmail.com>
Signed-off-by: Cem Mergenci <cmergenci@gmail.com>
Signed-off-by: Cem Mergenci <cmergenci@gmail.com>
@mergenci mergenci force-pushed the remove-diff-in-observe-only branch from 10d0d54 to cfc7b7c Compare January 29, 2025 23:17
mergenci added a commit to mergenci/provider-aws that referenced this pull request Jan 29, 2025
crossplane/upjet#461

Signed-off-by: Cem Mergenci <cmergenci@gmail.com>
@mergenci mergenci marked this pull request as ready for review January 29, 2025 23:27
mergenci added a commit to mergenci/provider-aws that referenced this pull request Jan 29, 2025
crossplane/upjet#461

Signed-off-by: Cem Mergenci <cmergenci@gmail.com>
@mergenci mergenci force-pushed the remove-diff-in-observe-only branch from cfc7b7c to ffee480 Compare January 30, 2025 06:40
Signed-off-by: Cem Mergenci <cmergenci@gmail.com>
@mergenci mergenci force-pushed the remove-diff-in-observe-only branch from ffee480 to 525abba Compare January 30, 2025 06:49
We discovered that GoLand failed to build without the generics
expression, whereas VS Code warned that it was unnecessary.

Signed-off-by: Cem Mergenci <cmergenci@gmail.com>
Copy link
Member

@sergenyalcin sergenyalcin left a comment

Choose a reason for hiding this comment

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

Thanks @mergenci LGTM!

@mergenci mergenci merged commit ce71033 into crossplane:main Jan 30, 2025
6 checks passed
mergenci added a commit to mergenci/provider-aws that referenced this pull request Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Observing DynamoDB Table rangeKey throws Unused attributes error
2 participants