Skip to content

fix: ensure we mark resource as adopted adopt-or-create #186

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

Merged

Conversation

michaelhtm
Copy link
Member

Issue #2459#issuecomment-2879691276

Description of changes:
Currently the adopted annotation was getting removed when the resource
goes through update path during adopt-or-create adoption. These changes
ensure the annotation is persisted in k8s.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-prow ack-prow bot requested review from a-hilaly and rushmash91 May 14, 2025 17:17
@ack-prow ack-prow bot added the approved label May 14, 2025
@michaelhtm
Copy link
Member Author

/test s3-controller-test

@michaelhtm michaelhtm force-pushed the fix/markasadoptedonupdate branch from bf546cd to 0121d63 Compare May 19, 2025 18:33
@michaelhtm
Copy link
Member Author

/test s3-controller-test

@michaelhtm michaelhtm requested a review from knottnt June 16, 2025 21:16
@michaelhtm michaelhtm force-pushed the fix/markasadoptedonupdate branch from 0121d63 to 827a622 Compare June 16, 2025 22:34
Currently the `adopted` annotation was getting removed when the resource
goes through update path during adopt-or-create adoption. These changes
ensure the annotation is persisted in k8s.
@michaelhtm michaelhtm force-pushed the fix/markasadoptedonupdate branch from 827a622 to 29515da Compare June 16, 2025 22:36
@michaelhtm
Copy link
Member Author

/test ecr-controller-test

@michaelhtm
Copy link
Member Author

/test ec2-controller-test

@michaelhtm michaelhtm requested a review from knottnt June 17, 2025 20:28
_, err := r.Sync(ctx, rm, desired)
require.Nil(err)
rm.AssertNumberOfCalls(t, "ReadOne", 1)
rm.AssertCalled(t, "Update", ctx, desired, latest, delta)
rd.AssertCalled(t, "Delta", desired, latest)
rd.AssertNumberOfCalls(t, "MarkAdopted", 2)
Copy link

Choose a reason for hiding this comment

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

Can we assert that the AwsResource has the expected adoption fields as well when it is patched? Checking that the function call happened twice is a good indication, but we could be more definitive.

Copy link
Member Author

Choose a reason for hiding this comment

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

When MarkAdopted is called (an interface method) we're not really doing anything in these unit tests. We can only trust the actual implementation is handling the MarkAdopted is correct. The best way to actually test this is using e2e tests

Copy link

Choose a reason for hiding this comment

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

Ahh I see. That's due to the implementation being generated per service controller?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

@michaelhtm
Copy link
Member Author

/test ec2-controller-test

@michaelhtm michaelhtm requested a review from knottnt June 17, 2025 23:06
@knottnt
Copy link

knottnt commented Jun 18, 2025

/lgtm
/hold

Just holding in case we want a second reviewer.

@ack-prow ack-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 18, 2025
@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jun 18, 2025
Copy link

ack-prow bot commented Jun 18, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: knottnt, michaelhtm

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

@rushmash91
Copy link
Member

/unhold

@ack-prow ack-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 18, 2025
@michaelhtm
Copy link
Member Author

/retest

1 similar comment
@michaelhtm
Copy link
Member Author

/retest

@michaelhtm
Copy link
Member Author

/test sagemaker-controller-test
/test ec2-controller-test

@michaelhtm
Copy link
Member Author

/test sagemaker-controller-test
/test ec2-controller-test

@michaelhtm
Copy link
Member Author

/test ec2-controller-test

Copy link

ack-prow bot commented Jun 19, 2025

@michaelhtm: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
verify-attribution 05721fb link false /test verify-attribution

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@knottnt
Copy link

knottnt commented Jun 20, 2025

/test ec2-controller-test

@ack-prow ack-prow bot merged commit c28a9f4 into aws-controllers-k8s:main Jun 20, 2025
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants