Skip to content

Commit 9a5f11e

Browse files
authored
Grant ns admin missing create RBAC for various CDI resources (#3030)
Signed-off-by: Alex Kalenyuk <[email protected]>
1 parent 0e8ea6b commit 9a5f11e

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

pkg/operator/resources/cluster/rbac.go

+5
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ func getAdminPolicyRules() []rbacv1.PolicyRule {
4242
},
4343
Resources: []string{
4444
"datavolumes",
45+
"dataimportcrons",
46+
"datasources",
47+
"volumeimportsources",
48+
"volumeuploadsources",
49+
"volumeclonesources",
4550
},
4651
Verbs: []string{
4752
"*",

tests/rbac_test.go

+6-12
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package tests
22

33
import (
44
"context"
5-
"fmt"
6-
"reflect"
75
"time"
86

97
. "github.com/onsi/ginkgo/v2"
@@ -217,6 +215,11 @@ var _ = Describe("Aggregated role definition tests", Serial, func() {
217215
},
218216
Resources: []string{
219217
"datavolumes",
218+
"dataimportcrons",
219+
"datasources",
220+
"volumeimportsources",
221+
"volumeuploadsources",
222+
"volumeclonesources",
220223
},
221224
Verbs: []string{
222225
"*",
@@ -289,16 +292,7 @@ var _ = Describe("Aggregated role definition tests", Serial, func() {
289292
clusterRole, err := f.K8sClient.RbacV1().ClusterRoles().Get(context.TODO(), role, metav1.GetOptions{})
290293
Expect(err).ToNot(HaveOccurred())
291294

292-
for _, expectedRule := range rules {
293-
found := false
294-
for _, r := range clusterRole.Rules {
295-
if reflect.DeepEqual(expectedRule, r) {
296-
found = true
297-
break
298-
}
299-
}
300-
Expect(found).To(BeTrue(), fmt.Sprintf("Rule for resources %v should exist", expectedRule.Resources))
301-
}
295+
Expect(clusterRole.Rules).To(ContainElements(rules))
302296
},
303297
Entry("[test_id:3945]for admin", "admin", adminRules),
304298
Entry("[test_id:3946]for edit", "edit", editRules),

0 commit comments

Comments
 (0)