You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Operator leader-election event recording fails with namespace-scoped RBAC #7299
With namespace-scoped RBAC and workload namespaces excluding the operator namespace, the operator logs a forbidden error when recording its leader-election event.
Leader election succeeds, and the operator remains healthy. Recording the informational event fails.
Install the operator with the configuration above.
Start or restart the operator.
Check its logs after it acquires the leader-election lease.
Actual behavior
The operator successfully acquires its lease, then logs:
events is forbidden:
User "system:serviceaccount:toolhive-system:toolhive-operator" cannot create resource "events" in API group "" in the namespace "toolhive-system"
The rejected event has:
Kind: Lease
Reason: LeaderElection
Message: became leader
The chart's leader-election Role grants create and patch for events.k8s.io/events, but the rejected request targets core-group ""/events.
Expected behavior
The default leader-election RBAC and the API used by its event recorder should match, including when the operator namespace is excluded from allowedNamespaces.
Investigation
The v0.69.0 chart values still appear to grant only events.k8s.io/events in operator.leaderElectionRole.rules. We have not tested that version.
Related PR #5243 and issue #5339 concern event API-group permissions, but this appears to involve the operator's own leader-election recorder.
Questions
Is this a known issue, and is there a released fix?
Should the leader-election Role grant core-group event permissions as well, or should its recorder use events.k8s.io?
Is overriding operator.leaderElectionRole.rules to include apiGroups: [""], resources: ["events"], and verbs: ["create", "patch"] the recommended workaround?
Impact
The operator remains running and leader election succeeds. The observed impact is a rejected leader-election event and an error in the logs.
I'd like to work on this. The leader-election lock uses controller-runtime's GetEventRecorderFor, which writes core API group events, while the chart's leader-election Role grants event permissions only in events.k8s.io. I'd add a create and patch rule for core-group events alongside the existing rule and add a Helm unit test for namespace-scoped RBAC with the operator namespace outside allowedNamespaces. Could you assign this issue to me?
Activity
pcbeingused333 commentedon Nov 26, 2026
I'd like to work on this. The leader-election lock uses controller-runtime's
GetEventRecorderFor, which writes core API group events, while the chart's leader-election Role grants event permissions only inevents.k8s.io. I'd add acreateandpatchrule for core-groupeventsalongside the existing rule and add a Helm unit test for namespace-scoped RBAC with the operator namespace outsideallowedNamespaces. Could you assign this issue to me?jhrozek commentedon Nov 26, 2026
Assigned to you @pcbeingused333
Grant leader election core events access (stacklok#7349)