Search in sources :

Example 31 with SubjectBuilder

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();
}
Also used : StackGresCluster(io.stackgres.common.crd.sgcluster.StackGresCluster) RoleBindingBuilder(io.fabric8.kubernetes.api.model.rbac.RoleBindingBuilder) SubjectBuilder(io.fabric8.kubernetes.api.model.rbac.SubjectBuilder) RoleRefBuilder(io.fabric8.kubernetes.api.model.rbac.RoleRefBuilder)

Aggregations

SubjectBuilder (io.fabric8.kubernetes.api.model.rbac.SubjectBuilder)31 RoleRefBuilder (io.fabric8.kubernetes.api.model.rbac.RoleRefBuilder)29 RoleRef (io.fabric8.kubernetes.api.model.rbac.RoleRef)18 Subject (io.fabric8.kubernetes.api.model.rbac.Subject)18 RoleBindingBuilder (io.fabric8.kubernetes.api.model.rbac.RoleBindingBuilder)13 ClusterRoleBindingBuilder (io.fabric8.kubernetes.api.model.rbac.ClusterRoleBindingBuilder)10 RoleBinding (io.fabric8.kubernetes.api.model.rbac.RoleBinding)6 ClusterRoleBinding (io.fabric8.kubernetes.api.model.rbac.ClusterRoleBinding)5 Test (org.junit.jupiter.api.Test)3 ConfigMap (io.fabric8.kubernetes.api.model.ConfigMap)2 ConfigMapBuilder (io.fabric8.kubernetes.api.model.ConfigMapBuilder)2 Role (io.fabric8.kubernetes.api.model.rbac.Role)2 RoleBuilder (io.fabric8.kubernetes.api.model.rbac.RoleBuilder)2 KubernetesClient (io.fabric8.kubernetes.client.KubernetesClient)2 EnableKubernetesMockClient (io.fabric8.kubernetes.client.server.mock.EnableKubernetesMockClient)2 ParallelNamespaceTest (io.strimzi.systemtest.annotations.ParallelNamespaceTest)2 KafkaClients (io.strimzi.systemtest.kafkaclients.internalClients.KafkaClients)2 KafkaClientsBuilder (io.strimzi.systemtest.kafkaclients.internalClients.KafkaClientsBuilder)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2