From 8f41a1d953f24030ff68777c33d75f55c00db28a Mon Sep 17 00:00:00 2001 From: Ilias Rinis Date: Tue, 3 Oct 2023 11:44:44 +0200 Subject: [PATCH] endpointaccessible: create an EndpointAccessibleController with optional filtered triggers and filter func --- .../endpointaccessible/endpoint_accessible_controller.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/libs/endpointaccessible/endpoint_accessible_controller.go b/pkg/libs/endpointaccessible/endpoint_accessible_controller.go index 41a8dd3cd..31c44d9fd 100644 --- a/pkg/libs/endpointaccessible/endpoint_accessible_controller.go +++ b/pkg/libs/endpointaccessible/endpoint_accessible_controller.go @@ -36,6 +36,7 @@ func NewEndpointAccessibleController( endpointListFn EndpointListFunc, getTLSConfigFn EndpointTLSConfigFunc, triggers []factory.Informer, + filteredTriggers []factory.Informer, filterFunc factory.EventFilterFunc, recorder events.Recorder, resyncInterval time.Duration, ) factory.Controller { @@ -48,13 +49,15 @@ func NewEndpointAccessibleController( availableConditionName: name + "EndpointAccessibleControllerAvailable", } - return factory.New(). + factory := factory.New(). WithInformers(triggers...). + WithFilteredEventsInformers(filterFunc, filteredTriggers...). WithInformers(operatorClient.Informer()). WithSync(c.sync). ResyncEvery(resyncInterval). - WithSyncDegradedOnError(operatorClient). - ToController(controllerName, recorder.WithComponentSuffix(name+"endpoint-accessible-controller")) + WithSyncDegradedOnError(operatorClient) + + return factory.ToController(controllerName, recorder.WithComponentSuffix(name+"endpoint-accessible-controller")) } // humanizeError produce error message that makes more sense to humans/admins.