Skip to content

Commit f1435b3

Browse files
authored
Merge pull request #4011 from zac-nixon/znixon/controller-runtime-bump
bump sigs.k8s.io/controller-runtime to v0.19.3
2 parents ba40696 + 10e5f72 commit f1435b3

21 files changed

+233
-232
lines changed

controllers/elbv2/eventhandlers/endpoints.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ 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 := e.Object.(*corev1.Endpoints)
3838
h.enqueueImpactedTargetGroupBindings(queue, epNew)
3939
}
4040

4141
// Update is called in response to an update event - e.g. Pod Updated.
42-
func (h *enqueueRequestsForEndpointsEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
42+
func (h *enqueueRequestsForEndpointsEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
4343
epOld := e.ObjectOld.(*corev1.Endpoints)
4444
epNew := e.ObjectNew.(*corev1.Endpoints)
4545
if !equality.Semantic.DeepEqual(epOld.Subsets, epNew.Subsets) {
@@ -48,17 +48,17 @@ func (h *enqueueRequestsForEndpointsEvent) Update(ctx context.Context, e event.U
4848
}
4949

5050
// Delete is called in response to a delete event - e.g. Pod Deleted.
51-
func (h *enqueueRequestsForEndpointsEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
51+
func (h *enqueueRequestsForEndpointsEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
5252
epOld := e.Object.(*corev1.Endpoints)
5353
h.enqueueImpactedTargetGroupBindings(queue, epOld)
5454
}
5555

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

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

controllers/elbv2/eventhandlers/endpoints_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package eventhandlers
22

33
import (
44
"context"
5+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
56
"testing"
67

78
"github.com/go-logr/logr"
@@ -15,7 +16,6 @@ import (
1516
elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1"
1617
mock_client "sigs.k8s.io/aws-load-balancer-controller/mocks/controller-runtime/client"
1718
"sigs.k8s.io/aws-load-balancer-controller/pkg/testutils"
18-
ctrl "sigs.k8s.io/controller-runtime"
1919
"sigs.k8s.io/controller-runtime/pkg/client"
2020
"sigs.k8s.io/controller-runtime/pkg/controller/controllertest"
2121
"sigs.k8s.io/controller-runtime/pkg/log"
@@ -40,7 +40,7 @@ func Test_enqueueRequestsForEndpointsEvent_enqueueImpactedTargetGroupBindings(t
4040
name string
4141
fields fields
4242
args args
43-
wantRequests []ctrl.Request
43+
wantRequests []reconcile.Request
4444
}{
4545
{
4646
name: "service event should enqueue impacted ip TargetType TGBs",
@@ -91,7 +91,7 @@ func Test_enqueueRequestsForEndpointsEvent_enqueueImpactedTargetGroupBindings(t
9191
},
9292
},
9393
},
94-
wantRequests: []ctrl.Request{
94+
wantRequests: []reconcile.Request{
9595
{
9696
NamespacedName: types.NamespacedName{Namespace: "awesome-ns", Name: "tgb-1"},
9797
},
@@ -140,7 +140,7 @@ func Test_enqueueRequestsForEndpointsEvent_enqueueImpactedTargetGroupBindings(t
140140
},
141141
},
142142
},
143-
wantRequests: []ctrl.Request{
143+
wantRequests: []reconcile.Request{
144144
{
145145
NamespacedName: types.NamespacedName{Namespace: "awesome-ns", Name: "tgb-1"},
146146
},
@@ -172,7 +172,7 @@ func Test_enqueueRequestsForEndpointsEvent_enqueueImpactedTargetGroupBindings(t
172172
k8sClient: k8sClient,
173173
logger: logr.New(&log.NullLogSink{}),
174174
}
175-
queue := &controllertest.Queue{Interface: workqueue.New()}
175+
queue := &controllertest.TypedQueue[reconcile.Request]{TypedInterface: workqueue.NewTyped[reconcile.Request]()}
176176
h.enqueueImpactedTargetGroupBindings(queue, tt.args.eps)
177177
gotRequests := testutils.ExtractCTRLRequestsFromQueue(queue)
178178
assert.True(t, cmp.Equal(tt.wantRequests, gotRequests),

controllers/elbv2/eventhandlers/endpointslices.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ 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) {
39+
func (h *enqueueRequestsForEndpointSlicesEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
4040
epNew := e.Object.(*discv1.EndpointSlice)
4141
h.logger.V(1).Info("Create event for EndpointSlices", "name", epNew.Name)
4242
h.enqueueImpactedTargetGroupBindings(ctx, queue, epNew)
4343
}
4444

4545
// Update is called in response to an update event - e.g. EndpointSlice Updated.
46-
func (h *enqueueRequestsForEndpointSlicesEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
46+
func (h *enqueueRequestsForEndpointSlicesEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
4747
epOld := e.ObjectOld.(*discv1.EndpointSlice)
4848
epNew := e.ObjectNew.(*discv1.EndpointSlice)
4949
h.logger.V(1).Info("Update event for EndpointSlices", "name", epNew.Name)
@@ -54,18 +54,18 @@ func (h *enqueueRequestsForEndpointSlicesEvent) Update(ctx context.Context, e ev
5454
}
5555

5656
// Delete is called in response to a delete event - e.g. EndpointSlice Deleted.
57-
func (h *enqueueRequestsForEndpointSlicesEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
57+
func (h *enqueueRequestsForEndpointSlicesEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
5858
epOld := e.Object.(*discv1.EndpointSlice)
5959
h.logger.V(1).Info("Deletion event for EndpointSlices", "name", epOld.Name)
6060
h.enqueueImpactedTargetGroupBindings(ctx, queue, epOld)
6161
}
6262

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

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

controllers/elbv2/eventhandlers/endpointslices_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package eventhandlers
22

33
import (
44
"context"
5+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
56
"testing"
67

78
"github.com/go-logr/logr"
@@ -15,7 +16,6 @@ import (
1516
elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1"
1617
mock_client "sigs.k8s.io/aws-load-balancer-controller/mocks/controller-runtime/client"
1718
"sigs.k8s.io/aws-load-balancer-controller/pkg/testutils"
18-
ctrl "sigs.k8s.io/controller-runtime"
1919
"sigs.k8s.io/controller-runtime/pkg/client"
2020
"sigs.k8s.io/controller-runtime/pkg/controller/controllertest"
2121
"sigs.k8s.io/controller-runtime/pkg/log"
@@ -40,7 +40,7 @@ func Test_enqueueRequestsForEndpointSlicesEvent_enqueueImpactedTargetGroupBindin
4040
name string
4141
fields fields
4242
args args
43-
wantRequests []ctrl.Request
43+
wantRequests []reconcile.Request
4444
}{
4545
{
4646
name: "service event should enqueue impacted ip TargetType TGBs",
@@ -92,7 +92,7 @@ func Test_enqueueRequestsForEndpointSlicesEvent_enqueueImpactedTargetGroupBindin
9292
},
9393
},
9494
},
95-
wantRequests: []ctrl.Request{
95+
wantRequests: []reconcile.Request{
9696
{
9797
NamespacedName: types.NamespacedName{Namespace: "awesome-ns", Name: "tgb-1"},
9898
},
@@ -142,7 +142,7 @@ func Test_enqueueRequestsForEndpointSlicesEvent_enqueueImpactedTargetGroupBindin
142142
},
143143
},
144144
},
145-
wantRequests: []ctrl.Request{
145+
wantRequests: []reconcile.Request{
146146
{
147147
NamespacedName: types.NamespacedName{Namespace: "awesome-ns", Name: "tgb-1"},
148148
},
@@ -174,7 +174,7 @@ func Test_enqueueRequestsForEndpointSlicesEvent_enqueueImpactedTargetGroupBindin
174174
k8sClient: k8sClient,
175175
logger: logr.New(&log.NullLogSink{}),
176176
}
177-
queue := &controllertest.Queue{Interface: workqueue.New()}
177+
queue := &controllertest.TypedQueue[reconcile.Request]{TypedInterface: workqueue.NewTyped[reconcile.Request]()}
178178
h.enqueueImpactedTargetGroupBindings(context.Background(), queue, tt.args.epslice)
179179
gotRequests := testutils.ExtractCTRLRequestsFromQueue(queue)
180180
assert.True(t, cmp.Equal(tt.wantRequests, gotRequests),

controllers/elbv2/eventhandlers/node.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,32 +31,32 @@ 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 := e.Object.(*corev1.Node)
3636
h.enqueueImpactedTargetGroupBindings(ctx, queue, nil, nodeNew)
3737
}
3838

3939
// Update is called in response to an update event - e.g. Pod Updated.
40-
func (h *enqueueRequestsForNodeEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
40+
func (h *enqueueRequestsForNodeEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
4141
nodeOld := e.ObjectOld.(*corev1.Node)
4242
nodeNew := e.ObjectNew.(*corev1.Node)
4343
h.enqueueImpactedTargetGroupBindings(ctx, queue, nodeOld, nodeNew)
4444
}
4545

4646
// Delete is called in response to a delete event - e.g. Pod Deleted.
47-
func (h *enqueueRequestsForNodeEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
47+
func (h *enqueueRequestsForNodeEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
4848
nodeOld := e.Object.(*corev1.Node)
4949
h.enqueueImpactedTargetGroupBindings(ctx, queue, nodeOld, nil)
5050
}
5151

5252
// Generic is called in response to an event of an unknown type or a synthetic event triggered as a cron or
5353
// external trigger request - e.g. reconcile AutoScaling, or a WebHook.
54-
func (h *enqueueRequestsForNodeEvent) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface) {
54+
func (h *enqueueRequestsForNodeEvent) Generic(context.Context, event.GenericEvent, workqueue.TypedRateLimitingInterface[reconcile.Request]) {
5555
// nothing to do here
5656
}
5757

5858
// enqueueImpactedTargetGroupBindings will enqueue all impacted TargetGroupBindings for node events.
59-
func (h *enqueueRequestsForNodeEvent) enqueueImpactedTargetGroupBindings(ctx context.Context, queue workqueue.RateLimitingInterface, nodeOld *corev1.Node, nodeNew *corev1.Node) {
59+
func (h *enqueueRequestsForNodeEvent) enqueueImpactedTargetGroupBindings(ctx context.Context, queue workqueue.TypedRateLimitingInterface[reconcile.Request], nodeOld *corev1.Node, nodeNew *corev1.Node) {
6060
var nodeKey types.NamespacedName
6161
nodeOldSuitableAsTrafficProxy := false
6262
nodeNewSuitableAsTrafficProxy := false

controllers/elbv2/eventhandlers/service.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ 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) {
34+
func (h *enqueueRequestsForServiceEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
3535
svcNew := e.Object.(*corev1.Service)
3636
h.enqueueImpactedTargetGroupBindings(ctx, queue, svcNew)
3737
}
3838

3939
// Update is called in response to an update event - e.g. Pod Updated.
40-
func (h *enqueueRequestsForServiceEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
40+
func (h *enqueueRequestsForServiceEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
4141
svcOld := e.ObjectOld.(*corev1.Service)
4242
svcNew := e.ObjectNew.(*corev1.Service)
4343
if !equality.Semantic.DeepEqual(svcOld.Spec.Ports, svcNew.Spec.Ports) {
@@ -46,19 +46,19 @@ func (h *enqueueRequestsForServiceEvent) Update(ctx context.Context, e event.Upd
4646
}
4747

4848
// Delete is called in response to a delete event - e.g. Pod Deleted.
49-
func (h *enqueueRequestsForServiceEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
49+
func (h *enqueueRequestsForServiceEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.TypedRateLimitingInterface[reconcile.Request]) {
5050
svcOld := e.Object.(*corev1.Service)
5151
h.enqueueImpactedTargetGroupBindings(ctx, queue, svcOld)
5252
}
5353

5454
// Generic is called in response to an event of an unknown type or a synthetic event triggered as a cron or
5555
// external trigger request - e.g. reconcile AutoScaling, or a WebHook.
56-
func (h *enqueueRequestsForServiceEvent) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface) {
56+
func (h *enqueueRequestsForServiceEvent) Generic(context.Context, event.GenericEvent, workqueue.TypedRateLimitingInterface[reconcile.Request]) {
5757
// nothing to do here
5858
}
5959

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

controllers/elbv2/eventhandlers/service_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package eventhandlers
22

33
import (
44
"context"
5+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
56
"testing"
67

78
"github.com/go-logr/logr"
@@ -16,7 +17,6 @@ import (
1617
elbv2api "sigs.k8s.io/aws-load-balancer-controller/apis/elbv2/v1beta1"
1718
mock_client "sigs.k8s.io/aws-load-balancer-controller/mocks/controller-runtime/client"
1819
"sigs.k8s.io/aws-load-balancer-controller/pkg/testutils"
19-
ctrl "sigs.k8s.io/controller-runtime"
2020
"sigs.k8s.io/controller-runtime/pkg/client"
2121
"sigs.k8s.io/controller-runtime/pkg/controller/controllertest"
2222
"sigs.k8s.io/controller-runtime/pkg/log"
@@ -41,7 +41,7 @@ func Test_enqueueRequestsForServiceEvent_enqueueImpactedTargetGroupBindings(t *t
4141
name string
4242
fields fields
4343
args args
44-
wantRequests []ctrl.Request
44+
wantRequests []reconcile.Request
4545
}{
4646
{
4747
name: "service event should enqueue impacted instance TargetType TGBs",
@@ -102,7 +102,7 @@ func Test_enqueueRequestsForServiceEvent_enqueueImpactedTargetGroupBindings(t *t
102102
},
103103
},
104104
},
105-
wantRequests: []ctrl.Request{
105+
wantRequests: []reconcile.Request{
106106
{
107107
NamespacedName: types.NamespacedName{Namespace: "awesome-ns", Name: "tgb-1"},
108108
},
@@ -161,7 +161,7 @@ func Test_enqueueRequestsForServiceEvent_enqueueImpactedTargetGroupBindings(t *t
161161
},
162162
},
163163
},
164-
wantRequests: []ctrl.Request{
164+
wantRequests: []reconcile.Request{
165165
{
166166
NamespacedName: types.NamespacedName{Namespace: "awesome-ns", Name: "tgb-1"},
167167
},
@@ -193,7 +193,7 @@ func Test_enqueueRequestsForServiceEvent_enqueueImpactedTargetGroupBindings(t *t
193193
k8sClient: k8sClient,
194194
logger: logr.New(&log.NullLogSink{}),
195195
}
196-
queue := &controllertest.Queue{Interface: workqueue.New()}
196+
queue := &controllertest.TypedQueue[reconcile.Request]{TypedInterface: workqueue.NewTyped[reconcile.Request]()}
197197
h.enqueueImpactedTargetGroupBindings(context.Background(), queue, tt.args.svc)
198198
gotRequests := testutils.ExtractCTRLRequestsFromQueue(queue)
199199
assert.True(t, cmp.Equal(tt.wantRequests, gotRequests),

controllers/elbv2/targetgroupbinding_controller.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
discv1 "k8s.io/api/discovery/v1"
2323
"sigs.k8s.io/controller-runtime/pkg/handler"
24+
"sigs.k8s.io/controller-runtime/pkg/reconcile"
2425
"time"
2526

2627
"github.com/aws/aws-sdk-go-v2/aws"
@@ -91,12 +92,12 @@ type targetGroupBindingReconciler struct {
9192
// +kubebuilder:rbac:groups="",resources=events,verbs=create;patch
9293
// +kubebuilder:rbac:groups="discovery.k8s.io",resources=endpointslices,verbs=get;list;watch
9394

94-
func (r *targetGroupBindingReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
95+
func (r *targetGroupBindingReconciler) Reconcile(ctx context.Context, req reconcile.Request) (ctrl.Result, error) {
9596
r.logger.V(1).Info("Reconcile request", "name", req.Name)
9697
return runtime.HandleReconcileError(r.reconcile(ctx, req), r.logger)
9798
}
9899

99-
func (r *targetGroupBindingReconciler) reconcile(ctx context.Context, req ctrl.Request) error {
100+
func (r *targetGroupBindingReconciler) reconcile(ctx context.Context, req reconcile.Request) error {
100101
tgb := &elbv2api.TargetGroupBinding{}
101102
if err := r.k8sClient.Get(ctx, req.NamespacedName, tgb); err != nil {
102103
return client.IgnoreNotFound(err)
@@ -194,7 +195,7 @@ func (r *targetGroupBindingReconciler) SetupWithManager(ctx context.Context, mgr
194195
Watches(&corev1.Node{}, nodeEventsHandler).
195196
WithOptions(controller.Options{
196197
MaxConcurrentReconciles: r.maxConcurrentReconciles,
197-
RateLimiter: workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, r.maxExponentialBackoffDelay)}).
198+
RateLimiter: workqueue.NewTypedItemExponentialFailureRateLimiter[reconcile.Request](5*time.Millisecond, r.maxExponentialBackoffDelay)}).
198199
Complete(r)
199200
}
200201

0 commit comments

Comments
 (0)