Skip to content

Commit 310c37e

Browse files
authored
fix: remove SubnetIDs duplicates (#216)
Issue [#2083](aws-controllers-k8s/community#2083) Description of changes: In sdkFind hook, the SubnetIDs returned by AWS are appended to the latest resource Spec.SubnetIDs. This ended up being an issue because the latest resource is a deep copy of desired. And there were unnecessary update calls were being made due to this issue. This change ensures the only the SubnetIDs returned by the DescribeDBSubnetGroup call are populated in the latest SubnetIDs. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent edae298 commit 310c37e

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

apis/v1alpha1/ack-generate-metadata.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ack_generate_info:
2-
build_date: "2025-03-27T16:30:34Z"
3-
build_hash: 980cb1e4734f673d16101cf55206b84ca639ec01
2+
build_date: "2025-04-11T18:51:18Z"
3+
build_hash: 0909e7f0adb8ffe4120a8c20d5d58b991f2539e9
44
go_version: go1.24.1
5-
version: v0.44.0
5+
version: v0.44.0-3-g0909e7f
66
api_directory_checksum: 2960d5d47c03026d9207068e776eef99e09f798a
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6

pkg/resource/db_subnet_group/sdk.go

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

templates/hooks/db_subnet_group/sdk_read_many_post_set_output.go.tpl

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77
ko.Spec.Tags = tags
88
}
99

10-
if ko.Status.Subnets != nil {
11-
for _, subnetIdIter := range ko.Status.Subnets {
12-
if subnetIdIter.SubnetIdentifier != nil {
13-
ko.Spec.SubnetIDs = append(ko.Spec.SubnetIDs, subnetIdIter.SubnetIdentifier)
14-
}
15-
}
16-
}
10+
if ko.Status.Subnets != nil {
11+
f0 := []*string{}
12+
for _, subnetIdIter := range ko.Status.Subnets {
13+
if subnetIdIter.SubnetIdentifier != nil {
14+
f0 = append(f0, subnetIdIter.SubnetIdentifier)
15+
}
16+
}
17+
ko.Spec.SubnetIDs = f0
18+
}

0 commit comments

Comments
 (0)