Skip to content

fix(RecordSet): make adoption id field optional in pre/post annotation hooks - #121

Open
mahasiva-amazon wants to merge 2 commits into
aws-controllers-k8s:mainfrom
mahasiva-amazon:fix/adoption-id-optional
Open

fix(RecordSet): make adoption id field optional in pre/post annotation hooks#121
mahasiva-amazon wants to merge 2 commits into
aws-controllers-k8s:mainfrom
mahasiva-amazon:fix/adoption-id-optional

Conversation

@mahasiva-amazon

@mahasiva-amazon mahasiva-amazon commented Jul 29, 2026

Copy link
Copy Markdown

Fixes aws-controllers-k8s/community#2981

When adopting a pre-existing Route53 record via the adoption-fields annotation, customers omit the id field because pre-existing records have no associated ChangeInfo ID. The generated PopulateResourceFromAnnotation treats id as required and returns a terminal error: required field missing: id.

Fix

Add pre_populate_resource_from_annotation hook that injects an empty id sentinel when the field is absent from the annotation map, allowing the required-field check to pass. A post_populate_resource_from_annotation hook then clears Status.ID so the ChangeInfo lookup in sdkFind is skipped for adopted records with no ChangeInfo.

Testing

  • 4 unit subtests in resource_test.go
  • E2E: adoption with adoption-fields annotation (no id) reproduced terminal error on upstream, confirmed Synced=True with this fix

Fixes: R53-2

@ack-prow
ack-prow Bot requested review from a-hilaly and gustavodiaz7722 July 29, 2026 00:09
@ack-prow

ack-prow Bot commented Jul 29, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: mahasiva-amazon
Once this PR has been reviewed and has the lgtm label, please assign sapphirew for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

@ack-prow ack-prow Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 29, 2026
@ack-prow

ack-prow Bot commented Jul 29, 2026

Copy link
Copy Markdown

Hi @mahasiva-amazon. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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-sigs/prow repository.

mahasiva-amazon and others added 2 commits July 29, 2026 01:47
The id field in adoption annotations maps to Status.ID (the Route53 ChangeInfo
ID from the last change operation). Pre-existing records have no associated
ChangeInfo ID, causing adoption to fail with 'required field missing: id'.

Since resource.go is generated, the fix is implemented via two hooks:
- pre_populate_resource_from_annotation: injects an empty id sentinel into
  the fields map when id is absent, allowing the generated required-check to pass
- post_populate_resource_from_annotation: clears Status.ID when it holds the
  empty sentinel, so sdkFind skips the ChangeInfo lookup for adopted records

Also guard syncStatus against empty-string Status.ID via the
sdk_read_many_post_set_output template to prevent spurious ChangeInfo lookups.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Reproduces the exact CX scenario: pre-existing record adopted via
adoption-fields annotation without id field. Proves bug on upstream
(terminal error 'required field missing: id') and fix (Synced=True,
Status.ID nil).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mahasiva-amazon
mahasiva-amazon force-pushed the fix/adoption-id-optional branch from ff9711f to b76182e Compare July 29, 2026 01:50
@mahasiva-amazon

Copy link
Copy Markdown
Author

Branch rebased onto upstream v0.61.0 (commit 67f5dad). verify-code-gen passed (metadata-only diff). All unit tests pass.

1 similar comment
@mahasiva-amazon

Copy link
Copy Markdown
Author

Branch rebased onto upstream v0.61.0 (commit 67f5dad). verify-code-gen passed (metadata-only diff). All unit tests pass.

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

Labels

needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

route53-controller: RecordSet adoption fails when ChangeInfo ID is absent

1 participant