Skip to content

Conversation

michaelhtm
Copy link
Member

@michaelhtm michaelhtm commented May 12, 2025

Issue #2086, #2123

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 logs, pendingModifiedValues is not
a reliable source.

These changes ignore the sdkUpdate output spec completely, and only patch the status.

One more change here is adding support of late initializing PerformanceInsightsKMSKeyID and PerformanceInsightsRetentionPeriod fields only when PerformanceInsights is enabled.

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
@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
Contributor

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
Contributor

@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.

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

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
Contributor

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.

@michaelhtm michaelhtm force-pushed the fix/ignoreoutdatedfields branch 2 times, most recently from 7a87712 to ed1a046 Compare May 13, 2025 19:42
@knottnt
Copy link
Contributor

knottnt commented May 21, 2025

/lgtm
/hold

Just adding the hold in case we want a second reviewer on this one.

@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 May 21, 2025
@ack-prow ack-prow bot added lgtm Indicates that a PR is ready to be merged. and removed lgtm Indicates that a PR is ready to be merged. labels May 21, 2025
@michaelhtm michaelhtm force-pushed the fix/ignoreoutdatedfields branch 3 times, most recently from f470a3d to 2434b87 Compare June 3, 2025 05:38
@michaelhtm michaelhtm force-pushed the fix/ignoreoutdatedfields branch from 2434b87 to 509dc82 Compare July 2, 2025 01:28
@michaelhtm michaelhtm force-pushed the fix/ignoreoutdatedfields branch from 36a7261 to 710c85b Compare July 2, 2025 19:24
@michaelhtm michaelhtm force-pushed the fix/ignoreoutdatedfields branch from 710c85b to f980ff5 Compare July 17, 2025 16:40
@michaelhtm michaelhtm changed the title fix: ignore field setting in sdkUpdate DBInstance fix: ignore setting sdkUpdate output into DBInstance spec Jul 17, 2025
@michaelhtm michaelhtm force-pushed the fix/ignoreoutdatedfields branch from f980ff5 to 05da18d Compare July 17, 2025 17:26
@michaelhtm michaelhtm requested review from a-hilaly and removed request for jlbutler July 17, 2025 18:36
a.ko.Spec.PerformanceInsightsKMSKeyID = b.ko.Spec.PerformanceInsightsKMSKeyID
if a.ko.Spec.PerformanceInsightsEnabled == nil &&
b.ko.Spec.PerformanceInsightsEnabled != nil {
a.ko.Spec.PerformanceInsightsEnabled = func() *bool { a := false; return &a }()
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Is this mutating PerformanceInsightEnabled to false?

Copy link
Contributor

Choose a reason for hiding this comment

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

If that's the case it seems odd to mutate the resource in the delta. I wouldn't expect the delta comparison to have any side effects.

Copy link
Member Author

Choose a reason for hiding this comment

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

We do this in a lot of controllers. The expected outcome if the field is missing is disabling it

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay if this is an existing pattern I won't block the PR.

@@ -0,0 +1,6 @@
ko.Status = latest.ko.Status
setLastAppliedSecretReferenceAnnotation(&resource{ko})
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Any reason this has been moved to out of the sdk_update_post_set_output hook?

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 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 05da18d to a3d1bd7 Compare July 23, 2025 17:54
Copy link

ack-prow bot commented Jul 23, 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 a3d1bd7 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.

@knottnt
Copy link
Contributor

knottnt commented Jul 23, 2025

/lgtm

@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jul 23, 2025
Copy link

ack-prow bot commented Jul 23, 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

@michaelhtm
Copy link
Member Author

/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 Jul 23, 2025
@ack-prow ack-prow bot merged commit 4be393b into aws-controllers-k8s:main Jul 23, 2025
6 of 7 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.

2 participants