Skip to content

Commit

Permalink
Merge pull request #411 from zlabjp/unexport-resourceeventhandlerbuil…
Browse files Browse the repository at this point in the history
…der-build

Unexport resourceEventHandlerBuilder.Build
  • Loading branch information
tatsuhiro-t authored Oct 29, 2024
2 parents d347e11 + c475778 commit d8c3995
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func NewLoadBalancerController(ctx context.Context, clientset clientset.Interfac
handler: func(context.Context, *networkingv1.Ingress) {
lbc.enqueue()
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add Ingress event handler")
return nil, err
}
Expand All @@ -349,7 +349,7 @@ func NewLoadBalancerController(ctx context.Context, clientset clientset.Interfac
handler: func(context.Context, *discoveryv1.EndpointSlice) {
lbc.enqueue()
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add EndpointSlice event handler")
return nil, err
}
Expand All @@ -369,7 +369,7 @@ func NewLoadBalancerController(ctx context.Context, clientset clientset.Interfac
handler: func(context.Context, *corev1.Service) {
lbc.enqueue()
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add Service event handler")
return nil, err
}
Expand All @@ -389,7 +389,7 @@ func NewLoadBalancerController(ctx context.Context, clientset clientset.Interfac
handler: func(context.Context, *corev1.Secret) {
lbc.enqueue()
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add Secret event handler")
return nil, err
}
Expand All @@ -409,7 +409,7 @@ func NewLoadBalancerController(ctx context.Context, clientset clientset.Interfac
handler: func(context.Context, *corev1.Pod) {
lbc.enqueue()
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add Pod event handler")
return nil, err
}
Expand All @@ -426,7 +426,7 @@ func NewLoadBalancerController(ctx context.Context, clientset clientset.Interfac
handler: func(context.Context, *networkingv1.IngressClass) {
lbc.enqueue()
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add IngressClass event handler")
return nil, err
}
Expand All @@ -449,7 +449,7 @@ func NewLoadBalancerController(ctx context.Context, clientset clientset.Interfac
handler: func(context.Context, *corev1.ConfigMap) {
lbc.enqueue()
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add ConfigMap event handler")
return nil, err
}
Expand All @@ -473,7 +473,7 @@ func NewLoadBalancerController(ctx context.Context, clientset clientset.Interfac
handler: func(context.Context, *gatewayv1.GatewayClass) {
lbc.enqueue()
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add GatewayClass event handler")
return nil, err
}
Expand All @@ -493,7 +493,7 @@ func NewLoadBalancerController(ctx context.Context, clientset clientset.Interfac
handler: func(context.Context, *gatewayv1.Gateway) {
lbc.enqueue()
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add Gateway event handler")
return nil, err
}
Expand All @@ -513,7 +513,7 @@ func NewLoadBalancerController(ctx context.Context, clientset clientset.Interfac
handler: func(context.Context, *gatewayv1.HTTPRoute) {
lbc.enqueue()
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add HTTPRoute event handler")
return nil, err
}
Expand Down Expand Up @@ -2043,7 +2043,7 @@ func NewLeaderController(ctx context.Context, lbc *LoadBalancerController) (*Lea
handler: func(_ context.Context, ing *networkingv1.Ingress) {
lc.enqueueIngress(ing)
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add Ingress event handler")
return nil, err
}
Expand All @@ -2060,7 +2060,7 @@ func NewLeaderController(ctx context.Context, lbc *LoadBalancerController) (*Lea
handler: func(ctx context.Context, _ *corev1.Pod) {
lc.enqueueIngressAll(ctx)
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add Pod event handler")
return nil, err
}
Expand All @@ -2077,7 +2077,7 @@ func NewLeaderController(ctx context.Context, lbc *LoadBalancerController) (*Lea
handler: func(_ context.Context, secret *corev1.Secret) {
lc.enqueueSecret(secret)
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add Secret event handler")
return nil, err
}
Expand All @@ -2101,7 +2101,7 @@ func NewLeaderController(ctx context.Context, lbc *LoadBalancerController) (*Lea
handler: func(ctx context.Context, _ *corev1.Service) {
lc.enqueueIngressAll(ctx)
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add Service event handler")
return nil, err
}
Expand All @@ -2116,7 +2116,7 @@ func NewLeaderController(ctx context.Context, lbc *LoadBalancerController) (*Lea

if _, err := inf.AddEventHandler(resourceEventHandlerBuilder[*networkingv1.IngressClass]{
handler: lc.enqueueIngressWithIngressClass,
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add IngressClass event handler")
}

Expand Down Expand Up @@ -2160,7 +2160,7 @@ func NewLeaderController(ctx context.Context, lbc *LoadBalancerController) (*Lea
handler: func(_ context.Context, gc *gatewayv1.GatewayClass) {
lc.enqueueGatewayClass(gc)
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add GatewayClass event handler")
return nil, err
}
Expand All @@ -2181,7 +2181,7 @@ func NewLeaderController(ctx context.Context, lbc *LoadBalancerController) (*Lea
lc.enqueueGateway(gtw)
lc.enqueueHTTPRouteFromGateway(ctx, gtw)
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add Gateway event handler")
return nil, err
}
Expand All @@ -2201,7 +2201,7 @@ func NewLeaderController(ctx context.Context, lbc *LoadBalancerController) (*Lea
handler: func(_ context.Context, httpRoute *gatewayv1.HTTPRoute) {
lc.enqueueHTTPRoute(httpRoute)
},
}.Build(ctx)); err != nil {
}.build(ctx)); err != nil {
log.Error(err, "Unable to add HTTPRoute event handler")
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ type resourceEventHandlerBuilder[T metav1.Object] struct {
handler func(ctx context.Context, obj T)
}

func (b resourceEventHandlerBuilder[T]) Build(ctx context.Context) cache.ResourceEventHandlerFuncs {
func (b resourceEventHandlerBuilder[T]) build(ctx context.Context) cache.ResourceEventHandlerFuncs {
log := klog.LoggerWithName(klog.FromContext(ctx), "resourceEventHandler")
ctx = klog.NewContext(ctx, log)

Expand Down

0 comments on commit d8c3995

Please sign in to comment.