Skip to content

Commit

Permalink
Adding patch rbac perm for serviceaccounts
Browse files Browse the repository at this point in the history
We also took the opportunity and added patch to all the existing rbac
rules that had update already to avoid similar issues in the future

Resolves: https://issues.redhat.com/browse/OSPRH-8363

Signed-off-by: Martin Schuppert <[email protected]>
  • Loading branch information
stuggi committed Jul 4, 2024
1 parent 8ffe5ae commit e15cc01
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rules:
- create
- get
- list
- patch
- update
- watch
- apiGroups:
Expand Down Expand Up @@ -222,6 +223,7 @@ rules:
- create
- get
- list
- patch
- update
- watch
- apiGroups:
Expand All @@ -232,6 +234,7 @@ rules:
- create
- get
- list
- patch
- update
- watch
- apiGroups:
Expand Down Expand Up @@ -259,6 +262,7 @@ rules:
resources:
- swiftproxies/finalizers
verbs:
- patch
- update
- apiGroups:
- swift.openstack.org
Expand All @@ -285,6 +289,7 @@ rules:
resources:
- swiftrings/finalizers
verbs:
- patch
- update
- apiGroups:
- swift.openstack.org
Expand All @@ -311,6 +316,7 @@ rules:
resources:
- swifts/finalizers
verbs:
- patch
- update
- apiGroups:
- swift.openstack.org
Expand All @@ -337,6 +343,7 @@ rules:
resources:
- swiftstorages/finalizers
verbs:
- patch
- update
- apiGroups:
- swift.openstack.org
Expand Down
8 changes: 4 additions & 4 deletions controllers/swift_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ type SwiftReconciler struct {

//+kubebuilder:rbac:groups=swift.openstack.org,resources=swifts,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swifts/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swifts/finalizers,verbs=update
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swifts/finalizers,verbs=update;patch

// service account, role, rolebinding
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;list;watch;create;update
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=roles,verbs=get;list;watch;create;update
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;list;watch;create;update;patch
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=roles,verbs=get;list;watch;create;update;patch
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update;patch
// service account permissions that are needed to grant permission to the above
// +kubebuilder:rbac:groups="security.openshift.io",resourceNames=nonroot-v2,resources=securitycontextconstraints,verbs=use

Expand Down
2 changes: 1 addition & 1 deletion controllers/swiftproxy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ type SwiftProxyReconciler struct {

//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftproxies,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftproxies/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftproxies/finalizers,verbs=update
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftproxies/finalizers,verbs=update;patch
//+kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=keystone.openstack.org,resources=keystoneapis,verbs=get;list;watch
//+kubebuilder:rbac:groups=keystone.openstack.org,resources=keystoneendpoints,verbs=get;list;watch;create;update;patch;delete
Expand Down
2 changes: 1 addition & 1 deletion controllers/swiftring_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type SwiftRingReconciler struct {

//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftrings,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftrings/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftrings/finalizers,verbs=update
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftrings/finalizers,verbs=update;patch
//+kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=*,resources=configmaps,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=core,resources=secrets,verbs=get;list;watch
Expand Down
2 changes: 1 addition & 1 deletion controllers/swiftstorage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ type Netconfig struct {

//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftstorages,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftstorages/status,verbs=get;update;patch
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftstorages/finalizers,verbs=update
//+kubebuilder:rbac:groups=swift.openstack.org,resources=swiftstorages/finalizers,verbs=update;patch
//+kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=core,resources=services,verbs=get;list;watch;create;update;patch;delete
//+kubebuilder:rbac:groups=core,resources=configmaps,verbs=get;list;watch;create;update;patch;delete
Expand Down

0 comments on commit e15cc01

Please sign in to comment.