Skip to content

Commit b5d869d

Browse files
committed
Include PATCH rule for events in manager-role
During high custom resource count / low interval tests, I was greated with a `cannot patch resource "events"` message. This happened due to event compaction, where it will perform a patch instead of a create. By giving the role the permission to do so this should no longer pose a problem.
1 parent 7f0c99c commit b5d869d

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

config/rbac/leader_election_role.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,4 @@ rules:
2424
- get
2525
- update
2626
- patch
27-
- apiGroups:
28-
- ""
29-
resources:
30-
- events
31-
verbs:
32-
- create
27+

config/rbac/role.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@ metadata:
66
creationTimestamp: null
77
name: manager-role
88
rules:
9+
- apiGroups:
10+
- ""
11+
resources:
12+
- events
13+
verbs:
14+
- create
15+
- patch
916
- apiGroups:
1017
- source.toolkit.fluxcd.io
1118
resources:

controllers/gitrepository_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ type GitRepositoryReconciler struct {
5555

5656
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=gitrepositories,verbs=get;list;watch;create;update;patch;delete
5757
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=gitrepositories/status,verbs=get;update;patch
58+
// +kubebuilder:rbac:groups="",resources=events,verbs=create;patch
5859

5960
func (r *GitRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
6061
ctx := context.Background()

controllers/helmchart_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type HelmChartReconciler struct {
6060

6161
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=helmcharts,verbs=get;list;watch;create;update;patch;delete
6262
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=helmcharts/status,verbs=get;update;patch
63+
// +kubebuilder:rbac:groups="",resources=events,verbs=create;patch
6364

6465
func (r *HelmChartReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
6566
ctx := context.Background()

controllers/helmrepository_controller.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type HelmRepositoryReconciler struct {
6060
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=helmrepositories,verbs=get;list;watch;create;update;patch;delete
6161
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=helmrepositories/status,verbs=get;update;patch
6262
// +kubebuilder:rbac:groups=source.toolkit.fluxcd.io,resources=helmcharts/finalizers,verbs=get;update;patch
63+
// +kubebuilder:rbac:groups="",resources=events,verbs=create;patch
6364

6465
func (r *HelmRepositoryReconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
6566
ctx := context.Background()

0 commit comments

Comments
 (0)