Skip to content

Commit bcd26e1

Browse files
authored
chore: move updates from create to sdkUpdate (#141)
Description of changes: Currently, we attempt to make certain update calls in sdkCreate, right after we populate the resource from createOutput. These calls usually fail as the Table may still be in `Creating` status. Another issue that kept happening was a throttling error during sdkFind for the DescribeTTL call. With these changes, we will be checking the Table status and reconciling if needed, and only retrieving TTL when the table has `available` status. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent d8533b5 commit bcd26e1

File tree

5 files changed

+22
-32
lines changed

5 files changed

+22
-32
lines changed

apis/v1alpha1/ack-generate-metadata.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
ack_generate_info:
2-
build_date: "2025-06-10T23:41:29Z"
3-
build_hash: e675923dfc54d8b6e09730098c3e3e1056d3c1e9
4-
go_version: go1.24.3
5-
version: v0.48.0
2+
build_date: "2025-07-15T01:30:17Z"
3+
build_hash: 4640e4fbac38e133c51fc9a0c2ff49e57b1a4d13
4+
go_version: go1.24.4
5+
version: v0.48.0-4-g4640e4f
66
api_directory_checksum: bcdceff2d7ddf7c98141572260ef2e6cee8bf23f
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6

pkg/resource/table/hooks.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,10 +471,6 @@ func (rm *resourceManager) setResourceAdditionalFields(
471471
} else {
472472
ko.Spec.ContinuousBackups = pitrSpec
473473
}
474-
475-
if err = rm.setContributorInsights(ctx, ko); err != nil {
476-
return err
477-
}
478474
return nil
479475
}
480476

pkg/resource/table/sdk.go

Lines changed: 9 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
if desired.ko.Spec.TimeToLive != nil {
2-
if err := rm.syncTTL(ctx, desired, &resource{ko}); err != nil {
3-
return nil, err
4-
}
5-
}
6-
7-
if desired.ko.Spec.ContributorInsights != nil {
8-
if err := rm.updateContributorInsights(ctx, desired); err != nil {
9-
return nil, err
10-
}
1+
// handle in sdkUpdate, to give resource time until it creates
2+
if desired.ko.Spec.TimeToLive != nil || desired.ko.Spec.ContributorInsights != nil {
3+
ackcondition.SetSynced(&resource{ko}, corev1.ConditionFalse, nil, nil)
114
}

templates/hooks/table/sdk_read_one_post_set_output.go.tpl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,13 @@
6060
if !canUpdateTableGSIs(&resource{ko}) {
6161
return &resource{ko}, requeueWaitGSIReady
6262
}
63-
if err := rm.setResourceAdditionalFields(ctx, ko); err != nil {
64-
return nil, err
63+
if err = rm.setContributorInsights(ctx, ko); err != nil {
64+
return &resource{ko}, err
6565
}
6666
if isTableUpdating(&resource{ko}) || isTableContributorInsightsUpdating(&resource{ko}) {
6767
return &resource{ko}, requeueWaitWhileUpdating
6868
}
69+
70+
if err := rm.setResourceAdditionalFields(ctx, ko); err != nil {
71+
return nil, err
72+
}

0 commit comments

Comments
 (0)