Skip to content

Commit 579a01e

Browse files
Copy the parameter groups from status into spec (#141)
Issue aws-controllers-k8s/community#1744, if available: **Description of changes:** Copying the the parameter group fields from the status into the spec so that the controller can correctly determine that there is a difference between the latest and desired. This affects both type `DBCluster` and `DBInstance`. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 17265f0 commit 579a01e

File tree

8 files changed

+35
-6
lines changed

8 files changed

+35
-6
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2023-03-13T17:16:37Z"
2+
build_date: "2023-03-22T13:24:48Z"
33
build_hash: 338374e45678067e238b3991b8c15a4dd0b65c8e
44
go_version: go1.19.1
5-
version: v0.24.3-2-g338374e
6-
api_directory_checksum: 902e18c1b127f207d065ac0dcc81db3443da4765
5+
version: v0.24.3-2-g338374e-dirty
6+
api_directory_checksum: 249bb23477dbb69a88064ea191a078f41f4966d0
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.44.93
99
generator_config_info:
10-
file_checksum: fff3f61faf773d9fc572f9ba2aabe69805b0f642
10+
file_checksum: b25db005880b617bda699d2a80b7a6bba0144ba4
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

helm/crds/services.k8s.aws_adoptedresources.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,10 @@ spec:
145145
blockOwnerDeletion:
146146
description: If true, AND if the owner has the "foregroundDeletion"
147147
finalizer, then the owner cannot be deleted from the
148-
key-value store until this reference is removed. Defaults
148+
key-value store until this reference is removed. See
149+
https://kubernetes.io/docs/concepts/architecture/garbage-collection/#foreground-deletion
150+
for how the garbage collector interacts with this
151+
field and enforces the foreground deletion. Defaults
149152
to false. To set this field, a user needs "delete"
150153
permission of the owner, otherwise 422 (Unprocessable
151154
Entity) will be returned.

pkg/resource/db_cluster/custom_update.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ func (rm *resourceManager) customUpdate(
4040
rlog := ackrtlog.FromContext(ctx)
4141
exit := rlog.Trace("rm.customUpdate")
4242
defer exit(err)
43+
4344
if clusterDeleting(latest) {
4445
msg := "DB cluster is currently being deleted"
4546
ackcondition.SetSynced(desired, corev1.ConditionFalse, &msg, nil)
@@ -70,6 +71,7 @@ func (rm *resourceManager) customUpdate(
7071
var resp *svcsdk.ModifyDBClusterOutput
7172
_ = resp
7273
resp, err = rm.sdkapi.ModifyDBClusterWithContext(ctx, input)
74+
7375
rm.metrics.RecordAPICall("UPDATE", "ModifyDBCluster", err)
7476
if err != nil {
7577
return nil, err

pkg/resource/db_cluster/sdk.go

Lines changed: 5 additions & 0 deletions
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: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/util/parameters.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func NewErrUnmodifiableParameter(name string) error {
5656
// the parameters to remove
5757
func GetParametersDifference(
5858
to, from Parameters,
59-
) (added, unchanged, removed Parameters) {
59+
) (added, unchanged, removed Parameters) {
6060
// we need to convert the tag tuples to a comparable interface type
6161
fromPairs := lo.ToPairs(from)
6262
toPairs := lo.ToPairs(to)

templates/hooks/db_cluster/sdk_read_many_post_set_output.go.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@
2525
}
2626
ko.Spec.VPCSecurityGroupIDs = sgIDs
2727
}
28+
if r.ko.Spec.DBClusterParameterGroupName != nil {
29+
// If the desired resource has db cluster parameter group name specified then update the spec of the latest
30+
// resource with the value from the status.
31+
ko.Spec.DBClusterParameterGroupName = ko.Status.DBClusterParameterGroup
32+
}

templates/hooks/db_instance/sdk_read_many_post_set_output.go.tpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,10 @@
2323
}
2424
ko.Spec.VPCSecurityGroupIDs = sgIDs
2525
}
26+
if r.ko.Spec.DBParameterGroupName != nil {
27+
// If the desired resource has db parameter group name specified then update the spec of the latest
28+
// resource with the value from the status.
29+
if len(ko.Status.DBParameterGroups) > 0 {
30+
ko.Spec.DBParameterGroupName = ko.Status.DBParameterGroups[0].DBParameterGroupName
31+
}
32+
}

0 commit comments

Comments
 (0)