use of io.fabric8.kubernetes.api.model.rbac.ClusterRoleBindingBuilder in project strimzi-kafka-operator by strimzi.
the class ClusterRoleBindingOperatorIT method getModified.
@Override
protected ClusterRoleBinding getModified() {
Subject ks = new SubjectBuilder().withKind("ServiceAccount").withName("my-service-account2").withNamespace("my-namespace2").build();
// RoleRef cannot be changed
RoleRef roleRef = new RoleRefBuilder().withName("my-cluster-role").withApiGroup("rbac.authorization.k8s.io").withKind("ClusterRole").build();
return new ClusterRoleBindingBuilder().withNewMetadata().withName(resourceName).withLabels(singletonMap("state", "modified")).endMetadata().withSubjects(ks).withRoleRef(roleRef).build();
}
use of io.fabric8.kubernetes.api.model.rbac.ClusterRoleBindingBuilder in project strimzi-kafka-operator by strimzi.
the class ClusterRoleBindingResource method clusterRoleBinding.
public static ClusterRoleBinding clusterRoleBinding(ExtensionContext extensionContext, String yamlPath, String namespace) {
LOGGER.info("Creating ClusterRoleBinding in test case {} from {} in namespace {}", extensionContext.getDisplayName(), yamlPath, namespace);
ClusterRoleBinding clusterRoleBinding = getClusterRoleBindingFromYaml(yamlPath);
clusterRoleBinding = new ClusterRoleBindingBuilder(clusterRoleBinding).editFirstSubject().withNamespace(namespace).endSubject().build();
ResourceManager.getInstance().createResource(extensionContext, clusterRoleBinding);
return clusterRoleBinding;
}
Aggregations