@@ -11,6 +11,7 @@ import(
11
11
var (
12
12
_ = svcapitypes.{ { .CRD.Kind } }{ }
13
13
_ = acktags.NewTags()
14
+ ACKSystemTags = []string{ " services.k8s.aws/namespace" , " services.k8s.aws/controller-version" }
14
15
)
15
16
16
17
{ {- if $hookCode := Hook .CRD " convert_tags" } }
@@ -87,21 +88,20 @@ func FromACKTags(tags acktags.Tags) {{ $tagFieldGoType }} {
87
88
}
88
89
{ { end } }
89
90
90
- // IgnoreAWSTags ignores tags that have keys that start with "aws:"
91
- // is needed to ensure the controller does not attempt to remove
92
- // tags set by AWS
91
+ // ignoreSystemTags ignores tags that have keys that start with "aws:"
92
+ // and ACKSystemTags, to avoid patching them to the resourceSpec.
93
93
// Eg. resources created with cloudformation have tags that cannot be
94
94
// removed by an ACK controller
95
- func IgnoreAWSTags (tags acktags.Tags) {
95
+ func ignoreSystemTags (tags acktags.Tags) {
96
96
for k := range tags {
97
97
if strings.HasPrefix(k, " aws:" ) ||
98
- strings.HasPrefix(k, " services.k8s.aws/ " ) {
98
+ slices.Contains(ACKSystemTags, k ) {
99
99
delete(tags, k)
100
100
}
101
101
}
102
102
}
103
103
104
- // SyncAWSTags ensures AWS-managed tags (prefixed with "aws:") from the latest resource state
104
+ // syncAWSTags ensures AWS-managed tags (prefixed with "aws:") from the latest resource state
105
105
// are preserved in the desired state. This prevents the controller from attempting to
106
106
// modify AWS-managed tags, which would result in an error.
107
107
//
@@ -120,7 +120,7 @@ func IgnoreAWSTags(tags acktags.Tags) {
120
120
// desired := Tags{ " environment" : " dev" }
121
121
// SyncAWSTags(desired, latest)
122
122
// desired now contains { " aws:cloudformation:stack-name" : " my-stack" , " environment" : " dev" }
123
- func SyncAWSTags (a acktags.Tags, b acktags.Tags) {
123
+ func syncAWSTags (a acktags.Tags, b acktags.Tags) {
124
124
for k := range b {
125
125
if strings.HasPrefix(k, " aws:" ) {
126
126
a[k] = b[k]
0 commit comments