Skip to content

Commit e84ab11

Browse files
committed
Resolve Synk findings CWE-674 and CWE-674
1 parent 1f83849 commit e84ab11

27 files changed

+505
-703
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# syntax=docker/dockerfile:experimental
22

3-
FROM --platform=${TARGETPLATFORM} public.ecr.aws/docker/library/golang:1.21.8 AS base
3+
FROM --platform=${TARGETPLATFORM} public.ecr.aws/docker/library/golang:1.23.8 AS base
44
WORKDIR /workspace
55
# Copy the Go Modules manifests
66
COPY go.mod go.mod

controllers/elbv2/eventhandlers/endpoints.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type enqueueRequestsForEndpointsEvent struct {
3333
}
3434

3535
// Create is called in response to an create event - e.g. Pod Creation.
36-
func (h *enqueueRequestsForEndpointsEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
36+
func (h *enqueueRequestsForEndpointsEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
3737
epNew, ok := e.Object.(*corev1.Endpoints)
3838
if !ok {
3939
return
@@ -42,7 +42,7 @@ func (h *enqueueRequestsForEndpointsEvent) Create(ctx context.Context, e event.C
4242
}
4343

4444
// Update is called in response to an update event - e.g. Pod Updated.
45-
func (h *enqueueRequestsForEndpointsEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
45+
func (h *enqueueRequestsForEndpointsEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
4646
epOld, ok := e.ObjectOld.(*corev1.Endpoints)
4747
if !ok {
4848
return
@@ -57,7 +57,7 @@ func (h *enqueueRequestsForEndpointsEvent) Update(ctx context.Context, e event.U
5757
}
5858

5959
// Delete is called in response to a delete event - e.g. Pod Deleted.
60-
func (h *enqueueRequestsForEndpointsEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
60+
func (h *enqueueRequestsForEndpointsEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
6161
epOld, ok := e.Object.(*corev1.Endpoints)
6262
if !ok {
6363
return
@@ -67,10 +67,10 @@ func (h *enqueueRequestsForEndpointsEvent) Delete(ctx context.Context, e event.D
6767

6868
// Generic is called in response to an event of an unknown type or a synthetic event triggered as a cron or
6969
// external trigger request - e.g. reconcile AutoScaling, or a WebHook.
70-
func (h *enqueueRequestsForEndpointsEvent) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface) {
70+
func (h *enqueueRequestsForEndpointsEvent) Generic(context.Context, event.GenericEvent, workqueue.TypedRateLimitingInterface[reconcile.Request]) {
7171
}
7272

73-
func (h *enqueueRequestsForEndpointsEvent) enqueueImpactedTargetGroupBindings(queue workqueue.RateLimitingInterface, ep *corev1.Endpoints) {
73+
func (h *enqueueRequestsForEndpointsEvent) enqueueImpactedTargetGroupBindings(queue workqueue.TypedRateLimitingInterface[reconcile.Request], ep *corev1.Endpoints) {
7474
tgbList := &elbv2api.TargetGroupBindingList{}
7575
if err := h.k8sClient.List(context.Background(), tgbList,
7676
client.InNamespace(ep.Namespace),

controllers/elbv2/eventhandlers/endpoints_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import (
1818
ctrl "sigs.k8s.io/controller-runtime"
1919
"sigs.k8s.io/controller-runtime/pkg/client"
2020
"sigs.k8s.io/controller-runtime/pkg/controller/controllertest"
21+
"sigs.k8s.io/controller-runtime/pkg/log"
22+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
2123
)
2224

2325
func Test_enqueueRequestsForEndpointsEvent_enqueueImpactedTargetGroupBindings(t *testing.T) {
@@ -169,11 +171,11 @@ func Test_enqueueRequestsForEndpointsEvent_enqueueImpactedTargetGroupBindings(t
169171

170172
h := &enqueueRequestsForEndpointsEvent{
171173
k8sClient: k8sClient,
172-
logger: logr.Discard(),
174+
logger: logr.New(&log.NullLogSink{}),
173175
}
174-
queue := controllertest.Queue{Interface: workqueue.New()}
175-
h.enqueueImpactedTargetGroupBindings(&queue, tt.args.eps)
176-
gotRequests := testutils.ExtractCTRLRequestsFromQueue(&queue)
176+
queue := &controllertest.TypedQueue[reconcile.Request]{TypedInterface: workqueue.NewTyped[reconcile.Request]()}
177+
h.enqueueImpactedTargetGroupBindings(queue, tt.args.eps)
178+
gotRequests := testutils.ExtractCTRLRequestsFromQueue(queue)
177179
assert.True(t, cmp.Equal(tt.wantRequests, gotRequests),
178180
"diff", cmp.Diff(tt.wantRequests, gotRequests))
179181
})

controllers/elbv2/eventhandlers/endpointslices.go

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -36,48 +36,36 @@ type enqueueRequestsForEndpointSlicesEvent struct {
3636
}
3737

3838
// Create is called in response to an create event - e.g. EndpointSlice Creation.
39-
func (h *enqueueRequestsForEndpointSlicesEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
40-
epNew, ok := e.Object.(*discv1.EndpointSlice)
41-
if !ok {
42-
return
43-
}
39+
func (h *enqueueRequestsForEndpointSlicesEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
40+
epNew := e.Object.(*discv1.EndpointSlice)
4441
h.logger.V(1).Info("Create event for EndpointSlices", "name", epNew.Name)
45-
h.enqueueImpactedTargetGroupBindings(queue, epNew)
42+
h.enqueueImpactedTargetGroupBindings(ctx, queue, epNew)
4643
}
4744

4845
// Update is called in response to an update event - e.g. EndpointSlice Updated.
49-
func (h *enqueueRequestsForEndpointSlicesEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
50-
epOld, ok := e.ObjectOld.(*discv1.EndpointSlice)
51-
if !ok {
52-
return
53-
}
54-
epNew, ok := e.ObjectNew.(*discv1.EndpointSlice)
55-
if !ok {
56-
return
57-
}
46+
func (h *enqueueRequestsForEndpointSlicesEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
47+
epOld := e.ObjectOld.(*discv1.EndpointSlice)
48+
epNew := e.ObjectNew.(*discv1.EndpointSlice)
5849
h.logger.V(1).Info("Update event for EndpointSlices", "name", epNew.Name)
5950
if !equality.Semantic.DeepEqual(epOld.Ports, epNew.Ports) || !equality.Semantic.DeepEqual(epOld.Endpoints, epNew.Endpoints) {
6051
h.logger.V(1).Info("Enqueue EndpointSlice", "name", epNew.Name)
61-
h.enqueueImpactedTargetGroupBindings(queue, epNew)
52+
h.enqueueImpactedTargetGroupBindings(ctx, queue, epNew)
6253
}
6354
}
6455

6556
// Delete is called in response to a delete event - e.g. EndpointSlice Deleted.
66-
func (h *enqueueRequestsForEndpointSlicesEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
67-
epOld, ok := e.Object.(*discv1.EndpointSlice)
68-
if !ok {
69-
return
70-
}
57+
func (h *enqueueRequestsForEndpointSlicesEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
58+
epOld := e.Object.(*discv1.EndpointSlice)
7159
h.logger.V(1).Info("Deletion event for EndpointSlices", "name", epOld.Name)
72-
h.enqueueImpactedTargetGroupBindings(queue, epOld)
60+
h.enqueueImpactedTargetGroupBindings(ctx, queue, epOld)
7361
}
7462

7563
// Generic is called in response to an event of an unknown type or a synthetic event triggered as a cron or
7664
// external trigger request - e.g. reconcile AutoScaling, or a WebHook.
77-
func (h *enqueueRequestsForEndpointSlicesEvent) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface) {
65+
func (h *enqueueRequestsForEndpointSlicesEvent) Generic(context.Context, event.GenericEvent, workqueue.TypedRateLimitingInterface[reconcile.Request]) {
7866
}
7967

80-
func (h *enqueueRequestsForEndpointSlicesEvent) enqueueImpactedTargetGroupBindings(queue workqueue.RateLimitingInterface, epSlice *discv1.EndpointSlice) {
68+
func (h *enqueueRequestsForEndpointSlicesEvent) enqueueImpactedTargetGroupBindings(ctx context.Context, queue workqueue.TypedRateLimitingInterface[reconcile.Request], epSlice *discv1.EndpointSlice) {
8169
tgbList := &elbv2api.TargetGroupBindingList{}
8270
svcName, present := epSlice.Labels[svcNameLabel]
8371
if !present {

controllers/elbv2/eventhandlers/endpointslices_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"context"
55
"testing"
66

7+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
8+
79
"github.com/go-logr/logr"
810
"github.com/golang/mock/gomock"
911
"github.com/google/go-cmp/cmp"
@@ -15,9 +17,9 @@ import (
1517
elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1"
1618
mock_client "sigs.k8s.io/aws-load-balancer-controller/mocks/controller-runtime/client"
1719
"sigs.k8s.io/aws-load-balancer-controller/pkg/testutils"
18-
ctrl "sigs.k8s.io/controller-runtime"
1920
"sigs.k8s.io/controller-runtime/pkg/client"
2021
"sigs.k8s.io/controller-runtime/pkg/controller/controllertest"
22+
"sigs.k8s.io/controller-runtime/pkg/log"
2123
)
2224

2325
func Test_enqueueRequestsForEndpointSlicesEvent_enqueueImpactedTargetGroupBindings(t *testing.T) {
@@ -39,7 +41,7 @@ func Test_enqueueRequestsForEndpointSlicesEvent_enqueueImpactedTargetGroupBindin
3941
name string
4042
fields fields
4143
args args
42-
wantRequests []ctrl.Request
44+
wantRequests []reconcile.Request
4345
}{
4446
{
4547
name: "service event should enqueue impacted ip TargetType TGBs",
@@ -91,7 +93,7 @@ func Test_enqueueRequestsForEndpointSlicesEvent_enqueueImpactedTargetGroupBindin
9193
},
9294
},
9395
},
94-
wantRequests: []ctrl.Request{
96+
wantRequests: []reconcile.Request{
9597
{
9698
NamespacedName: types.NamespacedName{Namespace: "awesome-ns", Name: "tgb-1"},
9799
},
@@ -141,7 +143,7 @@ func Test_enqueueRequestsForEndpointSlicesEvent_enqueueImpactedTargetGroupBindin
141143
},
142144
},
143145
},
144-
wantRequests: []ctrl.Request{
146+
wantRequests: []reconcile.Request{
145147
{
146148
NamespacedName: types.NamespacedName{Namespace: "awesome-ns", Name: "tgb-1"},
147149
},
@@ -171,11 +173,11 @@ func Test_enqueueRequestsForEndpointSlicesEvent_enqueueImpactedTargetGroupBindin
171173

172174
h := &enqueueRequestsForEndpointSlicesEvent{
173175
k8sClient: k8sClient,
174-
logger: logr.Discard(),
176+
logger: logr.New(&log.NullLogSink{}),
175177
}
176-
queue := controllertest.Queue{Interface: workqueue.New()}
177-
h.enqueueImpactedTargetGroupBindings(&queue, tt.args.epslice)
178-
gotRequests := testutils.ExtractCTRLRequestsFromQueue(&queue)
178+
queue := &controllertest.TypedQueue[reconcile.Request]{TypedInterface: workqueue.NewTyped[reconcile.Request]()}
179+
h.enqueueImpactedTargetGroupBindings(context.Background(), queue, tt.args.epslice)
180+
gotRequests := testutils.ExtractCTRLRequestsFromQueue(queue)
179181
assert.True(t, cmp.Equal(tt.wantRequests, gotRequests),
180182
"diff", cmp.Diff(tt.wantRequests, gotRequests))
181183
})

controllers/elbv2/eventhandlers/node.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type enqueueRequestsForNodeEvent struct {
3131
}
3232

3333
// Create is called in response to an create event - e.g. Pod Creation.
34-
func (h *enqueueRequestsForNodeEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
34+
func (h *enqueueRequestsForNodeEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
3535
nodeNew, ok := e.Object.(*corev1.Node)
3636
if !ok {
3737
return
@@ -40,7 +40,7 @@ func (h *enqueueRequestsForNodeEvent) Create(ctx context.Context, e event.Create
4040
}
4141

4242
// Update is called in response to an update event - e.g. Pod Updated.
43-
func (h *enqueueRequestsForNodeEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
43+
func (h *enqueueRequestsForNodeEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
4444
nodeOld, ok := e.ObjectOld.(*corev1.Node)
4545
if !ok {
4646
return
@@ -53,7 +53,7 @@ func (h *enqueueRequestsForNodeEvent) Update(ctx context.Context, e event.Update
5353
}
5454

5555
// Delete is called in response to a delete event - e.g. Pod Deleted.
56-
func (h *enqueueRequestsForNodeEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
56+
func (h *enqueueRequestsForNodeEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
5757
nodeOld, ok := e.Object.(*corev1.Node)
5858
if !ok {
5959
return
@@ -63,12 +63,12 @@ func (h *enqueueRequestsForNodeEvent) Delete(ctx context.Context, e event.Delete
6363

6464
// Generic is called in response to an event of an unknown type or a synthetic event triggered as a cron or
6565
// external trigger request - e.g. reconcile AutoScaling, or a WebHook.
66-
func (h *enqueueRequestsForNodeEvent) Generic(ctx context.Context, e event.GenericEvent, queue workqueue.RateLimitingInterface) {
66+
func (h *enqueueRequestsForNodeEvent) Generic(ctx context.Context, e event.GenericEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
6767
// nothing to do here
6868
}
6969

7070
// enqueueImpactedTargetGroupBindings will enqueue all impacted TargetGroupBindings for node events.
71-
func (h *enqueueRequestsForNodeEvent) enqueueImpactedTargetGroupBindings(queue workqueue.RateLimitingInterface, nodeOld *corev1.Node, nodeNew *corev1.Node) {
71+
func (h *enqueueRequestsForNodeEvent) enqueueImpactedTargetGroupBindings(queue workqueue.TypedRateLimitingInterface[reconcile.Request], nodeOld *corev1.Node, nodeNew *corev1.Node) {
7272
var nodeKey types.NamespacedName
7373
nodeOldSuitableAsTrafficProxy := false
7474
nodeNewSuitableAsTrafficProxy := false

controllers/elbv2/eventhandlers/service.go

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,46 +31,34 @@ type enqueueRequestsForServiceEvent struct {
3131
}
3232

3333
// Create is called in response to an create event - e.g. Pod Creation.
34-
func (h *enqueueRequestsForServiceEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
35-
svcNew, ok := e.Object.(*corev1.Service)
36-
if !ok {
37-
return
38-
}
39-
h.enqueueImpactedTargetGroupBindings(queue, svcNew)
34+
func (h *enqueueRequestsForServiceEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
35+
svcNew := e.Object.(*corev1.Service)
36+
h.enqueueImpactedTargetGroupBindings(ctx, queue, svcNew)
4037
}
4138

4239
// Update is called in response to an update event - e.g. Pod Updated.
43-
func (h *enqueueRequestsForServiceEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
44-
svcOld, ok := e.ObjectOld.(*corev1.Service)
45-
if !ok {
46-
return
47-
}
48-
svcNew, ok := e.ObjectNew.(*corev1.Service)
49-
if !ok {
50-
return
51-
}
40+
func (h *enqueueRequestsForServiceEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
41+
svcOld := e.ObjectOld.(*corev1.Service)
42+
svcNew := e.ObjectNew.(*corev1.Service)
5243
if !equality.Semantic.DeepEqual(svcOld.Spec.Ports, svcNew.Spec.Ports) {
53-
h.enqueueImpactedTargetGroupBindings(queue, svcNew)
44+
h.enqueueImpactedTargetGroupBindings(ctx, queue, svcNew)
5445
}
5546
}
5647

5748
// Delete is called in response to a delete event - e.g. Pod Deleted.
58-
func (h *enqueueRequestsForServiceEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
59-
svcOld, ok := e.Object.(*corev1.Service)
60-
if !ok {
61-
return
62-
}
63-
h.enqueueImpactedTargetGroupBindings(queue, svcOld)
49+
func (h *enqueueRequestsForServiceEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
50+
svcOld := e.Object.(*corev1.Service)
51+
h.enqueueImpactedTargetGroupBindings(ctx, queue, svcOld)
6452
}
6553

6654
// Generic is called in response to an event of an unknown type or a synthetic event triggered as a cron or
6755
// external trigger request - e.g. reconcile AutoScaling, or a WebHook.
68-
func (h *enqueueRequestsForServiceEvent) Generic(ctx context.Context, e event.GenericEvent, queue workqueue.RateLimitingInterface) {
56+
func (h *enqueueRequestsForServiceEvent) Generic(context.Context, event.GenericEvent, workqueue.TypedRateLimitingInterface[reconcile.Request]) {
6957
// nothing to do here
7058
}
7159

7260
// enqueueImpactedEndpointBindings will enqueue all impacted TargetGroupBindings for service events.
73-
func (h *enqueueRequestsForServiceEvent) enqueueImpactedTargetGroupBindings(queue workqueue.RateLimitingInterface, svc *corev1.Service) {
61+
func (h *enqueueRequestsForServiceEvent) enqueueImpactedTargetGroupBindings(ctx context.Context, queue workqueue.TypedRateLimitingInterface[reconcile.Request], svc *corev1.Service) {
7462
tgbList := &elbv2api.TargetGroupBindingList{}
7563
if err := h.k8sClient.List(context.Background(), tgbList,
7664
client.InNamespace(svc.Namespace),

controllers/elbv2/eventhandlers/service_test.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"context"
55
"testing"
66

7+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
8+
79
"github.com/go-logr/logr"
810
"github.com/golang/mock/gomock"
911
"github.com/google/go-cmp/cmp"
@@ -16,9 +18,9 @@ import (
1618
elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1"
1719
mock_client "sigs.k8s.io/aws-load-balancer-controller/mocks/controller-runtime/client"
1820
"sigs.k8s.io/aws-load-balancer-controller/pkg/testutils"
19-
ctrl "sigs.k8s.io/controller-runtime"
2021
"sigs.k8s.io/controller-runtime/pkg/client"
2122
"sigs.k8s.io/controller-runtime/pkg/controller/controllertest"
23+
"sigs.k8s.io/controller-runtime/pkg/log"
2224
)
2325

2426
func Test_enqueueRequestsForServiceEvent_enqueueImpactedTargetGroupBindings(t *testing.T) {
@@ -40,7 +42,7 @@ func Test_enqueueRequestsForServiceEvent_enqueueImpactedTargetGroupBindings(t *t
4042
name string
4143
fields fields
4244
args args
43-
wantRequests []ctrl.Request
45+
wantRequests []reconcile.Request
4446
}{
4547
{
4648
name: "service event should enqueue impacted instance TargetType TGBs",
@@ -101,7 +103,7 @@ func Test_enqueueRequestsForServiceEvent_enqueueImpactedTargetGroupBindings(t *t
101103
},
102104
},
103105
},
104-
wantRequests: []ctrl.Request{
106+
wantRequests: []reconcile.Request{
105107
{
106108
NamespacedName: types.NamespacedName{Namespace: "awesome-ns", Name: "tgb-1"},
107109
},
@@ -160,7 +162,7 @@ func Test_enqueueRequestsForServiceEvent_enqueueImpactedTargetGroupBindings(t *t
160162
},
161163
},
162164
},
163-
wantRequests: []ctrl.Request{
165+
wantRequests: []reconcile.Request{
164166
{
165167
NamespacedName: types.NamespacedName{Namespace: "awesome-ns", Name: "tgb-1"},
166168
},
@@ -190,11 +192,11 @@ func Test_enqueueRequestsForServiceEvent_enqueueImpactedTargetGroupBindings(t *t
190192

191193
h := &enqueueRequestsForServiceEvent{
192194
k8sClient: k8sClient,
193-
logger: logr.Discard(),
195+
logger: logr.New(&log.NullLogSink{}),
194196
}
195-
queue := controllertest.Queue{Interface: workqueue.New()}
196-
h.enqueueImpactedTargetGroupBindings(&queue, tt.args.svc)
197-
gotRequests := testutils.ExtractCTRLRequestsFromQueue(&queue)
197+
queue := &controllertest.TypedQueue[reconcile.Request]{TypedInterface: workqueue.NewTyped[reconcile.Request]()}
198+
h.enqueueImpactedTargetGroupBindings(context.Background(), queue, tt.args.svc)
199+
gotRequests := testutils.ExtractCTRLRequestsFromQueue(queue)
198200
assert.True(t, cmp.Equal(tt.wantRequests, gotRequests),
199201
"diff", cmp.Diff(tt.wantRequests, gotRequests))
200202
})

controllers/elbv2/targetgroupbinding_controller.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"sigs.k8s.io/aws-load-balancer-controller/pkg/runtime"
3434
"sigs.k8s.io/aws-load-balancer-controller/pkg/targetgroupbinding"
3535
"sigs.k8s.io/controller-runtime/pkg/controller"
36+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
3637

3738
"github.com/go-logr/logr"
3839
ctrl "sigs.k8s.io/controller-runtime"
@@ -171,7 +172,7 @@ func (r *targetGroupBindingReconciler) SetupWithManager(ctx context.Context, mgr
171172
Watches(&corev1.Node{}, nodeEventsHandler).
172173
WithOptions(controller.Options{
173174
MaxConcurrentReconciles: r.maxConcurrentReconciles,
174-
RateLimiter: workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, r.maxExponentialBackoffDelay)}).
175+
RateLimiter: workqueue.NewTypedItemExponentialFailureRateLimiter[reconcile.Request](5*time.Millisecond, r.maxExponentialBackoffDelay)}).
175176
Complete(r)
176177
} else {
177178
epsEventsHandler := eventhandlers.NewEnqueueRequestsForEndpointsEvent(r.k8sClient,
@@ -184,7 +185,7 @@ func (r *targetGroupBindingReconciler) SetupWithManager(ctx context.Context, mgr
184185
Watches(&corev1.Node{}, nodeEventsHandler).
185186
WithOptions(controller.Options{
186187
MaxConcurrentReconciles: r.maxConcurrentReconciles,
187-
RateLimiter: workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, r.maxExponentialBackoffDelay)}).
188+
RateLimiter: workqueue.NewTypedItemExponentialFailureRateLimiter[reconcile.Request](5*time.Millisecond, r.maxExponentialBackoffDelay)}).
188189
Complete(r)
189190
}
190191
}

0 commit comments

Comments
 (0)