Skip to content

Commit bcefb6c

Browse files
committed
add tagging files
1 parent b82bcf9 commit bcefb6c

5 files changed

Lines changed: 59 additions & 58 deletions

File tree

go.mod

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ go 1.23.6
44

55
require (
66
github.com/aws/aws-sdk-go v1.55.5
7-
github.com/aws/aws-sdk-go-v2 v1.32.5
8-
github.com/aws/aws-sdk-go-v2/config v1.28.0
7+
github.com/aws/aws-sdk-go-v2 v1.36.3
8+
github.com/aws/aws-sdk-go-v2/config v1.29.14
99
github.com/aws/aws-sdk-go-v2/service/ecr v1.36.2
1010
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.27.2
1111
github.com/spf13/cobra v1.8.1
@@ -35,18 +35,18 @@ require (
3535
github.com/NYTimes/gziphandler v1.1.1 // indirect
3636
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
3737
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
38-
github.com/aws/aws-sdk-go-v2/credentials v1.17.41
39-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect
40-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.24 // indirect
41-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.24 // indirect
42-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
38+
github.com/aws/aws-sdk-go-v2/credentials v1.17.67
39+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 // indirect
40+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 // indirect
41+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 // indirect
42+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
4343
github.com/aws/aws-sdk-go-v2/service/ec2 v1.186.0
44-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
45-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.5 // indirect
46-
github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 // indirect
47-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 // indirect
48-
github.com/aws/aws-sdk-go-v2/service/sts v1.33.1
49-
github.com/aws/smithy-go v1.22.1
44+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 // indirect
45+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 // indirect
46+
github.com/aws/aws-sdk-go-v2/service/sso v1.25.3 // indirect
47+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.1 // indirect
48+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.19
49+
github.com/aws/smithy-go v1.22.2
5050
github.com/beorn7/perks v1.0.1 // indirect
5151
github.com/blang/semver/v4 v4.0.0 // indirect
5252
github.com/cenkalti/backoff/v4 v4.3.0 // indirect

go.sum

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,38 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3d
1010
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
1111
github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU=
1212
github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
13-
github.com/aws/aws-sdk-go-v2 v1.32.5 h1:U8vdWJuY7ruAkzaOdD7guwJjD06YSKmnKCJs7s3IkIo=
14-
github.com/aws/aws-sdk-go-v2 v1.32.5/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U=
15-
github.com/aws/aws-sdk-go-v2/config v1.28.0 h1:FosVYWcqEtWNxHn8gB/Vs6jOlNwSoyOCA/g/sxyySOQ=
16-
github.com/aws/aws-sdk-go-v2/config v1.28.0/go.mod h1:pYhbtvg1siOOg8h5an77rXle9tVG8T+BWLWAo7cOukc=
17-
github.com/aws/aws-sdk-go-v2/credentials v1.17.41 h1:7gXo+Axmp+R4Z+AK8YFQO0ZV3L0gizGINCOWxSLY9W8=
18-
github.com/aws/aws-sdk-go-v2/credentials v1.17.41/go.mod h1:u4Eb8d3394YLubphT4jLEwN1rLNq2wFOlT6OuxFwPzU=
19-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 h1:TMH3f/SCAWdNtXXVPPu5D6wrr4G5hI1rAxbcocKfC7Q=
20-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17/go.mod h1:1ZRXLdTpzdJb9fwTMXiLipENRxkGMTn1sfKexGllQCw=
21-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.24 h1:4usbeaes3yJnCFC7kfeyhkdkPtoRYPa/hTmCqMpKpLI=
22-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.24/go.mod h1:5CI1JemjVwde8m2WG3cz23qHKPOxbpkq0HaoreEgLIY=
23-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.24 h1:N1zsICrQglfzaBnrfM0Ys00860C+QFwu6u/5+LomP+o=
24-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.24/go.mod h1:dCn9HbJ8+K31i8IQ8EWmWj0EiIk0+vKiHNMxTTYveAg=
25-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ=
26-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
13+
github.com/aws/aws-sdk-go-v2 v1.36.3 h1:mJoei2CxPutQVxaATCzDUjcZEjVRdpsiiXi2o38yqWM=
14+
github.com/aws/aws-sdk-go-v2 v1.36.3/go.mod h1:LLXuLpgzEbD766Z5ECcRmi8AzSwfZItDtmABVkRLGzg=
15+
github.com/aws/aws-sdk-go-v2/config v1.29.14 h1:f+eEi/2cKCg9pqKBoAIwRGzVb70MRKqWX4dg1BDcSJM=
16+
github.com/aws/aws-sdk-go-v2/config v1.29.14/go.mod h1:wVPHWcIFv3WO89w0rE10gzf17ZYy+UVS1Geq8Iei34g=
17+
github.com/aws/aws-sdk-go-v2/credentials v1.17.67 h1:9KxtdcIA/5xPNQyZRgUSpYOE6j9Bc4+D7nZua0KGYOM=
18+
github.com/aws/aws-sdk-go-v2/credentials v1.17.67/go.mod h1:p3C44m+cfnbv763s52gCqrjaqyPikj9Sg47kUVaNZQQ=
19+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30 h1:x793wxmUWVDhshP8WW2mlnXuFrO4cOd3HLBroh1paFw=
20+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.30/go.mod h1:Jpne2tDnYiFascUEs2AWHJL9Yp7A5ZVy3TNyxaAjD6M=
21+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34 h1:ZK5jHhnrioRkUNOc+hOgQKlUL5JeC3S6JgLxtQ+Rm0Q=
22+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.34/go.mod h1:p4VfIceZokChbA9FzMbRGz5OV+lekcVtHlPKEO0gSZY=
23+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34 h1:SZwFm17ZUNNg5Np0ioo/gq8Mn6u9w19Mri8DnJ15Jf0=
24+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.34/go.mod h1:dFZsC0BLo346mvKQLWmoJxT+Sjp+qcVR1tRVHQGOH9Q=
25+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 h1:bIqFDwgGXXN1Kpp99pDOdKMTTb5d2KyU5X/BZxjOkRo=
26+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3/go.mod h1:H5O/EsxDWyU+LP/V8i5sm8cxoZgc2fdNR9bxlOFrQTo=
2727
github.com/aws/aws-sdk-go-v2/service/ec2 v1.186.0 h1:n2l2WeV+lEABrGwG/4MsE0WFEbd3j7yKsmZzbnEm5CY=
2828
github.com/aws/aws-sdk-go-v2/service/ec2 v1.186.0/go.mod h1:kYXaB4FzyhEJjvrJ84oPnMElLiEAjGxxUunVW2tBSng=
2929
github.com/aws/aws-sdk-go-v2/service/ecr v1.36.2 h1:VDQaVwGOokbd3VUbHF+wupiffdrbAZPdQnr5XZMJqrs=
3030
github.com/aws/aws-sdk-go-v2/service/ecr v1.36.2/go.mod h1:lvUlMghKYmSxSfv0vU7pdU/8jSY+s0zpG8xXhaGKCw0=
3131
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.27.2 h1:Zru9Iy2JPM5+uRnFnoqeOZzi8JIVIHJ0ua6JdeDHcyg=
3232
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.27.2/go.mod h1:PtQC3XjutCYFCn1+i8+wtpDaXvEK+vXF2gyLIKAmh4A=
33-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhvDxB6kPvEXgsDhGaZCSC6LQET5ZHSdJozeI0Y=
34-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE=
35-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.5 h1:wtpJ4zcwrSbwhECWQoI/g6WM9zqCcSpHDJIWSbMLOu4=
36-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.5/go.mod h1:qu/W9HXQbbQ4+1+JcZp0ZNPV31ym537ZJN+fiS7Ti8E=
37-
github.com/aws/aws-sdk-go-v2/service/sso v1.24.2 h1:bSYXVyUzoTHoKalBmwaZxs97HU9DWWI3ehHSAMa7xOk=
38-
github.com/aws/aws-sdk-go-v2/service/sso v1.24.2/go.mod h1:skMqY7JElusiOUjMJMOv1jJsP7YUg7DrhgqZZWuzu1U=
39-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2 h1:AhmO1fHINP9vFYUE0LHzCWg/LfUWUF+zFPEcY9QXb7o=
40-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.2/go.mod h1:o8aQygT2+MVP0NaV6kbdE1YnnIM8RRVQzoeUH45GOdI=
41-
github.com/aws/aws-sdk-go-v2/service/sts v1.33.1 h1:6SZUVRQNvExYlMLbHdlKB48x0fLbc2iVROyaNEwBHbU=
42-
github.com/aws/aws-sdk-go-v2/service/sts v1.33.1/go.mod h1:GqWyYCwLXnlUB1lOAXQyNSPqPLQJvmo8J0DWBzp9mtg=
43-
github.com/aws/smithy-go v1.22.1 h1:/HPHZQ0g7f4eUeK6HKglFz8uwVfZKgoI25rb/J+dnro=
44-
github.com/aws/smithy-go v1.22.1/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
33+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3 h1:eAh2A4b5IzM/lum78bZ590jy36+d/aFLgKF/4Vd1xPE=
34+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.3/go.mod h1:0yKJC/kb8sAnmlYa6Zs3QVYqaC8ug2AbnNChv5Ox3uA=
35+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15 h1:dM9/92u2F1JbDaGooxTq18wmmFzbJRfXfVfy96/1CXM=
36+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.15/go.mod h1:SwFBy2vjtA0vZbjjaFtfN045boopadnoVPhu4Fv66vY=
37+
github.com/aws/aws-sdk-go-v2/service/sso v1.25.3 h1:1Gw+9ajCV1jogloEv1RRnvfRFia2cL6c9cuKV2Ps+G8=
38+
github.com/aws/aws-sdk-go-v2/service/sso v1.25.3/go.mod h1:qs4a9T5EMLl/Cajiw2TcbNt2UNo/Hqlyp+GiuG4CFDI=
39+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.1 h1:hXmVKytPfTy5axZ+fYbR5d0cFmC3JvwLm5kM83luako=
40+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.30.1/go.mod h1:MlYRNmYu/fGPoxBQVvBYr9nyr948aY/WLUvwBMBJubs=
41+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.19 h1:1XuUZ8mYJw9B6lzAkXhqHlJd/XvaX32evhproijJEZY=
42+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.19/go.mod h1:cQnB8CUnxbMU82JvlqjKR2HBOm3fe9pWorWBza6MBJ4=
43+
github.com/aws/smithy-go v1.22.2 h1:6D9hW43xKFrRx/tXXfAlIZc4JI+yQe6snnWcQyxSyLQ=
44+
github.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
4545
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
4646
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
4747
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=

pkg/controllers/tagging/tagging_controller.go

Lines changed: 16 additions & 15 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"
@@ -185,7 +186,7 @@ func NewTaggingController(
185186

186187
// Run will start the controller to tag resources attached to the cluster
187188
// and untag resources detached from the cluster.
188-
func (tc *Controller) Run(stopCh <-chan struct{}) {
189+
func (tc *Controller) Run(ctx context.Context, stopCh <-chan struct{}) {
189190
defer utilruntime.HandleCrash()
190191
defer tc.workqueue.ShutDown()
191192

@@ -198,22 +199,22 @@ func (tc *Controller) Run(stopCh <-chan struct{}) {
198199

199200
klog.Infof("Starting the tagging controller")
200201
for i := 0; i < tc.workerCount; i++ {
201-
go wait.Until(tc.work, tc.nodeMonitorPeriod, stopCh)
202+
go wait.Until(func() { tc.work(ctx) }, tc.nodeMonitorPeriod, stopCh)
202203
}
203204

204205
<-stopCh
205206
}
206207

207208
// work is a long-running function that continuously
208209
// call process() for each message on the workqueue
209-
func (tc *Controller) work() {
210-
for tc.process() {
210+
func (tc *Controller) work(ctx context.Context) {
211+
for tc.process(ctx) {
211212
}
212213
}
213214

214215
// process reads each message in the queue and performs either
215216
// tag or untag function on the Node object
216-
func (tc *Controller) process() bool {
217+
func (tc *Controller) process(ctx context.Context) bool {
217218
obj, shutdown := tc.workqueue.Get()
218219
if shutdown {
219220
return false
@@ -247,12 +248,12 @@ func (tc *Controller) process() bool {
247248
return nil
248249
}
249250
if workItem.action == addTag {
250-
err = tc.tagNodesResources(&taggingControllerNode{
251+
err = tc.tagNodesResources(ctx, &taggingControllerNode{
251252
name: workItem.name,
252253
providerID: workItem.providerID,
253254
})
254255
} else {
255-
err = tc.untagNodeResources(&taggingControllerNode{
256+
err = tc.untagNodeResources(ctx, &taggingControllerNode{
256257
name: workItem.name,
257258
providerID: workItem.providerID,
258259
})
@@ -287,7 +288,7 @@ func (tc *Controller) process() bool {
287288

288289
// tagNodesResources tag node resources
289290
// If we want to tag more resources, modify this function appropriately
290-
func (tc *Controller) tagNodesResources(node *taggingControllerNode) error {
291+
func (tc *Controller) tagNodesResources(ctx context.Context, node *taggingControllerNode) error {
291292
for _, resource := range tc.resources {
292293
switch resource {
293294
case opt.Instance:
@@ -299,7 +300,7 @@ func (tc *Controller) tagNodesResources(node *taggingControllerNode) error {
299300
}
300301
return err
301302
}
302-
err = tc.tagEc2Instance(v1node)
303+
err = tc.tagEc2Instance(ctx, v1node)
303304
if err != nil {
304305
return err
305306
}
@@ -311,15 +312,15 @@ func (tc *Controller) tagNodesResources(node *taggingControllerNode) error {
311312

312313
// tagEc2Instances applies the provided tags to each EC2 instance in
313314
// the cluster.
314-
func (tc *Controller) tagEc2Instance(node *v1.Node) error {
315+
func (tc *Controller) tagEc2Instance(ctx context.Context, node *v1.Node) error {
315316
if !tc.isTaggingRequired(node) {
316317
klog.Infof("Skip tagging node %s since it was already tagged earlier.", node.GetName())
317318
return nil
318319
}
319320

320321
instanceID, _ := awsv1.KubernetesInstanceID(node.Spec.ProviderID).MapToAWSInstanceID()
321322

322-
err := tc.cloud.TagResource(string(instanceID), tc.tags)
323+
err := tc.cloud.TagResource(ctx, string(instanceID), tc.tags)
323324

324325
if err != nil {
325326
if awsv1.IsAWSErrorInstanceNotFound(err) {
@@ -352,11 +353,11 @@ func (tc *Controller) tagEc2Instance(node *v1.Node) error {
352353

353354
// untagNodeResources untag node resources
354355
// If we want to untag more resources, modify this function appropriately
355-
func (tc *Controller) untagNodeResources(node *taggingControllerNode) error {
356+
func (tc *Controller) untagNodeResources(ctx context.Context, node *taggingControllerNode) error {
356357
for _, resource := range tc.resources {
357358
switch resource {
358359
case opt.Instance:
359-
err := tc.untagEc2Instance(node)
360+
err := tc.untagEc2Instance(ctx, node)
360361
if err != nil {
361362
return err
362363
}
@@ -368,10 +369,10 @@ func (tc *Controller) untagNodeResources(node *taggingControllerNode) error {
368369

369370
// untagEc2Instances deletes the provided tags to each EC2 instances in
370371
// the cluster.
371-
func (tc *Controller) untagEc2Instance(node *taggingControllerNode) error {
372+
func (tc *Controller) untagEc2Instance(ctx context.Context, node *taggingControllerNode) error {
372373
instanceID, _ := awsv1.KubernetesInstanceID(node.providerID).MapToAWSInstanceID()
373374

374-
err := tc.cloud.UntagResource(string(instanceID), tc.tags)
375+
err := tc.cloud.UntagResource(ctx, string(instanceID), tc.tags)
375376

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

pkg/controllers/tagging/tagging_controller_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ func Test_NodesJoiningAndLeaving(t *testing.T) {
243243

244244
cnt := 0
245245
for tc.workqueue.Len() > 0 {
246-
tc.process()
246+
tc.process(context.TODO())
247247
cnt++
248248
// sleep briefly because of exponential backoff when requeueing failed workitem
249249
// resulting in workqueue to be empty if checked immediately
@@ -325,12 +325,12 @@ func TestMultipleEnqueues(t *testing.T) {
325325
t.Errorf("invalid work queue length, expected 3, got %d", tc.workqueue.Len())
326326
}
327327
// should handle the add tag properly
328-
tc.process()
328+
tc.process(context.TODO())
329329
if tc.workqueue.Len() != 2 {
330330
t.Errorf("invalid work queue length, expected 1, got %d", tc.workqueue.Len())
331331
}
332332
// should handle the delete tag properly
333-
tc.process()
333+
tc.process(context.TODO())
334334
if tc.workqueue.Len() != 1 {
335335
t.Errorf("invalid work queue length, expected 1, got %d", tc.workqueue.Len())
336336
}

pkg/controllers/tagging/tagging_controller_wrapper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (tc *ControllerWrapper) startTaggingController(ctx context.Context, initCon
5656
return nil, false, nil
5757
}
5858

59-
go taggingcontroller.Run(ctx.Done())
59+
go taggingcontroller.Run(ctx, ctx.Done())
6060

6161
return nil, true, nil
6262
}

0 commit comments

Comments
 (0)