Skip to content

Commit 6d2f6c9

Browse files
Merge pull request openstack-k8s-operators#267 from lpiwowar/remove-rights
Remove unnecessary rights
2 parents d71f525 + f612fe6 commit 6d2f6c9

File tree

5 files changed

+0
-87
lines changed

5 files changed

+0
-87
lines changed

config/rbac/role.yaml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,6 @@ rules:
4848
- get
4949
- list
5050
- watch
51-
- apiGroups:
52-
- ""
53-
resources:
54-
- serviceaccounts
55-
verbs:
56-
- create
57-
- get
58-
- list
59-
- patch
60-
- update
61-
- watch
6251
- apiGroups:
6352
- k8s.cni.cncf.io
6453
resources:
@@ -67,28 +56,6 @@ rules:
6756
- get
6857
- list
6958
- watch
70-
- apiGroups:
71-
- rbac.authorization.k8s.io
72-
resources:
73-
- rolebindings
74-
verbs:
75-
- create
76-
- get
77-
- list
78-
- patch
79-
- update
80-
- watch
81-
- apiGroups:
82-
- rbac.authorization.k8s.io
83-
resources:
84-
- roles
85-
verbs:
86-
- create
87-
- get
88-
- list
89-
- patch
90-
- update
91-
- watch
9259
- apiGroups:
9360
- security.openshift.io
9461
resourceNames:

controllers/ansibletest_controller.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import (
2929
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
3030
"github.com/openstack-k8s-operators/lib-common/modules/common/env"
3131
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
32-
common_rbac "github.com/openstack-k8s-operators/lib-common/modules/common/rbac"
3332
testv1beta1 "github.com/openstack-k8s-operators/test-operator/api/v1beta1"
3433
v1beta1 "github.com/openstack-k8s-operators/test-operator/api/v1beta1"
3534
"github.com/openstack-k8s-operators/test-operator/pkg/ansibletest"
@@ -52,14 +51,11 @@ func (r *AnsibleTestReconciler) GetLogger(ctx context.Context) logr.Logger {
5251
// +kubebuilder:rbac:groups=test.openstack.org,resources=ansibletests/status,verbs=get;update;patch
5352
// +kubebuilder:rbac:groups=test.openstack.org,resources=ansibletests/finalizers,verbs=update;patch
5453
// +kubebuilder:rbac:groups=k8s.cni.cncf.io,resources=network-attachment-definitions,verbs=get;list;watch
55-
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=roles,verbs=get;list;watch;create;update;patch
56-
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update;patch
5754
// +kubebuilder:rbac:groups="security.openshift.io",resourceNames=anyuid;privileged;nonroot;nonroot-v2,resources=securitycontextconstraints,verbs=use
5855
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch
5956
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch;create;update;patch;delete;
6057
// +kubebuilder:rbac:groups="",resources=pods,verbs=create;delete;get;list;patch;update;watch
6158
// +kubebuilder:rbac:groups="",resources=persistentvolumeclaims,verbs=get;list;create;update;watch;patch;delete
62-
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;list;watch;create;update;patch
6359

6460
// Reconcile - AnsibleTest
6561
func (r *AnsibleTestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error) {
@@ -236,15 +232,6 @@ func (r *AnsibleTestReconciler) Reconcile(ctx context.Context, req ctrl.Request)
236232
}
237233
}
238234

239-
// Service account, role, binding
240-
rbacRules := GetCommonRbacRules(privileged)
241-
rbacResult, err := common_rbac.ReconcileRbac(ctx, helper, instance, rbacRules)
242-
if err != nil {
243-
return rbacResult, err
244-
} else if (rbacResult != ctrl.Result{}) {
245-
return rbacResult, nil
246-
}
247-
// Service account, role, binding - end
248235
podDef := ansibletest.Pod(
249236
instance,
250237
serviceLabels,

controllers/horizontest_controller.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2727
"github.com/openstack-k8s-operators/lib-common/modules/common/env"
2828
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
29-
common_rbac "github.com/openstack-k8s-operators/lib-common/modules/common/rbac"
3029
testv1beta1 "github.com/openstack-k8s-operators/test-operator/api/v1beta1"
3130
"github.com/openstack-k8s-operators/test-operator/pkg/horizontest"
3231
corev1 "k8s.io/api/core/v1"
@@ -49,14 +48,11 @@ func (r *HorizonTestReconciler) GetLogger(ctx context.Context) logr.Logger {
4948
// +kubebuilder:rbac:groups=test.openstack.org,resources=horizontests/status,verbs=get;update;patch
5049
// +kubebuilder:rbac:groups=test.openstack.org,resources=horizontests/finalizers,verbs=update;patch
5150
// +kubebuilder:rbac:groups=k8s.cni.cncf.io,resources=network-attachment-definitions,verbs=get;list;watch
52-
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=roles,verbs=get;list;watch;create;update;patch
53-
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update;patch
5451
// +kubebuilder:rbac:groups="security.openshift.io",resourceNames=anyuid;privileged;nonroot;nonroot-v2,resources=securitycontextconstraints,verbs=use
5552
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch
5653
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch;create;update;patch;delete;
5754
// +kubebuilder:rbac:groups="",resources=pods,verbs=create;delete;get;list;patch;update;watch
5855
// +kubebuilder:rbac:groups="",resources=persistentvolumeclaims,verbs=get;list;create;update;watch;patch;delete
59-
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;list;watch;create;update;patch
6056

6157
// Reconcile - HorizonTest
6258
func (r *HorizonTestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error) {
@@ -227,15 +223,6 @@ func (r *HorizonTestReconciler) Reconcile(ctx context.Context, req ctrl.Request)
227223
return ctrl.Result{}, err
228224
}
229225

230-
// Service account, role, binding
231-
rbacRules := GetCommonRbacRules(instance.Spec.Privileged)
232-
rbacResult, err := common_rbac.ReconcileRbac(ctx, helper, instance, rbacRules)
233-
if err != nil {
234-
return rbacResult, err
235-
} else if (rbacResult != ctrl.Result{}) {
236-
return rbacResult, nil
237-
}
238-
// Service account, role, binding - end
239226
podDef := horizontest.Pod(
240227
instance,
241228
serviceLabels,

controllers/tempest_controller.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
3232
"github.com/openstack-k8s-operators/lib-common/modules/common/labels"
3333
nad "github.com/openstack-k8s-operators/lib-common/modules/common/networkattachment"
34-
common_rbac "github.com/openstack-k8s-operators/lib-common/modules/common/rbac"
3534
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
3635
testv1beta1 "github.com/openstack-k8s-operators/test-operator/api/v1beta1"
3736
"github.com/openstack-k8s-operators/test-operator/pkg/tempest"
@@ -55,14 +54,11 @@ func (r *TempestReconciler) GetLogger(ctx context.Context) logr.Logger {
5554
// +kubebuilder:rbac:groups=test.openstack.org,resources=tempests/status,verbs=get;update;patch
5655
// +kubebuilder:rbac:groups=test.openstack.org,resources=tempests/finalizers,verbs=update;patch
5756
// +kubebuilder:rbac:groups=k8s.cni.cncf.io,resources=network-attachment-definitions,verbs=get;list;watch
58-
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=roles,verbs=get;list;watch;create;update;patch
59-
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update;patch
6057
// +kubebuilder:rbac:groups="security.openshift.io",resourceNames=anyuid;privileged;nonroot;nonroot-v2,resources=securitycontextconstraints,verbs=use
6158
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch
6259
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch;create;update;patch;delete;
6360
// +kubebuilder:rbac:groups="",resources=pods,verbs=create;delete;get;list;patch;update;watch
6461
// +kubebuilder:rbac:groups="",resources=persistentvolumeclaims,verbs=get;list;create;update;watch;patch;delete
65-
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;list;watch;create;update;patch
6662

6763
// Reconcile - Tempest
6864
func (r *TempestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error) {
@@ -327,16 +323,6 @@ func (r *TempestReconciler) Reconcile(ctx context.Context, req ctrl.Request) (re
327323
return ctrl.Result{}, err
328324
}
329325

330-
// Service account, role, binding
331-
rbacRules := GetCommonRbacRules(instance.Spec.Privileged)
332-
rbacResult, err := common_rbac.ReconcileRbac(ctx, helper, instance, rbacRules)
333-
if err != nil {
334-
return rbacResult, err
335-
} else if (rbacResult != ctrl.Result{}) {
336-
return rbacResult, nil
337-
}
338-
// Service account, role, binding - end
339-
340326
// Note(lpiwowar): Remove all the workflow merge code to webhook once it is done.
341327
// It will simplify the logic and duplicite code (Tempest vs Tobiko)
342328
if nextWorkflowStep < len(instance.Spec.Workflow) {

controllers/tobiko_controller.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import (
3131
"github.com/openstack-k8s-operators/lib-common/modules/common/env"
3232
"github.com/openstack-k8s-operators/lib-common/modules/common/helper"
3333
nad "github.com/openstack-k8s-operators/lib-common/modules/common/networkattachment"
34-
common_rbac "github.com/openstack-k8s-operators/lib-common/modules/common/rbac"
3534
"github.com/openstack-k8s-operators/lib-common/modules/common/util"
3635
testv1beta1 "github.com/openstack-k8s-operators/test-operator/api/v1beta1"
3736
"github.com/openstack-k8s-operators/test-operator/pkg/tobiko"
@@ -55,14 +54,11 @@ func (r *TobikoReconciler) GetLogger(ctx context.Context) logr.Logger {
5554
// +kubebuilder:rbac:groups=test.openstack.org,resources=tobikoes/status,verbs=get;update;patch
5655
// +kubebuilder:rbac:groups=test.openstack.org,resources=tobikoes/finalizers,verbs=update;patch
5756
// +kubebuilder:rbac:groups=k8s.cni.cncf.io,resources=network-attachment-definitions,verbs=get;list;watch
58-
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=roles,verbs=get;list;watch;create;update;patch
59-
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=rolebindings,verbs=get;list;watch;create;update;patch
6057
// +kubebuilder:rbac:groups="security.openshift.io",resourceNames=anyuid;privileged;nonroot;nonroot-v2,resources=securitycontextconstraints,verbs=use
6158
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch
6259
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=get;list;watch;create;update;patch;delete;
6360
// +kubebuilder:rbac:groups="",resources=pods,verbs=create;delete;get;list;patch;update;watch
6461
// +kubebuilder:rbac:groups="",resources=persistentvolumeclaims,verbs=get;list;create;update;watch;patch;delete
65-
// +kubebuilder:rbac:groups="",resources=serviceaccounts,verbs=get;list;watch;create;update;patch
6662

6763
// Reconcile - Tobiko
6864
func (r *TobikoReconciler) Reconcile(ctx context.Context, req ctrl.Request) (result ctrl.Result, _err error) {
@@ -315,16 +311,6 @@ func (r *TobikoReconciler) Reconcile(ctx context.Context, req ctrl.Request) (res
315311
return ctrl.Result{}, err
316312
}
317313

318-
// Service account, role, binding
319-
rbacRules := GetCommonRbacRules(privileged)
320-
rbacResult, err := common_rbac.ReconcileRbac(ctx, helper, instance, rbacRules)
321-
if err != nil {
322-
return rbacResult, err
323-
} else if (rbacResult != ctrl.Result{}) {
324-
return rbacResult, nil
325-
}
326-
// Service account, role, binding - end
327-
328314
podDef := tobiko.Pod(
329315
instance,
330316
serviceLabels,

0 commit comments

Comments
 (0)