Merge "Adding Cluster Role Binding for RIC."
[ric-plt/ric-dep.git] / depRicKubernetesOperator / internal / controller / getClusterRoleBinding.go
1 package controller\r
2 \r
3 import (\r
4         corev1 "k8s.io/api/core/v1"\r
5         metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"\r
6         "k8s.io/apimachinery/pkg/util/intstr"\r
7 )\r
8 \r
9 func GetClusterRoleBinding() []*rbacv1.ClusterRoleBinding {\r
10 \r
11         clusterRoleBinding1 := &rbacv1.ClusterRoleBinding{\r
12                 TypeMeta: metav1.TypeMeta{\r
13                         APIVersion: "rbac.authorization.k8s.io/v1",\r
14                         Kind:       "ClusterRoleBinding",\r
15                 },\r
16                 ObjectMeta: metav1.ObjectMeta{\r
17                         Name:      "svcacct-ricplt-appmgr-ricxapp-access",\r
18                         Namespace: "ricplt",\r
19                 },\r
20                 RoleRef: rbacv1.RoleRef{\r
21                         Kind:     "ClusterRole",\r
22                         Name:     "svcacct-ricplt-appmgr-ricxapp-access",\r
23                         APIGroup: "rbac.authorization.k8s.io",\r
24                 },\r
25                 Subjects: []rbacv1.Subject{\r
26 \r
27                         rbacv1.Subject{\r
28                                 Namespace: "ricplt",\r
29                                 Kind:      "ServiceAccount",\r
30                                 Name:      "svcacct-ricplt-appmgr",\r
31                         },\r
32                 },\r
33         }\r
34 \r
35         clusterRoleBinding2 := &rbacv1.ClusterRoleBinding{\r
36                 ObjectMeta: metav1.ObjectMeta{\r
37                         Name:      "svcacct-ricplt-appmgr-ricxapp-getappconfig",\r
38                         Namespace: "ricxapp",\r
39                 },\r
40                 RoleRef: rbacv1.RoleRef{\r
41                         APIGroup: "rbac.authorization.k8s.io",\r
42                         Kind:     "ClusterRole",\r
43                         Name:     "svcacct-ricplt-appmgr-ricxapp-getappconfig",\r
44                 },\r
45                 Subjects: []rbacv1.Subject{\r
46 \r
47                         rbacv1.Subject{\r
48                                 Namespace: "ricplt",\r
49                                 Kind:      "ServiceAccount",\r
50                                 Name:      "svcacct-ricplt-appmgr",\r
51                         },\r
52                 },\r
53                 TypeMeta: metav1.TypeMeta{\r
54                         APIVersion: "rbac.authorization.k8s.io/v1",\r
55                         Kind:       "ClusterRoleBinding",\r
56                 },\r
57         }\r
58 \r
59         clusterRoleBinding3 := &rbacv1.ClusterRoleBinding{\r
60                 RoleRef: rbacv1.RoleRef{\r
61                         APIGroup: "rbac.authorization.k8s.io",\r
62                         Kind:     "ClusterRole",\r
63                         Name:     "release-name-kong",\r
64                 },\r
65                 Subjects: []rbacv1.Subject{\r
66 \r
67                         rbacv1.Subject{\r
68                                 Namespace: "ricplt",\r
69                                 Kind:      "ServiceAccount",\r
70                                 Name:      "release-name-kong",\r
71                         },\r
72                 },\r
73                 TypeMeta: metav1.TypeMeta{\r
74                         APIVersion: "rbac.authorization.k8s.io/v1",\r
75                         Kind:       "ClusterRoleBinding",\r
76                 },\r
77                 ObjectMeta: metav1.ObjectMeta{\r
78                         Labels: map[string]string{\r
79                                 "helm.sh/chart":                "kong-0.36.6",\r
80                                 "app.kubernetes.io/instance":   "release-name",\r
81                                 "app.kubernetes.io/managed-by": "Helm",\r
82                                 "app.kubernetes.io/name":       "kong",\r
83                                 "app.kubernetes.io/version":    "1.4",\r
84                         },\r
85                         Name: "release-name-kong",\r
86                 },\r
87         }\r
88 \r
89         clusterRoleBinding4 := &rbacv1.ClusterRoleBinding{\r
90                 Subjects: []rbacv1.Subject{\r
91 \r
92                         rbacv1.Subject{\r
93                                 Kind:      "ServiceAccount",\r
94                                 Name:      "release-name-kong",\r
95                                 Namespace: "ricplt",\r
96                         },\r
97                 },\r
98                 TypeMeta: metav1.TypeMeta{\r
99                         APIVersion: "rbac.authorization.k8s.io/v1",\r
100                         Kind:       "ClusterRoleBinding",\r
101                 },\r
102                 ObjectMeta: metav1.ObjectMeta{\r
103                         Labels: map[string]string{\r
104                                 "app.kubernetes.io/instance":   "release-name",\r
105                                 "app.kubernetes.io/managed-by": "Helm",\r
106                                 "app.kubernetes.io/name":       "kong",\r
107                                 "app.kubernetes.io/version":    "1.4",\r
108                                 "helm.sh/chart":                "kong-0.36.6",\r
109                         },\r
110                         Name: "release-name-kong",\r
111                 },\r
112                 RoleRef: rbacv1.RoleRef{\r
113                         Name:     "release-name-kong",\r
114                         APIGroup: "rbac.authorization.k8s.io",\r
115                         Kind:     "ClusterRole",\r
116                 },\r
117         }\r
118 \r
119         return []*rbacv1.ClusterRoleBinding{clusterRoleBinding1, clusterRoleBinding2, clusterRoleBinding3, clusterRoleBinding4}\r
120 }\r