Compare commits

...

2 Commits

Author SHA1 Message Date
Knative Prow Robot 4542e6bf08
[release-1.17] Reduce mt-broker-controller memory usage with namespaced endpoint informer (#8421)
* Reduce mt-broker-controller memory usage with namespaced endpoint informer

Currently, the mt-broker-controller is using a cluster-wide endpoints
informer but it actually only uses endpoints in the "SYSTEM_NAMESPACE".

Using the namespaced informer factory ensures that the watcher
is only watching endpoints in the `knative-eventing` (also known as
`SYSTEM_NAMESPACE`) namespace.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

* Start informer

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>

---------

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
Co-authored-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2025-01-22 20:16:13 +00:00
David Simansky cbdf86e94b
Trigger patch release to cover latest go cve (#8417) 2025-01-22 11:20:11 +00:00
2 changed files with 9 additions and 2 deletions

2
go.mod
View File

@ -1,5 +1,7 @@
module knative.dev/eventing
// A placeholder comment to rebuild with Go 1.23.5 toolchain to cover CVEs
go 1.22.7
require (

View File

@ -25,11 +25,11 @@ import (
"k8s.io/client-go/tools/cache"
"knative.dev/pkg/apis"
configmapinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/configmap"
endpointsinformer "knative.dev/pkg/client/injection/kube/informers/core/v1/endpoints"
"knative.dev/pkg/configmap"
"knative.dev/pkg/controller"
"knative.dev/pkg/injection/clients/dynamicclient"
secretinformer "knative.dev/pkg/injection/clients/namespacedkube/informers/core/v1/secret"
namespacedinformerfactory "knative.dev/pkg/injection/clients/namespacedkube/informers/factory"
"knative.dev/pkg/logging"
pkgreconciler "knative.dev/pkg/reconciler"
"knative.dev/pkg/resolver"
@ -69,7 +69,12 @@ func NewController(
logger := logging.FromContext(ctx)
brokerInformer := brokerinformer.Get(ctx)
subscriptionInformer := subscriptioninformer.Get(ctx)
endpointsInformer := endpointsinformer.Get(ctx)
endpointsInformer := namespacedinformerfactory.Get(ctx).Core().V1().Endpoints()
if err := controller.StartInformers(ctx.Done(), endpointsInformer.Informer()); err != nil {
logger.Fatalw("Failed to start namespaced endpoints informer", zap.Error(err))
}
configmapInformer := configmapinformer.Get(ctx)
secretInformer := secretinformer.Get(ctx)
eventPolicyInformer := eventpolicyinformer.Get(ctx)