Skip to content

Commit e5c21db

Browse files
authored
Update go to v1.22, controller-runtime dependency to v0.18.2, and kubernetes libs to v0.30.0 (#3707)
* go version, dep version * refactor for controller-runtime udpate * update tests, fix if statement the controller-runtime strips DeletionTimestamp from manifests on Create(). kubernetes-sigs/controller-runtime#2316 * refactor tests * remove placeholder comments * remove reconciler from WithOptions * remove DefaultNamespace cache option * remote `&& !hasGroupFinalizer` This was causing e2e tests to fail when an ingress did not have the group finalizer. The unit tests ing-1_been_deleted, and ing-6_been_deleted will need reworked due to changes in the controller-runtime that cause them to fail. * update unit tests for ctrl client/fake >0.15 controller-runtime >=0.15 does not support creating (or adding the field via Update()) objects with a DeletionTimestamp. To work around this we add an annotation `unit-test/delete` to mark the ingresses that we want to test deletion. We check for this annotation and then call Delete(). This will set the DeletionTimestamp to the current date and time so we use IgnoreOtherFields to skip then comparing want to got. relevant controller-runtime discussion/pr: - kubernetes-sigs/controller-runtime#2184 (comment) - kubernetes-sigs/controller-runtime#2316 * remove unused contexts * add DefaultNamespaces cache config * set opt.Cache.DefaultNamespaces conditionally If WatchNamespace is set to corev1.NamespaceAll we should not set DefaultNamespaces. This code assumes that only one namespace is specified for WatchNamespace. That decision was based on the help text for the flag `watch-namespace`. Related controller-runtime issue: kubernetes-sigs/controller-runtime#2628 * make crds * set go to v1.22.3
1 parent 9e9432b commit e5c21db

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+717
-1080
lines changed

.go-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.21.9
1+
1.22.3

config/crd/bases/elbv2.k8s.aws_ingressclassparams.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,13 @@ spec:
134134
items:
135135
type: string
136136
type: array
137+
x-kubernetes-list-type: atomic
137138
required:
138139
- key
139140
- operator
140141
type: object
141142
type: array
143+
x-kubernetes-list-type: atomic
142144
matchLabels:
143145
additionalProperties:
144146
type: string

config/crd/bases/elbv2.k8s.aws_targetgroupbindings.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,13 @@ spec:
342342
items:
343343
type: string
344344
type: array
345+
x-kubernetes-list-type: atomic
345346
required:
346347
- key
347348
- operator
348349
type: object
349350
type: array
351+
x-kubernetes-list-type: atomic
350352
matchLabels:
351353
additionalProperties:
352354
type: string

config/webhook/manifests.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
---
21
apiVersion: admissionregistration.k8s.io/v1
32
kind: MutatingWebhookConfiguration
43
metadata:

controllers/elbv2/eventhandlers/endpoints.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package eventhandlers
22

33
import (
44
"context"
5+
56
"github.com/go-logr/logr"
67
corev1 "k8s.io/api/core/v1"
78
"k8s.io/apimachinery/pkg/api/equality"
@@ -32,13 +33,13 @@ type enqueueRequestsForEndpointsEvent struct {
3233
}
3334

3435
// Create is called in response to an create event - e.g. Pod Creation.
35-
func (h *enqueueRequestsForEndpointsEvent) Create(e event.CreateEvent, queue workqueue.RateLimitingInterface) {
36+
func (h *enqueueRequestsForEndpointsEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
3637
epNew := e.Object.(*corev1.Endpoints)
3738
h.enqueueImpactedTargetGroupBindings(queue, epNew)
3839
}
3940

4041
// Update is called in response to an update event - e.g. Pod Updated.
41-
func (h *enqueueRequestsForEndpointsEvent) Update(e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
42+
func (h *enqueueRequestsForEndpointsEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
4243
epOld := e.ObjectOld.(*corev1.Endpoints)
4344
epNew := e.ObjectNew.(*corev1.Endpoints)
4445
if !equality.Semantic.DeepEqual(epOld.Subsets, epNew.Subsets) {
@@ -47,14 +48,14 @@ func (h *enqueueRequestsForEndpointsEvent) Update(e event.UpdateEvent, queue wor
4748
}
4849

4950
// Delete is called in response to a delete event - e.g. Pod Deleted.
50-
func (h *enqueueRequestsForEndpointsEvent) Delete(e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
51+
func (h *enqueueRequestsForEndpointsEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
5152
epOld := e.Object.(*corev1.Endpoints)
5253
h.enqueueImpactedTargetGroupBindings(queue, epOld)
5354
}
5455

5556
// Generic is called in response to an event of an unknown type or a synthetic event triggered as a cron or
5657
// external trigger request - e.g. reconcile AutoScaling, or a WebHook.
57-
func (h *enqueueRequestsForEndpointsEvent) Generic(event.GenericEvent, workqueue.RateLimitingInterface) {
58+
func (h *enqueueRequestsForEndpointsEvent) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface) {
5859
}
5960

6061
func (h *enqueueRequestsForEndpointsEvent) enqueueImpactedTargetGroupBindings(queue workqueue.RateLimitingInterface, ep *corev1.Endpoints) {

controllers/elbv2/eventhandlers/endpoints_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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.Queue{Interface: workqueue.New()}
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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,36 +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(e event.CreateEvent, queue workqueue.RateLimitingInterface) {
39+
func (h *enqueueRequestsForEndpointSlicesEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
4040
epNew := e.Object.(*discv1.EndpointSlice)
4141
h.logger.V(1).Info("Create event for EndpointSlices", "name", epNew.Name)
42-
h.enqueueImpactedTargetGroupBindings(queue, epNew)
42+
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(e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
46+
func (h *enqueueRequestsForEndpointSlicesEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
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)
5050
if !equality.Semantic.DeepEqual(epOld.Ports, epNew.Ports) || !equality.Semantic.DeepEqual(epOld.Endpoints, epNew.Endpoints) {
5151
h.logger.V(1).Info("Enqueue EndpointSlice", "name", epNew.Name)
52-
h.enqueueImpactedTargetGroupBindings(queue, epNew)
52+
h.enqueueImpactedTargetGroupBindings(ctx, queue, epNew)
5353
}
5454
}
5555

5656
// Delete is called in response to a delete event - e.g. EndpointSlice Deleted.
57-
func (h *enqueueRequestsForEndpointSlicesEvent) Delete(e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
57+
func (h *enqueueRequestsForEndpointSlicesEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
5858
epOld := e.Object.(*discv1.EndpointSlice)
5959
h.logger.V(1).Info("Deletion event for EndpointSlices", "name", epOld.Name)
60-
h.enqueueImpactedTargetGroupBindings(queue, epOld)
60+
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(event.GenericEvent, workqueue.RateLimitingInterface) {
65+
func (h *enqueueRequestsForEndpointSlicesEvent) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface) {
6666
}
6767

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

controllers/elbv2/eventhandlers/endpointslices_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ func Test_enqueueRequestsForEndpointSlicesEvent_enqueueImpactedTargetGroupBindin
174174
k8sClient: k8sClient,
175175
logger: logr.New(&log.NullLogSink{}),
176176
}
177-
queue := controllertest.Queue{Interface: workqueue.New()}
178-
h.enqueueImpactedTargetGroupBindings(queue, tt.args.epslice)
177+
queue := &controllertest.Queue{Interface: workqueue.New()}
178+
h.enqueueImpactedTargetGroupBindings(context.Background(), queue, tt.args.epslice)
179179
gotRequests := testutils.ExtractCTRLRequestsFromQueue(queue)
180180
assert.True(t, cmp.Equal(tt.wantRequests, gotRequests),
181181
"diff", cmp.Diff(tt.wantRequests, gotRequests))

controllers/elbv2/eventhandlers/node.go

Lines changed: 8 additions & 8 deletions
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(e event.CreateEvent, queue workqueue.RateLimitingInterface) {
34+
func (h *enqueueRequestsForNodeEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
3535
nodeNew := e.Object.(*corev1.Node)
36-
h.enqueueImpactedTargetGroupBindings(queue, nil, nodeNew)
36+
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(e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
40+
func (h *enqueueRequestsForNodeEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
4141
nodeOld := e.ObjectOld.(*corev1.Node)
4242
nodeNew := e.ObjectNew.(*corev1.Node)
43-
h.enqueueImpactedTargetGroupBindings(queue, nodeOld, nodeNew)
43+
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(e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
47+
func (h *enqueueRequestsForNodeEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
4848
nodeOld := e.Object.(*corev1.Node)
49-
h.enqueueImpactedTargetGroupBindings(queue, nodeOld, nil)
49+
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(e event.GenericEvent, queue workqueue.RateLimitingInterface) {
54+
func (h *enqueueRequestsForNodeEvent) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface) {
5555
// nothing to do here
5656
}
5757

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

controllers/elbv2/eventhandlers/service.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package eventhandlers
22

33
import (
44
"context"
5+
56
"github.com/go-logr/logr"
67
corev1 "k8s.io/api/core/v1"
78
"k8s.io/apimachinery/pkg/api/equality"
@@ -30,34 +31,34 @@ type enqueueRequestsForServiceEvent struct {
3031
}
3132

3233
// Create is called in response to an create event - e.g. Pod Creation.
33-
func (h *enqueueRequestsForServiceEvent) Create(e event.CreateEvent, queue workqueue.RateLimitingInterface) {
34+
func (h *enqueueRequestsForServiceEvent) Create(ctx context.Context, e event.CreateEvent, queue workqueue.RateLimitingInterface) {
3435
svcNew := e.Object.(*corev1.Service)
35-
h.enqueueImpactedTargetGroupBindings(queue, svcNew)
36+
h.enqueueImpactedTargetGroupBindings(ctx, queue, svcNew)
3637
}
3738

3839
// Update is called in response to an update event - e.g. Pod Updated.
39-
func (h *enqueueRequestsForServiceEvent) Update(e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
40+
func (h *enqueueRequestsForServiceEvent) Update(ctx context.Context, e event.UpdateEvent, queue workqueue.RateLimitingInterface) {
4041
svcOld := e.ObjectOld.(*corev1.Service)
4142
svcNew := e.ObjectNew.(*corev1.Service)
4243
if !equality.Semantic.DeepEqual(svcOld.Spec.Ports, svcNew.Spec.Ports) {
43-
h.enqueueImpactedTargetGroupBindings(queue, svcNew)
44+
h.enqueueImpactedTargetGroupBindings(ctx, queue, svcNew)
4445
}
4546
}
4647

4748
// Delete is called in response to a delete event - e.g. Pod Deleted.
48-
func (h *enqueueRequestsForServiceEvent) Delete(e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
49+
func (h *enqueueRequestsForServiceEvent) Delete(ctx context.Context, e event.DeleteEvent, queue workqueue.RateLimitingInterface) {
4950
svcOld := e.Object.(*corev1.Service)
50-
h.enqueueImpactedTargetGroupBindings(queue, svcOld)
51+
h.enqueueImpactedTargetGroupBindings(ctx, queue, svcOld)
5152
}
5253

5354
// Generic is called in response to an event of an unknown type or a synthetic event triggered as a cron or
5455
// external trigger request - e.g. reconcile AutoScaling, or a WebHook.
55-
func (h *enqueueRequestsForServiceEvent) Generic(e event.GenericEvent, queue workqueue.RateLimitingInterface) {
56+
func (h *enqueueRequestsForServiceEvent) Generic(context.Context, event.GenericEvent, workqueue.RateLimitingInterface) {
5657
// nothing to do here
5758
}
5859

5960
// enqueueImpactedEndpointBindings will enqueue all impacted TargetGroupBindings for service events.
60-
func (h *enqueueRequestsForServiceEvent) enqueueImpactedTargetGroupBindings(queue workqueue.RateLimitingInterface, svc *corev1.Service) {
61+
func (h *enqueueRequestsForServiceEvent) enqueueImpactedTargetGroupBindings(ctx context.Context, queue workqueue.RateLimitingInterface, svc *corev1.Service) {
6162
tgbList := &elbv2api.TargetGroupBindingList{}
6263
if err := h.k8sClient.List(context.Background(), tgbList,
6364
client.InNamespace(svc.Namespace),

controllers/elbv2/eventhandlers/service_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ func Test_enqueueRequestsForServiceEvent_enqueueImpactedTargetGroupBindings(t *t
193193
k8sClient: k8sClient,
194194
logger: logr.New(&log.NullLogSink{}),
195195
}
196-
queue := controllertest.Queue{Interface: workqueue.New()}
197-
h.enqueueImpactedTargetGroupBindings(queue, tt.args.svc)
196+
queue := &controllertest.Queue{Interface: workqueue.New()}
197+
h.enqueueImpactedTargetGroupBindings(context.Background(), queue, tt.args.svc)
198198
gotRequests := testutils.ExtractCTRLRequestsFromQueue(queue)
199199
assert.True(t, cmp.Equal(tt.wantRequests, gotRequests),
200200
"diff", cmp.Diff(tt.wantRequests, gotRequests))

controllers/elbv2/targetgroupbinding_controller.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ 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/source"
3736

3837
"github.com/go-logr/logr"
3938
ctrl "sigs.k8s.io/controller-runtime"
@@ -167,9 +166,9 @@ func (r *targetGroupBindingReconciler) SetupWithManager(ctx context.Context, mgr
167166
return ctrl.NewControllerManagedBy(mgr).
168167
For(&elbv2api.TargetGroupBinding{}).
169168
Named(controllerName).
170-
Watches(&source.Kind{Type: &corev1.Service{}}, svcEventHandler).
171-
Watches(&source.Kind{Type: &discv1.EndpointSlice{}}, epSliceEventsHandler).
172-
Watches(&source.Kind{Type: &corev1.Node{}}, nodeEventsHandler).
169+
Watches(&corev1.Service{}, svcEventHandler).
170+
Watches(&discv1.EndpointSlice{}, epSliceEventsHandler).
171+
Watches(&corev1.Node{}, nodeEventsHandler).
173172
WithOptions(controller.Options{
174173
MaxConcurrentReconciles: r.maxConcurrentReconciles,
175174
RateLimiter: workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, r.maxExponentialBackoffDelay)}).
@@ -180,9 +179,9 @@ func (r *targetGroupBindingReconciler) SetupWithManager(ctx context.Context, mgr
180179
return ctrl.NewControllerManagedBy(mgr).
181180
For(&elbv2api.TargetGroupBinding{}).
182181
Named(controllerName).
183-
Watches(&source.Kind{Type: &corev1.Service{}}, svcEventHandler).
184-
Watches(&source.Kind{Type: &corev1.Endpoints{}}, epsEventsHandler).
185-
Watches(&source.Kind{Type: &corev1.Node{}}, nodeEventsHandler).
182+
Watches(&corev1.Service{}, svcEventHandler).
183+
Watches(&corev1.Endpoints{}, epsEventsHandler).
184+
Watches(&corev1.Node{}, nodeEventsHandler).
186185
WithOptions(controller.Options{
187186
MaxConcurrentReconciles: r.maxConcurrentReconciles,
188187
RateLimiter: workqueue.NewItemExponentialFailureRateLimiter(5*time.Millisecond, r.maxExponentialBackoffDelay)}).

controllers/ingress/eventhandlers/ingress_class_events.go

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package eventhandlers
22

33
import (
44
"context"
5+
56
"github.com/go-logr/logr"
67
networking "k8s.io/api/networking/v1"
78
"k8s.io/apimachinery/pkg/api/equality"
@@ -15,8 +16,8 @@ import (
1516
)
1617

1718
// NewEnqueueRequestsForIngressClassEvent constructs new enqueueRequestsForIngressClassEvent.
18-
func NewEnqueueRequestsForIngressClassEvent(ingEventChan chan<- event.GenericEvent,
19-
k8sClient client.Client, eventRecorder record.EventRecorder, logger logr.Logger) *enqueueRequestsForIngressClassEvent {
19+
func NewEnqueueRequestsForIngressClassEvent(ingEventChan chan<- event.TypedGenericEvent[*networking.Ingress],
20+
k8sClient client.Client, eventRecorder record.EventRecorder, logger logr.Logger) handler.TypedEventHandler[*networking.IngressClass] {
2021
return &enqueueRequestsForIngressClassEvent{
2122
ingEventChan: ingEventChan,
2223
k8sClient: k8sClient,
@@ -25,23 +26,23 @@ func NewEnqueueRequestsForIngressClassEvent(ingEventChan chan<- event.GenericEve
2526
}
2627
}
2728

28-
var _ handler.EventHandler = (*enqueueRequestsForIngressClassEvent)(nil)
29+
var _ handler.TypedEventHandler[*networking.IngressClass] = (*enqueueRequestsForIngressClassEvent)(nil)
2930

3031
type enqueueRequestsForIngressClassEvent struct {
31-
ingEventChan chan<- event.GenericEvent
32+
ingEventChan chan<- event.TypedGenericEvent[*networking.Ingress]
3233
k8sClient client.Client
3334
eventRecorder record.EventRecorder
3435
logger logr.Logger
3536
}
3637

37-
func (h *enqueueRequestsForIngressClassEvent) Create(e event.CreateEvent, _ workqueue.RateLimitingInterface) {
38-
ingClassNew := e.Object.(*networking.IngressClass)
38+
func (h *enqueueRequestsForIngressClassEvent) Create(ctx context.Context, e event.TypedCreateEvent[*networking.IngressClass], _ workqueue.RateLimitingInterface) {
39+
ingClassNew := e.Object
3940
h.enqueueImpactedIngresses(ingClassNew)
4041
}
4142

42-
func (h *enqueueRequestsForIngressClassEvent) Update(e event.UpdateEvent, _ workqueue.RateLimitingInterface) {
43-
ingClassOld := e.ObjectOld.(*networking.IngressClass)
44-
ingClassNew := e.ObjectNew.(*networking.IngressClass)
43+
func (h *enqueueRequestsForIngressClassEvent) Update(ctx context.Context, e event.TypedUpdateEvent[*networking.IngressClass], _ workqueue.RateLimitingInterface) {
44+
ingClassOld := e.ObjectOld
45+
ingClassNew := e.ObjectNew
4546

4647
// we only care below update event:
4748
// 2. IngressClass spec updates
@@ -54,13 +55,13 @@ func (h *enqueueRequestsForIngressClassEvent) Update(e event.UpdateEvent, _ work
5455
h.enqueueImpactedIngresses(ingClassNew)
5556
}
5657

57-
func (h *enqueueRequestsForIngressClassEvent) Delete(e event.DeleteEvent, _ workqueue.RateLimitingInterface) {
58-
ingClassOld := e.Object.(*networking.IngressClass)
58+
func (h *enqueueRequestsForIngressClassEvent) Delete(ctx context.Context, e event.TypedDeleteEvent[*networking.IngressClass], _ workqueue.RateLimitingInterface) {
59+
ingClassOld := e.Object
5960
h.enqueueImpactedIngresses(ingClassOld)
6061
}
6162

62-
func (h *enqueueRequestsForIngressClassEvent) Generic(e event.GenericEvent, _ workqueue.RateLimitingInterface) {
63-
ingClass := e.Object.(*networking.IngressClass)
63+
func (h *enqueueRequestsForIngressClassEvent) Generic(ctx context.Context, e event.TypedGenericEvent[*networking.IngressClass], _ workqueue.RateLimitingInterface) {
64+
ingClass := e.Object
6465
h.enqueueImpactedIngresses(ingClass)
6566
}
6667

@@ -78,7 +79,7 @@ func (h *enqueueRequestsForIngressClassEvent) enqueueImpactedIngresses(ingClass
7879
h.logger.V(1).Info("enqueue ingress for ingressClass event",
7980
"ingressClass", ingClass.GetName(),
8081
"ingress", k8s.NamespacedName(ing))
81-
h.ingEventChan <- event.GenericEvent{
82+
h.ingEventChan <- event.TypedGenericEvent[*networking.Ingress]{
8283
Object: ing,
8384
}
8485
}

0 commit comments

Comments
 (0)