Skip to content

Commit 4be393b

Browse files
authored
fix: ignore setting sdkUpdate output into DBInstance spec (#221)
Issue [#2086](aws-controllers-k8s/community#2086), [#2123](aws-controllers-k8s/community#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.
1 parent 35628d6 commit 4be393b

File tree

11 files changed

+131
-232
lines changed

11 files changed

+131
-232
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2025-07-22T22:12:13Z"
2+
build_date: "2025-07-23T17:40:52Z"
33
build_hash: b2dc0f44e0b08f041de14c3944a5cc005ba97c8f
4-
go_version: go1.24.5
4+
go_version: go1.24.4
55
version: v0.50.0
66
api_directory_checksum: 52968d74358773de28be65be320d1bfb9c91e0bf
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6
99
generator_config_info:
10-
file_checksum: ced2b68c703e2daf7b04da8f84f6ad6c95114fb9
10+
file_checksum: c2e5556f70b93834cadb221ec373fa29d6c1692b
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/generator.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ resources:
308308
template_path: hooks/db_instance/sdk_update_pre_build_request.go.tpl
309309
sdk_update_post_build_request:
310310
template_path: hooks/db_instance/sdk_update_post_build_request.go.tpl
311-
sdk_update_post_set_output:
312-
template_path: hooks/db_instance/sdk_update_post_set_output.go.tpl
311+
sdk_update_pre_set_output:
312+
template_path: hooks/db_instance/sdk_update_pre_set_output.go.tpl
313313
sdk_delete_pre_build_request:
314314
template_path: hooks/db_instance/sdk_delete_pre_build_request.go.tpl
315315
sdk_delete_post_build_request:
@@ -332,7 +332,7 @@ resources:
332332
name: "STATUS"
333333
MasterUserPassword:
334334
is_secret: true
335-
KmsKeyId:
335+
KMSKeyId:
336336
references:
337337
resource: Key
338338
service_name: kms
@@ -395,6 +395,12 @@ resources:
395395
from:
396396
operation: CreateDBInstanceReadReplica
397397
path: PreSignedUrl
398+
PerformanceInsightsKMSKeyID:
399+
late_initialize:
400+
skip_incomplete_check: {}
401+
PerformanceInsightsRetentionPeriod:
402+
late_initialize:
403+
skip_incomplete_check: {}
398404
Tags:
399405
compare:
400406
# We have a custom comparison function...

generator.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ resources:
308308
template_path: hooks/db_instance/sdk_update_pre_build_request.go.tpl
309309
sdk_update_post_build_request:
310310
template_path: hooks/db_instance/sdk_update_post_build_request.go.tpl
311-
sdk_update_post_set_output:
312-
template_path: hooks/db_instance/sdk_update_post_set_output.go.tpl
311+
sdk_update_pre_set_output:
312+
template_path: hooks/db_instance/sdk_update_pre_set_output.go.tpl
313313
sdk_delete_pre_build_request:
314314
template_path: hooks/db_instance/sdk_delete_pre_build_request.go.tpl
315315
sdk_delete_post_build_request:
@@ -332,7 +332,7 @@ resources:
332332
name: "STATUS"
333333
MasterUserPassword:
334334
is_secret: true
335-
KmsKeyId:
335+
KMSKeyId:
336336
references:
337337
resource: Key
338338
service_name: kms
@@ -395,6 +395,12 @@ resources:
395395
from:
396396
operation: CreateDBInstanceReadReplica
397397
path: PreSignedUrl
398+
PerformanceInsightsKMSKeyID:
399+
late_initialize:
400+
skip_incomplete_check: {}
401+
PerformanceInsightsRetentionPeriod:
402+
late_initialize:
403+
skip_incomplete_check: {}
398404
Tags:
399405
compare:
400406
# We have a custom comparison function...

pkg/resource/db_instance/delta.go

Lines changed: 3 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/resource/db_instance/manager.go

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/resource/db_instance/sdk.go

Lines changed: 18 additions & 102 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/hooks/db_instance/delta_pre_compare.go.tpl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,9 @@
1919
*b.ko.Spec.NetworkType == ServiceDefaultNetworkType {
2020
a.ko.Spec.NetworkType = b.ko.Spec.NetworkType
2121
}
22-
if a.ko.Spec.PerformanceInsightsRetentionPeriod == nil &&
23-
b.ko.Spec.PerformanceInsightsRetentionPeriod != nil &&
24-
*b.ko.Spec.PerformanceInsightsRetentionPeriod == ServiceDefaultInsightsRetentionPeriod {
25-
a.ko.Spec.PerformanceInsightsRetentionPeriod = b.ko.Spec.PerformanceInsightsRetentionPeriod
26-
}
27-
if a.ko.Spec.PerformanceInsightsKMSKeyID == nil &&
28-
b.ko.Spec.PerformanceInsightsKMSKeyID != nil {
29-
a.ko.Spec.PerformanceInsightsKMSKeyID = b.ko.Spec.PerformanceInsightsKMSKeyID
22+
if a.ko.Spec.PerformanceInsightsEnabled == nil &&
23+
b.ko.Spec.PerformanceInsightsEnabled != nil {
24+
a.ko.Spec.PerformanceInsightsEnabled = func() *bool {a := false; return &a }()
3025
}
3126

3227
// RDS will choose preferred engine minor version if only

templates/hooks/db_instance/sdk_update_post_set_output.go.tpl

Lines changed: 0 additions & 92 deletions
This file was deleted.

0 commit comments

Comments
 (0)