Skip to content

Commit b0d7dad

Browse files
brucegucodeTenglong Gu
andauthored
When db instance is inside db cluster(when DBClusterIdentifier appear), set cluster level params to nil (#99)
* Set some params to nil when dbInstance is an clustered instance * Update comment a little bit Co-authored-by: Tenglong Gu <[email protected]>
1 parent 2d587ce commit b0d7dad

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

apis/v1alpha1/ack-generate-metadata.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ack_generate_info:
2-
build_date: "2022-07-11T19:31:21Z"
2+
build_date: "2022-07-11T21:43:34Z"
33
build_hash: d09bac5fa87cffd0028014833a5e7e786c0187dd
4-
go_version: go1.18.3
4+
go_version: go1.18.2
55
version: v0.19.2-6-gd09bac5
66
api_directory_checksum: a60467e94dc7e76bf34ff50f21691507d576fefc
77
api_version: v1alpha1

pkg/resource/db_instance/sdk.go

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

templates/hooks/db_instance/sdk_update_post_build_request.go.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,15 @@
2424
if !delta.DifferentAt("Spec.NetworkType") {
2525
input.NetworkType = nil
2626
}
27+
28+
// For dbInstance inside dbCluster, it's either aurora or
29+
// multi-az cluster case, in either case, the below params
30+
// are not controlled in instance level.
31+
// hence when DBClusterIdentifier appear, set them to nil
32+
// Please refer to doc : https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DeleteDBInstance.html
33+
if desired.ko.Spec.DBClusterIdentifier != nil {
34+
input.AllocatedStorage = nil
35+
input.BackupRetentionPeriod = nil
36+
input.PreferredBackupWindow = nil
37+
input.DeletionProtection = nil
38+
}

0 commit comments

Comments
 (0)