CreateRoleBinding is the binding between the permissions that the instance manager can use and the ServiceAccount used by the Pod
(objectMeta metav1.ObjectMeta, serviceAccountName string)
| 29 | // CreateRoleBinding is the binding between the permissions that the instance manager can use |
| 30 | // and the ServiceAccount used by the Pod |
| 31 | func CreateRoleBinding(objectMeta metav1.ObjectMeta, serviceAccountName string) rbacv1.RoleBinding { |
| 32 | return rbacv1.RoleBinding{ |
| 33 | ObjectMeta: metav1.ObjectMeta{ |
| 34 | Namespace: objectMeta.Namespace, |
| 35 | Name: objectMeta.Name, |
| 36 | Labels: map[string]string{ |
| 37 | utils.KubernetesAppManagedByLabelName: utils.ManagerName, |
| 38 | }, |
| 39 | }, |
| 40 | Subjects: []rbacv1.Subject{ |
| 41 | { |
| 42 | Kind: "ServiceAccount", |
| 43 | APIGroup: "", |
| 44 | Name: serviceAccountName, |
| 45 | Namespace: objectMeta.Namespace, |
| 46 | }, |
| 47 | }, |
| 48 | RoleRef: rbacv1.RoleRef{ |
| 49 | APIGroup: "rbac.authorization.k8s.io", |
| 50 | Kind: "Role", |
| 51 | Name: objectMeta.Name, |
| 52 | }, |
| 53 | } |
| 54 | } |
no outgoing calls
no test coverage detected