blob: 31e1bb4fea303ad07f66c15bd93831e8d0bfedb6 [file] [log] [blame]
naman.gupta6d0129c2023-12-01 19:45:42 +05301package controller
2
3import (
4 corev1 "k8s.io/api/core/v1"
5 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
6)
7
8func GetClusterRole() []*rbacv1.ClusterRole {
9
10 clusterRole1 := &rbacv1.ClusterRole{
11 ObjectMeta: metav1.ObjectMeta{
12 Name: "svcacct-ricplt-appmgr-ricxapp-access",
13 },
14 Rules: []rbacv1.PolicyRule{
15
16 rbacv1.PolicyRule{
17 APIGroups: []string{
18
19 "",
20 },
21 Resources: []string{
22
23 "pods/portforward",
24 },
25 Verbs: []string{
26
27 "create",
28 },
29 },
30 rbacv1.PolicyRule{
31 APIGroups: []string{
32
33 "",
34 },
35 Resources: []string{
36
37 "pods",
38 "configmaps",
39 "deployments",
40 "services",
41 },
42 Verbs: []string{
43
44 "get",
45 "list",
46 "create",
47 "delete",
48 },
49 },
50 rbacv1.PolicyRule{
51 APIGroups: []string{
52
53 "",
54 },
55 Resources: []string{
56
57 "secrets",
58 },
59 Verbs: []string{
60
61 "get",
62 "list",
63 },
64 },
65 },
66 TypeMeta: metav1.TypeMeta{
67 Kind: "ClusterRole",
68 APIVersion: "rbac.authorization.k8s.io/v1",
69 },
70 }
71
72 clusterRole2 := &rbacv1.ClusterRole{
73 Rules: []rbacv1.PolicyRule{
74
75 rbacv1.PolicyRule{
76 APIGroups: []string{
77
78 "",
79 },
80 Resources: []string{
81
82 "configmaps",
83 "endpoints",
84 "services",
85 },
86 Verbs: []string{
87
88 "get",
89 "list",
90 "create",
91 "update",
92 "delete",
93 },
94 },
95 },
96 TypeMeta: metav1.TypeMeta{
97 APIVersion: "rbac.authorization.k8s.io/v1",
98 Kind: "ClusterRole",
99 },
100 ObjectMeta: metav1.ObjectMeta{
101 Name: "svcacct-ricplt-appmgr-ricxapp-getappconfig",
102 },
103 }
104
105 return []*rbacv1.ClusterRole{clusterRole1, clusterRole2}
106
107}