Skip to content

Commit 2adbb94

Browse files
committed
Remove unnecessary pods RBAC permissions
The workload rbacRules and kubebuilder RBAC markers granted the operator and its workload service account full CRUD (create/delete/get/list/patch/update/ watch) on core Pods, but the operator never reads or writes Pod objects directly — pods only ever come into being indirectly via Deployments/ StatefulSets/Jobs. Remove the unused pods permission and regenerate config/rbac/role.yaml. Signed-off-by: Martin Schuppert <mschuppert@redhat.com>
1 parent 2550ce5 commit 2adbb94

2 files changed

Lines changed: 0 additions & 7 deletions

File tree

config/rbac/role.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ rules:
88
- ""
99
resources:
1010
- configmaps
11-
- pods
1211
- secrets
1312
- services
1413
verbs:

internal/controller/keystoneapi_controller.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ type KeystoneAPIReconciler struct {
125125
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update;patch
126126
// keystone service account permissions that are needed to grant permission to the above
127127
// +kubebuilder:rbac:groups="security.openshift.io",resourceNames=anyuid,resources=securitycontextconstraints,verbs=use
128-
// +kubebuilder:rbac:groups="",resources=pods,verbs=create;delete;get;list;patch;update;watch
129128

130129
// Reconcile reconcile keystone API requests
131130
func (r *KeystoneAPIReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error) {
@@ -549,11 +548,6 @@ func (r *KeystoneAPIReconciler) reconcileInit(
549548
Resources: []string{"securitycontextconstraints"},
550549
Verbs: []string{"use"},
551550
},
552-
{
553-
APIGroups: []string{""},
554-
Resources: []string{"pods"},
555-
Verbs: []string{"create", "get", "list", "watch", "update", "patch", "delete"},
556-
},
557551
}
558552
rbacResult, err := common_rbac.ReconcileRbac(ctx, helper, instance, rbacRules)
559553
if err != nil {

0 commit comments

Comments
 (0)