Skip to content

Commit 13b019e

Browse files
authored
fix: change syncTableTags parameter order to avoid panic (#136)
Issue [#2459#issuecomment-2886623397](aws-controllers-k8s/community#2459 (comment)) Description of changes: In syncTableTags, there was an issue with the order/naming of desired vs latest resource. Although the function is called using `syncTableTags(desired, latest)` the function definition had `syncTableTags(latest, desired)`. This becomes an issue when we try to retrieve the ARN from latest, during adoption. Although in the funciton we named the parameter `latest`, this parameter was treated as the desired resource when computing the tags delta. During adoption, the Status/ARN of the desired resource is meant to be nil, unitl it is later populated. Hence our need to use the ARN from latest. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 8a66da2 commit 13b019e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/resource/table/hooks_tags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ import (
3030
// to tag GlobalTable resources.
3131
func (rm *resourceManager) syncTableTags(
3232
ctx context.Context,
33-
latest *resource,
3433
desired *resource,
34+
latest *resource,
3535
) (err error) {
3636
rlog := ackrtlog.FromContext(ctx)
3737
exit := rlog.Trace("rm.syncTableTags")
3838
defer exit(err)
3939

40-
added, removed := computeTagsDelta(latest.ko.Spec.Tags, desired.ko.Spec.Tags)
40+
added, removed := computeTagsDelta(desired.ko.Spec.Tags, latest.ko.Spec.Tags)
4141

4242
// There are no API calls to update an existing tag. To update a tag we will have to first
4343
// delete it and then recreate it with the new value.

0 commit comments

Comments
 (0)