Skip to content

fix: ignore field setting in sdkUpdate DBInstance #221

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

michaelhtm
Copy link
Member

Issue #2086

Description of changes:
When we make a ModifyDBInstance call, the output returned is outdated.
Currently we've been relying on pendingModifiedValues to return the
desired field values, but based on the longs, pendingModifiedValues is not
a reliable source.

These changes specifically ignore setting the fields after ModifyDBInstance
is called.

A better approach can be to ignore setting anything after Update is called.
Just in case we're missing some values that we should ignore instead!!!

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 jlbutler and knottnt May 12, 2025 20:20
Copy link

ack-prow bot commented May 12, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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

@ack-prow ack-prow bot added the approved label May 12, 2025
Comment on lines +301 to +302
# sdk_delete_post_request:
# code: return r, fmt.Errorf("wait for delete")
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link

Choose a reason for hiding this comment

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

Just to make sure I understand the two approaches.

In this PR you selectively ignored certain fields for the DBInstance which were receiving out of date values from the Update response. The alternative you're asking about is to completely ignore the update response for every field as a way of ensuring that no other fields are erroneously updated with out of date values from the Update response. Is that correct?

Copy link

@knottnt knottnt left a comment

Choose a reason for hiding this comment

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

Just left a few clarifying questions.

ackcondition.SetSynced(desired, corev1.ConditionFalse, &msg, nil)
return desired, requeueWaitWhileDeleting
ackcondition.SetSynced(&resource{res}, corev1.ConditionFalse, &msg, nil)
return &resource{res}, requeueWaitWhileDeleting
Copy link

Choose a reason for hiding this comment

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

Q: What's the purpose of replacing desired with a copy modified to have the latest status?

Copy link
Member Author

Choose a reason for hiding this comment

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

This ensures that the status of the latest is patched (resource state for example, whether it is creating, updating, etc.)
The output of an sdkUpdate ends up here:
https://github.com/aws-controllers-k8s/runtime/blob/dc7be0dac4ba4706eb3ac1153c6921c59089a5db/pkg/runtime/reconciler.go#L756-L768

And if latest == desired, the status that is returned from sdkFind will be discarded.

We only need to patch the status returned from AWS API, because we want Spec to be user defined.

Comment on lines +301 to +302
# sdk_delete_post_request:
# code: return r, fmt.Errorf("wait for delete")
Copy link

Choose a reason for hiding this comment

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

Just to make sure I understand the two approaches.

In this PR you selectively ignored certain fields for the DBInstance which were receiving out of date values from the Update response. The alternative you're asking about is to completely ignore the update response for every field as a way of ensuring that no other fields are erroneously updated with out of date values from the Update response. Is that correct?

@knottnt
Copy link

knottnt commented May 13, 2025

@michaelhtm: Would it be possible to create a test that reproduces the bug? Having that test would both make us a bit more confident in this fix and make sure that we don't accidentally have a regression in future changes.

When we make a ModifyDBInstance call, the output returned is outdated.
Currently we've been relying on `pendingModifiedValues` to return the
desired field values, but based on the longs, pendingModifiedValues is
not a reliable source.

These changes specifically ignore setting the fields after
ModifyDBInstance is called.

A better approach can be to ignore setting anything after Update is
called. Just in case we're missing some values that we should ignore
instead!!!
@michaelhtm michaelhtm force-pushed the fix/ignoreoutdatedfields branch from 1d79229 to 7a87712 Compare May 13, 2025 18:53
@michaelhtm michaelhtm force-pushed the fix/ignoreoutdatedfields branch from 7a87712 to ed1a046 Compare May 13, 2025 19:42
Copy link

ack-prow bot commented May 13, 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
rds-verify-attribution b56ab1b link false /test rds-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.

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

Successfully merging this pull request may close these issues.

2 participants