Skip to content

fix: ignore setting sdkUpdate output into DBInstance spec #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 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apis/v1alpha1/ack-generate-metadata.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
ack_generate_info:
build_date: "2025-07-15T03:33:00Z"
build_date: "2025-07-17T17:20:08Z"
build_hash: c6808295bbb03aac999713ecf1f3aa5cd698a17e
go_version: go1.24.4
version: v0.49.0
api_directory_checksum: 52968d74358773de28be65be320d1bfb9c91e0bf
api_version: v1alpha1
aws_sdk_go_version: v1.32.6
generator_config_info:
file_checksum: ced2b68c703e2daf7b04da8f84f6ad6c95114fb9
file_checksum: a2c9bffec38364e238232d121b259f8690e2da39
original_file_name: generator.yaml
last_modification:
reason: API generation
14 changes: 11 additions & 3 deletions apis/v1alpha1/generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ resources:
hooks:
delta_pre_compare:
template_path: hooks/db_instance/delta_pre_compare.go.tpl
# sdk_delete_post_request:
# code: return r, fmt.Errorf("wait for delete")
Comment on lines +301 to +302
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?

sdk_create_pre_build_request:
template_path: hooks/db_instance/sdk_create_pre_build_request.go.tpl
sdk_create_post_set_output:
Expand All @@ -308,8 +310,8 @@ resources:
template_path: hooks/db_instance/sdk_update_pre_build_request.go.tpl
sdk_update_post_build_request:
template_path: hooks/db_instance/sdk_update_post_build_request.go.tpl
sdk_update_post_set_output:
template_path: hooks/db_instance/sdk_update_post_set_output.go.tpl
sdk_update_pre_set_output:
template_path: hooks/db_instance/sdk_update_pre_set_output.go.tpl
sdk_delete_pre_build_request:
template_path: hooks/db_instance/sdk_delete_pre_build_request.go.tpl
sdk_delete_post_build_request:
Expand All @@ -332,7 +334,7 @@ resources:
name: "STATUS"
MasterUserPassword:
is_secret: true
KmsKeyId:
KMSKeyId:
references:
resource: Key
service_name: kms
Expand Down Expand Up @@ -395,6 +397,12 @@ resources:
from:
operation: CreateDBInstanceReadReplica
path: PreSignedUrl
PerformanceInsightsKMSKeyID:
late_initialize:
skip_incomplete_check: {}
PerformanceInsightsRetentionPeriod:
late_initialize:
skip_incomplete_check: {}
Tags:
compare:
# We have a custom comparison function...
Expand Down
14 changes: 11 additions & 3 deletions generator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ resources:
hooks:
delta_pre_compare:
template_path: hooks/db_instance/delta_pre_compare.go.tpl
# sdk_delete_post_request:
# code: return r, fmt.Errorf("wait for delete")
sdk_create_pre_build_request:
template_path: hooks/db_instance/sdk_create_pre_build_request.go.tpl
sdk_create_post_set_output:
Expand All @@ -308,8 +310,8 @@ resources:
template_path: hooks/db_instance/sdk_update_pre_build_request.go.tpl
sdk_update_post_build_request:
template_path: hooks/db_instance/sdk_update_post_build_request.go.tpl
sdk_update_post_set_output:
template_path: hooks/db_instance/sdk_update_post_set_output.go.tpl
sdk_update_pre_set_output:
template_path: hooks/db_instance/sdk_update_pre_set_output.go.tpl
sdk_delete_pre_build_request:
template_path: hooks/db_instance/sdk_delete_pre_build_request.go.tpl
sdk_delete_post_build_request:
Expand All @@ -332,7 +334,7 @@ resources:
name: "STATUS"
MasterUserPassword:
is_secret: true
KmsKeyId:
KMSKeyId:
references:
resource: Key
service_name: kms
Expand Down Expand Up @@ -395,6 +397,12 @@ resources:
from:
operation: CreateDBInstanceReadReplica
path: PreSignedUrl
PerformanceInsightsKMSKeyID:
late_initialize:
skip_incomplete_check: {}
PerformanceInsightsRetentionPeriod:
late_initialize:
skip_incomplete_check: {}
Tags:
compare:
# We have a custom comparison function...
Expand Down
11 changes: 3 additions & 8 deletions pkg/resource/db_instance/delta.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion pkg/resource/db_instance/manager.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

120 changes: 18 additions & 102 deletions pkg/resource/db_instance/sdk.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions templates/hooks/db_instance/delta_pre_compare.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,9 @@
*b.ko.Spec.NetworkType == ServiceDefaultNetworkType {
a.ko.Spec.NetworkType = b.ko.Spec.NetworkType
}
if a.ko.Spec.PerformanceInsightsRetentionPeriod == nil &&
b.ko.Spec.PerformanceInsightsRetentionPeriod != nil &&
*b.ko.Spec.PerformanceInsightsRetentionPeriod == ServiceDefaultInsightsRetentionPeriod {
a.ko.Spec.PerformanceInsightsRetentionPeriod = b.ko.Spec.PerformanceInsightsRetentionPeriod
}
if a.ko.Spec.PerformanceInsightsKMSKeyID == nil &&
b.ko.Spec.PerformanceInsightsKMSKeyID != nil {
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 }()
}

// RDS will choose preferred engine minor version if only
Expand Down
Loading