You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add new tag conversion funcitons that preserve order in lists of Tags (#572)
Description of changes:
When converting between ACK tags (map[string]string) and
resource tags(which could be either a list of Tag struct or map[string]*string)
can be tricky. One issue that we found was order preservation, especially when
converting from `map[string]string` to list of `Tag`. The changed order, when
patched to the resource in the cluster, would trigger a reconciliation, for an
unpredictable amount of times (at least until we luckily convert to the list with
a preserved order.)
This change introduces two new functions, similar to the existing ones.
The `toACKTagsWithKeyOrder` has the same function as `ToACKTags`,
but besides returning the ACK tags, it also returns a list of keys in the same
order it is in the resource.
The `fromACKTagsWithKeyOrder`, also similar to `FromACKTags`, accepts
the keyOrder returned by `toACKTagsWithKeyOrder`, and rebuilds the resource
tags, if it's a list, in the same order as it was before. Any extra tags will be added
in random order.
These two new functions will be called before and after `mirrowAWSTags` and
`FilterSystemTags`. The extra tags mentioned earlier are the AWS tags that are
mirrored from the latest resource (more explanation on what they are [here](aws-controllers-k8s/runtime#170)) and will be filtered before getting patched with [this](aws-controllers-k8s/runtime#172)
change.
This will ensure that the tags in desired will maintain their order and avoid triggering
unnecessary reconciliations.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
0 commit comments