Skip to content

Commit 8ab6997

Browse files
authored
Merge pull request #1120 from shiv-amz/batcher
Batch tagging controller create/delete tags calls
2 parents a1565f3 + 0059675 commit 8ab6997

12 files changed

Lines changed: 745 additions & 104 deletions

File tree

go.mod

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,20 @@ module k8s.io/cloud-provider-aws
33
go 1.24.0
44

55
require (
6+
github.com/Pallinder/go-randomdata v1.2.0
67
github.com/aws/aws-sdk-go v1.55.5
78
github.com/aws/aws-sdk-go-v2 v1.32.5
89
github.com/aws/aws-sdk-go-v2/config v1.28.0
910
github.com/aws/aws-sdk-go-v2/service/ecr v1.36.2
1011
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.27.2
12+
github.com/mitchellh/hashstructure/v2 v2.0.2
13+
github.com/onsi/ginkgo/v2 v2.23.0
14+
github.com/onsi/gomega v1.36.2
15+
github.com/samber/lo v1.49.1
1116
github.com/spf13/cobra v1.8.1
12-
github.com/spf13/pflag v1.0.5
17+
github.com/spf13/pflag v1.0.6
1318
github.com/stretchr/testify v1.10.0
14-
golang.org/x/time v0.9.0
19+
golang.org/x/time v0.11.0
1520
gopkg.in/gcfg.v1 v1.2.3
1621
k8s.io/api v0.33.0-rc.0
1722
k8s.io/apimachinery v0.33.0-rc.0
@@ -23,13 +28,22 @@ require (
2328
k8s.io/klog/v2 v2.130.1
2429
k8s.io/kubelet v0.33.0-rc.0
2530
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
31+
sigs.k8s.io/controller-runtime v0.20.3
2632
)
2733

2834
require (
2935
cel.dev/expr v0.19.1 // indirect
36+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
3037
github.com/google/btree v1.1.3 // indirect
38+
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
3139
github.com/kylelemons/godebug v1.1.0 // indirect
40+
github.com/prometheus/client_golang v1.22.0-rc.0 // indirect
3241
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
42+
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
43+
gopkg.in/inf.v0 v0.9.1 // indirect
44+
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
45+
gopkg.in/warnings.v0 v0.1.2 // indirect
46+
gopkg.in/yaml.v3 v3.0.1 // indirect
3347
sigs.k8s.io/randfill v1.0.0 // indirect
3448
)
3549

@@ -84,7 +98,6 @@ require (
8498
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
8599
github.com/pkg/errors v0.9.1 // indirect
86100
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
87-
github.com/prometheus/client_golang v1.22.0-rc.0 // indirect
88101
github.com/prometheus/client_model v0.6.1 // indirect
89102
github.com/prometheus/common v0.62.0 // indirect
90103
github.com/prometheus/procfs v0.15.1 // indirect
@@ -107,23 +120,18 @@ require (
107120
go.uber.org/zap v1.27.0 // indirect
108121
golang.org/x/crypto v0.36.0 // indirect
109122
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
110-
golang.org/x/mod v0.21.0 // indirect
123+
golang.org/x/mod v0.23.0 // indirect
111124
golang.org/x/net v0.38.0 // indirect
112125
golang.org/x/oauth2 v0.27.0 // indirect
113-
golang.org/x/sync v0.12.0 // indirect
126+
golang.org/x/sync v0.12.0
114127
golang.org/x/sys v0.31.0 // indirect
115128
golang.org/x/term v0.30.0 // indirect
116129
golang.org/x/text v0.23.0 // indirect
117-
golang.org/x/tools v0.26.0 // indirect
130+
golang.org/x/tools v0.30.0 // indirect
118131
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
119132
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
120133
google.golang.org/grpc v1.68.1 // indirect
121134
google.golang.org/protobuf v1.36.5 // indirect
122-
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
123-
gopkg.in/inf.v0 v0.9.1 // indirect
124-
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
125-
gopkg.in/warnings.v0 v0.1.2 // indirect
126-
gopkg.in/yaml.v3 v3.0.1 // indirect
127135
k8s.io/apiserver v0.33.0-rc.0 // indirect
128136
k8s.io/component-helpers v0.33.0-rc.0 // indirect
129137
k8s.io/gengo/v2 v2.0.0-20250207200755-1244d31929d7 // indirect

go.sum

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25
44
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
55
github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cqUQ3I=
66
github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c=
7+
github.com/Pallinder/go-randomdata v1.2.0 h1:DZ41wBchNRb/0GfsePLiSwb0PHZmT67XY00lCDlaYPg=
8+
github.com/Pallinder/go-randomdata v1.2.0/go.mod h1:yHmJgulpD2Nfrm0cR9tI/+oAgRqCQQixsA8HyRZfV9Y=
79
github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI=
810
github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g=
911
github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU=
@@ -104,8 +106,8 @@ github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN
104106
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
105107
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
106108
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
107-
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo=
108-
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
109+
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg=
110+
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144=
109111
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
110112
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
111113
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo=
@@ -145,6 +147,8 @@ github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0
145147
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
146148
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
147149
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
150+
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
151+
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
148152
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
149153
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
150154
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
@@ -154,10 +158,10 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
154158
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
155159
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
156160
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
157-
github.com/onsi/ginkgo/v2 v2.21.0 h1:7rg/4f3rB88pb5obDgNZrNHrQ4e6WpjonchcpuBRnZM=
158-
github.com/onsi/ginkgo/v2 v2.21.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo=
159-
github.com/onsi/gomega v1.35.1 h1:Cwbd75ZBPxFSuZ6T+rN/WCb/gOc6YgFBXLlZLhC7Ds4=
160-
github.com/onsi/gomega v1.35.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog=
161+
github.com/onsi/ginkgo/v2 v2.23.0 h1:FA1xjp8ieYDzlgS5ABTpdUDB7wtngggONc8a7ku2NqQ=
162+
github.com/onsi/ginkgo/v2 v2.23.0/go.mod h1:zXTP6xIp3U8aVuXN8ENK9IXRaTjFnpVB9mGmaSRvxnM=
163+
github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8=
164+
github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY=
161165
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
162166
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
163167
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -174,14 +178,17 @@ github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoG
174178
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
175179
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
176180
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
181+
github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew=
182+
github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o=
177183
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
178184
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
179185
github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js=
180186
github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0=
181187
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
182188
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
183-
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
184189
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
190+
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
191+
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
185192
github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs=
186193
github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo=
187194
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -254,8 +261,8 @@ golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0
254261
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY=
255262
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
256263
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
257-
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
258-
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
264+
golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM=
265+
golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
259266
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
260267
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
261268
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@@ -281,14 +288,14 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
281288
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
282289
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
283290
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
284-
golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY=
285-
golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
291+
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
292+
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
286293
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
287294
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
288295
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
289296
golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
290-
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
291-
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
297+
golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY=
298+
golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY=
292299
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
293300
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
294301
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -354,6 +361,8 @@ k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6J
354361
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
355362
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM=
356363
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw=
364+
sigs.k8s.io/controller-runtime v0.20.3 h1:I6Ln8JfQjHH7JbtCD2HCYHoIzajoRxPNuvhvcDbZgkI=
365+
sigs.k8s.io/controller-runtime v0.20.3/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY=
357366
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8=
358367
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo=
359368
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=

pkg/controllers/options/tagging_controller.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@ import (
2121
// TaggingControllerOptions contains the inputs that can
2222
// be used in the tagging controller
2323
type TaggingControllerOptions struct {
24-
Tags map[string]string
25-
Resources []string
26-
RateLimit float64
27-
BurstLimit int
28-
WorkerCount int
24+
Tags map[string]string
25+
Resources []string
26+
RateLimit float64
27+
BurstLimit int
28+
WorkerCount int
29+
BatchingEnabled bool
2930
}
3031

3132
// AddFlags add the additional flags for the controller
@@ -38,6 +39,8 @@ func (o *TaggingControllerOptions) AddFlags(fs *pflag.FlagSet) {
3839
"Burst limit at which the controller processes items in its queue. A value of zero (default) disables rate limiting.")
3940
fs.IntVar(&o.WorkerCount, "tagging-controller-concurrent-node-syncs", 1,
4041
"The number of workers concurrently synchronizing nodes")
42+
fs.BoolVar(&o.BatchingEnabled, "tagging-controller-enable-batching", o.BatchingEnabled,
43+
"Enables batching create and delete tag calls.")
4144
}
4245

4346
// Validate checks for errors from user input

pkg/controllers/tagging/tagging_controller.go

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ limitations under the License.
1414
package tagging
1515

1616
import (
17+
"context"
1718
"crypto/md5"
1819
"fmt"
1920
"sort"
@@ -102,6 +103,7 @@ type Controller struct {
102103

103104
rateLimitEnabled bool
104105
workerCount int
106+
batchingEnabled bool
105107
}
106108

107109
// NewTaggingController creates a NewTaggingController object
@@ -114,8 +116,8 @@ func NewTaggingController(
114116
resources []string,
115117
rateLimit float64,
116118
burstLimit int,
117-
workerCount int) (*Controller, error) {
118-
119+
workerCount int,
120+
batchingEnabled bool) (*Controller, error) {
119121
awsCloud, ok := cloud.(*awsv1.Cloud)
120122
if !ok {
121123
err := fmt.Errorf("tagging controller does not support %v provider", cloud.ProviderName())
@@ -152,6 +154,7 @@ func NewTaggingController(
152154
nodeMonitorPeriod: nodeMonitorPeriod,
153155
rateLimitEnabled: rateLimitEnabled,
154156
workerCount: workerCount,
157+
batchingEnabled: batchingEnabled,
155158
}
156159

157160
// Use shared informer to listen to add/update/delete of nodes. Note that any nodes
@@ -316,10 +319,13 @@ func (tc *Controller) tagEc2Instance(node *v1.Node) error {
316319
klog.Infof("Skip tagging node %s since it was already tagged earlier.", node.GetName())
317320
return nil
318321
}
319-
322+
var err error
320323
instanceID, _ := awsv1.KubernetesInstanceID(node.Spec.ProviderID).MapToAWSInstanceID()
321-
322-
err := tc.cloud.TagResource(string(instanceID), tc.tags)
324+
if tc.batchingEnabled {
325+
err = tc.cloud.TagResourceBatch(context.TODO(), string(instanceID), tc.tags)
326+
} else {
327+
err = tc.cloud.TagResource(string(instanceID), tc.tags)
328+
}
323329

324330
if err != nil {
325331
if awsv1.IsAWSErrorInstanceNotFound(err) {
@@ -375,7 +381,12 @@ func (tc *Controller) untagNodeResources(node *taggingControllerNode) error {
375381
func (tc *Controller) untagEc2Instance(node *taggingControllerNode) error {
376382
instanceID, _ := awsv1.KubernetesInstanceID(node.providerID).MapToAWSInstanceID()
377383

378-
err := tc.cloud.UntagResource(string(instanceID), tc.tags)
384+
var err error
385+
if tc.batchingEnabled {
386+
err = tc.cloud.UntagResourceBatch(context.TODO(), string(instanceID), tc.tags)
387+
} else {
388+
err = tc.cloud.UntagResource(string(instanceID), tc.tags)
389+
}
379390

380391
if err != nil {
381392
klog.Errorf("Error in untagging EC2 instance %s for node %s, error: %v", instanceID, node.name, err)

0 commit comments

Comments
 (0)