下面列出了io.fabric8.kubernetes.api.model.rbac.RoleBindingBuilder#io.fabric8.kubernetes.api.model.rbac.RoleBinding 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public RoleBinding generateRoleBinding(String namespace, String watchedNamespace) {
Subject ks = new SubjectBuilder()
.withKind("ServiceAccount")
.withName(EntityOperator.entityOperatorServiceAccountName(cluster))
.withNamespace(namespace)
.build();
RoleRef roleRef = new RoleRefBuilder()
.withName(EntityOperator.EO_CLUSTER_ROLE_NAME)
.withApiGroup("rbac.authorization.k8s.io")
.withKind("ClusterRole")
.build();
RoleBinding rb = new RoleBindingBuilder()
.withNewMetadata()
.withName(roleBindingName(cluster))
.withNamespace(watchedNamespace)
.withOwnerReferences(createOwnerReference())
.withLabels(labels.toMap())
.endMetadata()
.withRoleRef(roleRef)
.withSubjects(singletonList(ks))
.build();
return rb;
}
public RoleBinding generateRoleBinding(String namespace, String watchedNamespace) {
Subject ks = new SubjectBuilder()
.withKind("ServiceAccount")
.withName(EntityOperator.entityOperatorServiceAccountName(cluster))
.withNamespace(namespace)
.build();
RoleRef roleRef = new RoleRefBuilder()
.withName(EntityOperator.EO_CLUSTER_ROLE_NAME)
.withApiGroup("rbac.authorization.k8s.io")
.withKind("ClusterRole")
.build();
RoleBinding rb = new RoleBindingBuilder()
.withNewMetadata()
.withName(roleBindingName(cluster))
.withNamespace(watchedNamespace)
.withOwnerReferences(createOwnerReference())
.withLabels(labels.toMap())
.endMetadata()
.withRoleRef(roleRef)
.withSubjects(singletonList(ks))
.build();
return rb;
}
@Override
protected RoleBinding getOriginal() {
Subject ks = new SubjectBuilder()
.withKind("ServiceAccount")
.withName("my-service-account")
.withNamespace("my-namespace")
.build();
RoleRef roleRef = new RoleRefBuilder()
.withName("my-cluster-role")
.withApiGroup("rbac.authorization.k8s.io")
.withKind("ClusterRole")
.build();
return new RoleBindingBuilder()
.withNewMetadata()
.withName(RESOURCE_NAME)
.withNamespace(namespace)
.withLabels(singletonMap("state", "new"))
.endMetadata()
.withSubjects(ks)
.withRoleRef(roleRef)
.build();
}
@Override
protected RoleBinding 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 RoleBindingBuilder()
.withNewMetadata()
.withName(RESOURCE_NAME)
.withNamespace(namespace)
.withLabels(singletonMap("state", "modified"))
.endMetadata()
.withSubjects(ks)
.withRoleRef(roleRef)
.build();
}
@Override
protected RoleBinding resource() {
Subject ks = new SubjectBuilder()
.withKind("ServiceAccount")
.withName("some-service-account")
.withNamespace(NAMESPACE)
.build();
RoleRef roleRef = new RoleRefBuilder()
.withName("some-role")
.withApiGroup("rbac.authorization.k8s.io")
.withKind("ClusterRole")
.build();
return new RoleBindingBuilder()
.withNewMetadata()
.withName(RESOURCE_NAME)
.withNamespace(NAMESPACE)
.withLabels(singletonMap("foo", "bar"))
.endMetadata()
.withRoleRef(roleRef)
.withSubjects(singletonList(ks))
.build();
}
/**
* Recursively search an object tree checking for POJOs annotated with @JsonAnyGetter.
* These are likely erroneous YAML.
*/
private void recurseForAdditionalProperties(Stack<String> path, Object resource) {
try {
Class<?> cls = resource.getClass();
if (RoleBinding.class.equals(cls)
|| ClusterRoleBinding.class.equals(cls)) {
// XXX: hack because fabric8 RoleBinding reflect the openshift role binding API
// not the k8s one, and has an unexpected apiGroup property
return;
}
for (Method method : cls.getMethods()) {
checkForJsonAnyGetter(path, resource, cls, method);
}
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
}
private RoleBinding createViewRoleBinding() {
return new RoleBindingBuilder()
.withNewMetadata()
.withName(serviceAccountName + "-view")
.withNamespace(namespace)
.endMetadata()
.withNewRoleRef()
.withKind("Role")
.withName("workspace-view")
.endRoleRef()
.withSubjects(
new SubjectBuilder()
.withKind("ServiceAccount")
.withName(serviceAccountName)
.withNamespace(namespace)
.build())
.build();
}
private RoleBinding createExecRoleBinding() {
return new RoleBindingBuilder()
.withNewMetadata()
.withName(serviceAccountName + "-exec")
.withNamespace(namespace)
.endMetadata()
.withNewRoleRef()
.withKind("Role")
.withName("exec")
.endRoleRef()
.withSubjects(
new SubjectBuilder()
.withKind("ServiceAccount")
.withName(serviceAccountName)
.withNamespace(namespace)
.build())
.build();
}
private RoleBinding createCustomRoleBinding(String clusterRoleName) {
return new RoleBindingBuilder()
.withNewMetadata()
.withName(serviceAccountName + "-custom")
.withNamespace(namespace)
.endMetadata()
.withNewRoleRef()
.withKind("ClusterRole")
.withName(clusterRoleName)
.endRoleRef()
.withSubjects(
new SubjectBuilder()
.withKind("ServiceAccount")
.withName(serviceAccountName)
.withNamespace(namespace)
.build())
.build();
}
@Test
public void load() {
RoleBinding aRoleBinding = client.rbac().roleBindings().inNamespace(currentNamespace)
.load(getClass().getResourceAsStream("/test-kubernetesrolebinding.yml")).get();
assertNotNull(aRoleBinding);
assertEquals("RoleBinding", aRoleBinding.getKind());
assertNotNull(aRoleBinding.getMetadata());
assertEquals("read-jobs", aRoleBinding.getMetadata().getName());
assertNotNull(aRoleBinding.getSubjects());
assertEquals(1, aRoleBinding.getSubjects().size());
assertEquals("rbac.authorization.k8s.io", aRoleBinding.getSubjects().get(0).getApiGroup());
assertEquals("User", aRoleBinding.getSubjects().get(0).getKind());
assertEquals("jane", aRoleBinding.getSubjects().get(0).getName());
assertEquals("default", aRoleBinding.getSubjects().get(0).getNamespace());
assertNotNull(aRoleBinding.getRoleRef());
assertEquals("Role", aRoleBinding.getRoleRef().getKind());
assertEquals("job-reader", aRoleBinding.getRoleRef().getName());
assertEquals("rbac.authorization.k8s.io", aRoleBinding.getRoleRef().getApiGroup());
}
public void applyRoleBinding(RoleBinding entity, String sourceName) {
String id = getName(entity);
Objects.requireNonNull(id, "No name for " + entity + " " + sourceName);
String namespace = KubernetesHelper.getNamespace(entity);
if (StringUtils.isBlank(namespace)) {
namespace = getNamespace();
}
applyNamespace(namespace);
RoleBinding old = kubernetesClient.rbac().roleBindings().inNamespace(namespace).withName(id).get();
if (isRunning(old)) {
if (UserConfigurationCompare.configEqual(entity, old)) {
log.info("RoleBinding has not changed so not doing anything");
} else {
if (isRecreateMode()) {
log.info("Deleting RoleBinding: " + id);
kubernetesClient.rbac().roleBindings().inNamespace(namespace).withName(id).delete();
doCreateRoleBinding(entity, namespace, sourceName);
} else {
log.info("Updating RoleBinding from " + sourceName);
try {
String resourceVersion = KubernetesHelper.getResourceVersion(old);
ObjectMeta metadata = getOrCreateMetadata(entity);
metadata.setNamespace(namespace);
metadata.setResourceVersion(resourceVersion);
Object answer = kubernetesClient.rbac().roleBindings().inNamespace(namespace).withName(id).replace(entity);
logGeneratedEntity("Updated RoleBinding: ", namespace, entity, answer);
} catch (Exception e) {
onApplyError("Failed to update RoleBinding from " + sourceName + ". " + e + ". " + entity, e);
}
}
}
} else {
if (!isAllowCreate()) {
log.warn("Creation disabled so not creating RoleBinding from " + sourceName + " namespace " + namespace + " name " + getName(entity));
} else {
doCreateRoleBinding(entity, namespace, sourceName);
}
}
}
public void doCreateRoleBinding(RoleBinding entity, String namespace , String sourceName) {
try {
log.info("Creating RoleBinding from " + sourceName + " namespace " + namespace + " name " + getName(entity));
kubernetesClient.rbac().roleBindings().inNamespace(namespace).create(entity);
} catch (Exception e) {
onApplyError("Failed to create RoleBinding from " + sourceName + ". " + e, e);
}
}
Future<ReconciliationState> entityOperatorUserOpRoleBinding() {
if (eoDeployment != null && entityOperator.getUserOperator() != null) {
Future<ReconcileResult<RoleBinding>> ownNamespaceFuture;
Future<ReconcileResult<RoleBinding>> watchedNamespaceFuture;
String watchedNamespace = namespace;
if (entityOperator.getUserOperator().getWatchedNamespace() != null
&& !entityOperator.getUserOperator().getWatchedNamespace().isEmpty()) {
watchedNamespace = entityOperator.getUserOperator().getWatchedNamespace();
}
if (!namespace.equals(watchedNamespace)) {
watchedNamespaceFuture = roleBindingOperations.reconcile(watchedNamespace, EntityUserOperator.roleBindingName(name), entityOperator.getUserOperator().generateRoleBinding(namespace, watchedNamespace));
} else {
watchedNamespaceFuture = Future.succeededFuture();
}
// Create role binding for the the UI runs in (it needs to access the CA etc.)
ownNamespaceFuture = roleBindingOperations.reconcile(namespace, EntityUserOperator.roleBindingName(name), entityOperator.getUserOperator().generateRoleBinding(namespace, namespace));
return withVoid(CompositeFuture.join(ownNamespaceFuture, watchedNamespaceFuture));
} else {
return withVoid(roleBindingOperations.reconcile(namespace, EntityUserOperator.roleBindingName(name), null));
}
}
@Test
public void testRoleBinding() {
RoleBinding binding = entityTopicOperator.generateRoleBinding(namespace, toWatchedNamespace);
assertThat(binding.getSubjects().get(0).getNamespace(), is(namespace));
assertThat(binding.getMetadata().getNamespace(), is(toWatchedNamespace));
}
@Test
public void testRoleBinding() {
RoleBinding binding = entityUserOperator.generateRoleBinding(namespace, uoWatchedNamespace);
assertThat(binding.getSubjects().get(0).getNamespace(), is(namespace));
assertThat(binding.getMetadata().getNamespace(), is(uoWatchedNamespace));
}
@Override
protected void assertResources(VertxTestContext context, RoleBinding expected, RoleBinding actual) {
context.verify(() -> assertThat(actual.getMetadata().getName(), is(expected.getMetadata().getName())));
context.verify(() -> assertThat(actual.getMetadata().getNamespace(), is(expected.getMetadata().getNamespace())));
context.verify(() -> assertThat(actual.getMetadata().getLabels(), is(expected.getMetadata().getLabels())));
context.verify(() -> assertThat(actual.getSubjects().size(), is(expected.getSubjects().size())));
context.verify(() -> assertThat(actual.getSubjects().get(0).getKind(), is(expected.getSubjects().get(0).getKind())));
context.verify(() -> assertThat(actual.getSubjects().get(0).getNamespace(), is(expected.getSubjects().get(0).getNamespace())));
context.verify(() -> assertThat(actual.getSubjects().get(0).getName(), is(expected.getSubjects().get(0).getName())));
context.verify(() -> assertThat(actual.getRoleRef().getKind(), is(expected.getRoleRef().getKind())));
context.verify(() -> assertThat(actual.getRoleRef().getApiGroup(), is(expected.getRoleRef().getApiGroup())));
context.verify(() -> assertThat(actual.getRoleRef().getName(), is(expected.getRoleRef().getName())));
}
@Test
public void kubernetesRoleBindingTest() throws Exception {
// given
final String originalJson = Helper.loadJson("/valid-roleBinding.json");
// when
final RoleBinding kubernetesRoleBinding = mapper.readValue(originalJson, RoleBinding.class);
final String serializedJson = mapper.writeValueAsString(kubernetesRoleBinding);
// then
assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
.isEqualTo(originalJson);
}
@Test
public void kubernetesRoleBuilderTest() throws Exception {
// given
final String originalJson = Helper.loadJson("/valid-roleBinding.json");
// when
RoleBinding kubernetesRoleBinding = new RoleBindingBuilder()
.withNewMetadata()
.withName("read-jobs")
.withNamespace("default")
.endMetadata()
.addToSubjects(0, new SubjectBuilder()
.withApiGroup("rbac.authorization.k8s.io")
.withKind("User")
.withName("jane")
.withNamespace("default")
.build()
)
.withRoleRef(new RoleRefBuilder()
.withApiGroup("rbac.authorization.k8s.io")
.withKind("Role")
.withName("job-reader")
.build()
)
.build();
final String serializedJson = mapper.writeValueAsString(kubernetesRoleBinding);
// then
assertThatJson(serializedJson).when(IGNORING_ARRAY_ORDER, TREATING_NULL_AS_ABSENT, IGNORING_EXTRA_FIELDS)
.isEqualTo(originalJson);
}
@Test
public void delete() {
Integer initialCountBeforeDeletion = client.rbac().roleBindings().inNamespace(currentNamespace).list().getItems().size();
boolean deleted = client.rbac().roleBindings().inNamespace(currentNamespace).withName("read-jobs").delete();
assertTrue(deleted);
DeleteEntity<RoleBinding> deleteEntity = new DeleteEntity<>(RoleBinding.class, client, "read-jobs", currentNamespace);
await().atMost(30, TimeUnit.SECONDS).until(deleteEntity);
RoleBindingList roleBindingList = client.rbac().roleBindings().inNamespace(currentNamespace).list();
assertEquals(initialCountBeforeDeletion - 1,roleBindingList.getItems().size());
}
/**
* Applies the given DTOs onto the Kubernetes master
*/
private void applyEntity(Object dto, String sourceName) throws Exception {
if (dto instanceof Pod) {
applyPod((Pod) dto, sourceName);
} else if (dto instanceof ReplicationController) {
applyReplicationController((ReplicationController) dto, sourceName);
} else if (dto instanceof Service) {
applyService((Service) dto, sourceName);
} else if (dto instanceof Route) {
applyRoute((Route) dto, sourceName);
} else if (dto instanceof BuildConfig) {
applyBuildConfig((BuildConfig) dto, sourceName);
} else if (dto instanceof DeploymentConfig) {
DeploymentConfig resource = (DeploymentConfig) dto;
OpenShiftClient openShiftClient = getOpenShiftClient();
if (openShiftClient != null) {
applyResource(resource, sourceName, openShiftClient.deploymentConfigs());
} else {
log.warn("Not connected to OpenShift cluster so cannot apply entity " + dto);
}
} else if (dto instanceof RoleBinding) {
applyRoleBinding((RoleBinding) dto, sourceName);
} else if (dto instanceof Role) {
applyResource((Role)dto, sourceName, kubernetesClient.rbac().roles());
} else if (dto instanceof ImageStream) {
applyImageStream((ImageStream) dto, sourceName);
} else if (dto instanceof OAuthClient) {
applyOAuthClient((OAuthClient) dto, sourceName);
} else if (dto instanceof Template) {
applyTemplate((Template) dto, sourceName);
} else if (dto instanceof ServiceAccount) {
applyServiceAccount((ServiceAccount) dto, sourceName);
} else if (dto instanceof Secret) {
applySecret((Secret) dto, sourceName);
} else if (dto instanceof ConfigMap) {
applyResource((ConfigMap) dto, sourceName, kubernetesClient.configMaps());
} else if (dto instanceof DaemonSet) {
applyResource((DaemonSet) dto, sourceName, kubernetesClient.apps().daemonSets());
} else if (dto instanceof Deployment) {
applyResource((Deployment) dto, sourceName, kubernetesClient.apps().deployments());
} else if (dto instanceof ReplicaSet) {
applyResource((ReplicaSet) dto, sourceName, kubernetesClient.apps().replicaSets());
} else if (dto instanceof StatefulSet) {
applyResource((StatefulSet) dto, sourceName, kubernetesClient.apps().statefulSets());
} else if (dto instanceof Ingress) {
applyResource((Ingress) dto, sourceName, kubernetesClient.extensions().ingresses());
} else if (dto instanceof PersistentVolumeClaim) {
applyPersistentVolumeClaim((PersistentVolumeClaim) dto, sourceName);
}else if (dto instanceof CustomResourceDefinition) {
applyCustomResourceDefinition((CustomResourceDefinition) dto, sourceName);
} else if (dto instanceof Job) {
applyJob((Job) dto, sourceName);
} else if (dto instanceof HasMetadata) {
HasMetadata entity = (HasMetadata) dto;
try {
log.info("Applying " + getKind(entity) + " " + getName(entity) + " from " + sourceName);
kubernetesClient.resource(entity).inNamespace(getNamespace()).createOrReplace();
} catch (Exception e) {
onApplyError("Failed to create " + getKind(entity) + " from " + sourceName + ". " + e, e);
}
} else {
throw new IllegalArgumentException("Unknown entity type " + dto);
}
}
@Override
protected MixedOperation<RoleBinding, RoleBindingList, DoneableRoleBinding,
Resource<RoleBinding, DoneableRoleBinding>> operation() {
return client.rbac().roleBindings();
}
@Override
protected AbstractResourceOperator<KubernetesClient, RoleBinding, RoleBindingList,
DoneableRoleBinding, Resource<RoleBinding, DoneableRoleBinding>> operator() {
return new RoleBindingOperator(vertx, client);
}
@Override
protected AbstractResourceOperator<KubernetesClient, RoleBinding, RoleBindingList, DoneableRoleBinding,
Resource<RoleBinding, DoneableRoleBinding>> createResourceOperations(Vertx vertx, KubernetesClient mockClient) {
return new RoleBindingOperator(vertx, mockClient);
}
public RoleBinding createOrReplaceRoleBinding(RoleBinding roleBinding) {
return client.rbac().roleBindings().inNamespace(getNamespace()).createOrReplace(roleBinding);
}
public List<RoleBinding> listRoleBindings() {
return client.rbac().roleBindings().list().getItems();
}
private static RoleBinding getRoleBindingFromYaml(String yamlPath) {
return TestUtils.configFromYaml(yamlPath, RoleBinding.class);
}
private static RoleBinding deleteLater(RoleBinding resource) {
return ResourceManager.deleteLater(ResourceManager.kubeClient().getClient().rbac().roleBindings(), resource);
}
@Test
void testGetPluralFromKind() {
// Given
Map<String, Class> pluralToKubernetesResourceMap = new HashMap<>();
pluralToKubernetesResourceMap.put("bindings", Binding.class);
pluralToKubernetesResourceMap.put("componentstatuses", ComponentStatus.class);
pluralToKubernetesResourceMap.put("configmaps", ConfigMap.class);
pluralToKubernetesResourceMap.put("endpoints", Endpoints.class);
pluralToKubernetesResourceMap.put("events", Event.class);
pluralToKubernetesResourceMap.put("limitranges", LimitRange.class);
pluralToKubernetesResourceMap.put("namespaces", Namespace.class);
pluralToKubernetesResourceMap.put("nodes", Node.class);
pluralToKubernetesResourceMap.put("persistentvolumeclaims", PersistentVolumeClaim.class);
pluralToKubernetesResourceMap.put("persistentvolumes", PersistentVolume.class);
pluralToKubernetesResourceMap.put("pods", Pod.class);
pluralToKubernetesResourceMap.put("podtemplates", PodTemplate.class);
pluralToKubernetesResourceMap.put("replicationcontrollers", ReplicationController.class);
pluralToKubernetesResourceMap.put("resourcequotas", ResourceQuota.class);
pluralToKubernetesResourceMap.put("secrets", Secret.class);
pluralToKubernetesResourceMap.put("serviceaccounts", ServiceAccount.class);
pluralToKubernetesResourceMap.put("services", Service.class);
pluralToKubernetesResourceMap.put("mutatingwebhookconfigurations", MutatingWebhookConfiguration.class);
pluralToKubernetesResourceMap.put("validatingwebhookconfigurations", ValidatingWebhookConfiguration.class);
pluralToKubernetesResourceMap.put("customresourcedefinitions", CustomResourceDefinition.class);
pluralToKubernetesResourceMap.put("controllerrevisions", ControllerRevision.class);
pluralToKubernetesResourceMap.put("daemonsets", DaemonSet.class);
pluralToKubernetesResourceMap.put("deployments", Deployment.class);
pluralToKubernetesResourceMap.put("replicasets", ReplicaSet.class);
pluralToKubernetesResourceMap.put("statefulsets", StatefulSet.class);
pluralToKubernetesResourceMap.put("tokenreviews", TokenReview.class);
pluralToKubernetesResourceMap.put("localsubjectaccessreviews", LocalSubjectAccessReview.class);
pluralToKubernetesResourceMap.put("selfsubjectaccessreviews", SelfSubjectAccessReview.class);
pluralToKubernetesResourceMap.put("selfsubjectrulesreviews", SelfSubjectRulesReview.class);
pluralToKubernetesResourceMap.put("subjectaccessreviews", SubjectAccessReview.class);
pluralToKubernetesResourceMap.put("horizontalpodautoscalers", HorizontalPodAutoscaler.class);
pluralToKubernetesResourceMap.put("cronjobs", CronJob.class);
pluralToKubernetesResourceMap.put("jobs", Job.class);
pluralToKubernetesResourceMap.put("certificatesigningrequests", CertificateSigningRequest.class);
pluralToKubernetesResourceMap.put("leases", Lease.class);
pluralToKubernetesResourceMap.put("endpointslices", EndpointSlice.class);
pluralToKubernetesResourceMap.put("ingresses", Ingress.class);
pluralToKubernetesResourceMap.put("networkpolicies", NetworkPolicy.class);
pluralToKubernetesResourceMap.put("poddisruptionbudgets", PodDisruptionBudget.class);
pluralToKubernetesResourceMap.put("podsecuritypolicies", PodSecurityPolicy.class);
pluralToKubernetesResourceMap.put("clusterrolebindings", ClusterRoleBinding.class);
pluralToKubernetesResourceMap.put("clusterroles", ClusterRole.class);
pluralToKubernetesResourceMap.put("rolebindings", RoleBinding.class);
pluralToKubernetesResourceMap.put("roles", Role.class);
pluralToKubernetesResourceMap.put("priorityclasses", PriorityClass.class);
pluralToKubernetesResourceMap.put("csidrivers", CSIDriver.class);
pluralToKubernetesResourceMap.put("csinodes", CSINode.class);
pluralToKubernetesResourceMap.put("storageclasses", StorageClass.class);
pluralToKubernetesResourceMap.put("volumeattachments", VolumeAttachment.class);
// When & Then
pluralToKubernetesResourceMap.forEach((plural, kubernetesResource)
-> assertEquals(plural, Utils.getPluralFromKind(kubernetesResource.getSimpleName())));
}
@Test
@DisplayName("Should test whether resource is namespaced or not")
void testWhetherNamespacedOrNot() {
assertTrue(Utils.isResourceNamespaced(Binding.class));
assertFalse(Utils.isResourceNamespaced(ComponentStatus.class));
assertTrue(Utils.isResourceNamespaced(ConfigMap.class));
assertTrue(Utils.isResourceNamespaced(Endpoints.class));
assertTrue(Utils.isResourceNamespaced(Event.class));
assertTrue(Utils.isResourceNamespaced(LimitRange.class));
assertFalse(Utils.isResourceNamespaced(Namespace.class));
assertFalse(Utils.isResourceNamespaced(Node.class));
assertTrue(Utils.isResourceNamespaced(PersistentVolumeClaim.class));
assertFalse(Utils.isResourceNamespaced(PersistentVolume.class));
assertTrue(Utils.isResourceNamespaced(Pod.class));
assertTrue(Utils.isResourceNamespaced(PodTemplate.class));
assertTrue(Utils.isResourceNamespaced(ReplicationController.class));
assertTrue(Utils.isResourceNamespaced(ResourceQuota.class));
assertTrue(Utils.isResourceNamespaced(Secret.class));
assertTrue(Utils.isResourceNamespaced(ServiceAccount.class));
assertTrue(Utils.isResourceNamespaced(Service.class));
assertFalse(Utils.isResourceNamespaced(MutatingWebhookConfiguration.class));
assertFalse(Utils.isResourceNamespaced(ValidatingWebhookConfiguration.class));
assertFalse(Utils.isResourceNamespaced(CustomResourceDefinition.class));
assertTrue(Utils.isResourceNamespaced(ControllerRevision.class));
assertTrue(Utils.isResourceNamespaced(DaemonSet.class));
assertTrue(Utils.isResourceNamespaced(Deployment.class));
assertTrue(Utils.isResourceNamespaced(ReplicaSet.class));
assertTrue(Utils.isResourceNamespaced(StatefulSet.class));
assertTrue(Utils.isResourceNamespaced(TokenReview.class));
assertTrue(Utils.isResourceNamespaced(LocalSubjectAccessReview.class));
assertTrue(Utils.isResourceNamespaced(SelfSubjectAccessReview.class));
assertTrue(Utils.isResourceNamespaced(SelfSubjectRulesReview.class));
assertTrue(Utils.isResourceNamespaced(SubjectAccessReview.class));
assertTrue(Utils.isResourceNamespaced(HorizontalPodAutoscaler.class));
assertTrue(Utils.isResourceNamespaced(CronJob.class));
assertTrue(Utils.isResourceNamespaced(Job.class));
assertTrue(Utils.isResourceNamespaced(CertificateSigningRequest.class));
assertTrue(Utils.isResourceNamespaced(Lease.class));
assertTrue(Utils.isResourceNamespaced(EndpointSlice.class));
assertTrue(Utils.isResourceNamespaced(Ingress.class));
assertTrue(Utils.isResourceNamespaced(NetworkPolicy.class));
assertTrue(Utils.isResourceNamespaced(PodDisruptionBudget.class));
assertFalse(Utils.isResourceNamespaced(PodSecurityPolicy.class));
assertFalse(Utils.isResourceNamespaced(ClusterRoleBinding.class));
assertFalse(Utils.isResourceNamespaced(ClusterRole.class));
assertTrue(Utils.isResourceNamespaced(RoleBinding.class));
assertTrue(Utils.isResourceNamespaced(Role.class));
assertFalse(Utils.isResourceNamespaced(PriorityClass.class));
assertTrue(Utils.isResourceNamespaced(CSIDriver.class));
assertTrue(Utils.isResourceNamespaced(CSINode.class));
assertFalse(Utils.isResourceNamespaced(StorageClass.class));
assertTrue(Utils.isResourceNamespaced(VolumeAttachment.class));
}
MixedOperation<RoleBinding, RoleBindingList, DoneableRoleBinding, Resource<RoleBinding, DoneableRoleBinding>> roleBindings();