knative / eventing-contrib

Event Sources
Apache License 2.0
226 stars 225 forks source link

Namespaced KafkaChannel dispatcher has RBAC issues #1659

Closed aliok closed 3 years ago

aliok commented 3 years ago

Describe the bug As the time of writing, I only tried with 0.17.7.

When I create a namespaced KafkaChannel (i.e. with annotation eventing.knative.dev/scope: namespace), I see following:

kafka-ch-dispatcher-7cb455959f-996vq dispatcher E1106 11:16:48.094504       1 leaderelection.go:331] error retrieving resource lock knative-eventing/kafkachannel-dispatcher.knative.dev-eventing-contrib-kafka-channel-pkg-reconciler-dispatcher.reconciler.00-of-01: leases.coordination.k8s.io "kafkachannel-dispatcher.knative.dev-eventing-contrib-kafka-channel-pkg-reconciler-dispatcher.reconciler.00-of-01" is forbidden: User "system:serviceaccount:ns02:kafka-ch-dispatcher" cannot get resource "leases" in API group "coordination.k8s.io" in the namespace "knative-eventing"

Expected behavior No error

To Reproduce

lionelvillard commented 3 years ago

The problem lies in the leader elector builder which creates leases in the system namespace. The fix in pkg is quite big due to import cycle.

The dispatcher is not meant to run in leader-election mode and AFAIK it does run in this mode by accident, not by choice. So let's turn this off sooner than later.

aliok commented 3 years ago

For reference: