MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / CreateRoleBinding

Function CreateRoleBinding

pkg/specs/rolebinding.go:31–54  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

29// CreateRoleBinding is the binding between the permissions that the instance manager can use
30// and the ServiceAccount used by the Pod
31func 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}

Callers 3

RoleBindingFunction · 0.92
createRoleBindingMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected