Compare commits

...

3 Commits

Author SHA1 Message Date
Knative Prow Robot c138419361
[release-1.17] Add `sinks.knative.dev` to namespaced ClusterRole (#8433)
Add `sinks.knative.dev` to namespaced ClusterRole

These are roles that users can use to give their developers access
to Knative Eventing resources and we're missing the sinks group.

Signed-off-by: Pierangelo Di Pilato <pierdipi@redhat.com>
Co-authored-by: Pierangelo Di Pilato <pierdipi@redhat.com>
2025-02-03 08:57:27 +00:00
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
3 changed files with 24 additions and 4 deletions

View File

@ -79,6 +79,19 @@ rules:
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: knative-sinks-namespaced-admin
labels:
rbac.authorization.k8s.io/aggregate-to-admin: "true"
app.kubernetes.io/version: devel
app.kubernetes.io/name: knative-eventing
rules:
- apiGroups: ["sinks.knative.dev"]
resources: ["*"]
verbs: ["*"]
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: knative-eventing-namespaced-edit
labels:
@ -86,7 +99,7 @@ metadata:
app.kubernetes.io/version: devel
app.kubernetes.io/name: knative-eventing
rules:
- apiGroups: ["eventing.knative.dev", "messaging.knative.dev", "sources.knative.dev", "flows.knative.dev", "bindings.knative.dev"]
- apiGroups: ["eventing.knative.dev", "messaging.knative.dev", "sources.knative.dev", "flows.knative.dev", "bindings.knative.dev", "sinks.knative.dev"]
resources: ["*"]
verbs: ["create", "update", "patch", "delete"]
---
@ -99,6 +112,6 @@ metadata:
app.kubernetes.io/version: devel
app.kubernetes.io/name: knative-eventing
rules:
- apiGroups: ["eventing.knative.dev", "messaging.knative.dev", "sources.knative.dev", "flows.knative.dev", "bindings.knative.dev"]
- apiGroups: ["eventing.knative.dev", "messaging.knative.dev", "sources.knative.dev", "flows.knative.dev", "bindings.knative.dev", "sinks.knative.dev"]
resources: ["*"]
verbs: ["get", "list", "watch"]

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)