...
1
16
17 package rest
18
19 import (
20 "testing"
21
22 "k8s.io/client-go/kubernetes/fake"
23 "k8s.io/kubernetes/plugin/pkg/auth/authorizer/rbac/bootstrappolicy"
24 )
25
26 func BenchmarkEnsureRBACPolicy(b *testing.B) {
27 for n := 0; n < b.N; n++ {
28 var policy = &PolicyData{
29 ClusterRoles: append(bootstrappolicy.ClusterRoles(), bootstrappolicy.ControllerRoles()...),
30 ClusterRoleBindings: append(bootstrappolicy.ClusterRoleBindings(), bootstrappolicy.ControllerRoleBindings()...),
31 Roles: bootstrappolicy.NamespaceRoles(),
32 RoleBindings: bootstrappolicy.NamespaceRoleBindings(),
33 ClusterRolesToAggregate: bootstrappolicy.ClusterRolesToAggregate(),
34 ClusterRoleBindingsToSplit: bootstrappolicy.ClusterRoleBindingsToSplit(),
35 }
36 coreClientSet := fake.NewSimpleClientset()
37 _, _ = ensureRBACPolicy(policy, coreClientSet)
38 }
39 }
40
View as plain text