Skip to content

Commit

Permalink
Fix Pod watch RBAC error
Browse files Browse the repository at this point in the history
Commit a987062 restricted the RBAC permissions for Pods to Get and List
operations, as these are the only ones required by the swift-operator
itself. However, Get/List operations are using an informerCache, which
itself sets up a Watch to the objects. Without the required watch
permission this throws an error in the operator log like this:

    Failed to watch *v1.Pod: unknown (get pods)
  • Loading branch information
cschwede committed Apr 29, 2024
1 parent ea245fb commit 0c2143c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ rules:
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
2 changes: 1 addition & 1 deletion controllers/swiftstorage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type Netconfig struct {
//+kubebuilder:rbac:groups=memcached.openstack.org,resources=memcacheds,verbs=get;list;watch;
//+kubebuilder:rbac:groups=network.openstack.org,resources=dnsdata,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=core,resources=nodes,verbs=get;list
//+kubebuilder:rbac:groups="",resources=pods,verbs=get;list
//+kubebuilder:rbac:groups="",resources=pods,verbs=get;list;watch;

// Reconcile is part of the main kubernetes reconciliation loop which aims to
// move the current state of the cluster closer to the desired state.
Expand Down

0 comments on commit 0c2143c

Please sign in to comment.