use of io.fabric8.kubernetes.api.model.rbac.SubjectBuilder in project stackgres by ongres.
the class PatroniRoleGenerator method createRoleBinding.
/**
* Create the RoleBinding for patroni associated to the cluster.
*/
private RoleBinding createRoleBinding(StackGresClusterContext context) {
final StackGresCluster cluster = context.getSource();
final Map<String, String> labels = labelFactory.clusterLabels(cluster);
return new RoleBindingBuilder().withNewMetadata().withName(roleName(context)).withNamespace(cluster.getMetadata().getNamespace()).withLabels(labels).endMetadata().withSubjects(new SubjectBuilder().withKind("ServiceAccount").withName(roleName(context)).withNamespace(cluster.getMetadata().getNamespace()).build()).withRoleRef(new RoleRefBuilder().withKind("Role").withName(roleName(context)).withApiGroup("rbac.authorization.k8s.io").build()).build();
}
Aggregations