diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/RbacAPIGroupClient.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/RbacAPIGroupClient.java index 54aa233c8bf..5716fad4c7c 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/RbacAPIGroupClient.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/RbacAPIGroupClient.java @@ -17,6 +17,7 @@ import io.fabric8.kubernetes.api.model.rbac.*; import io.fabric8.kubernetes.client.dsl.MixedOperation; +import io.fabric8.kubernetes.client.dsl.NonNamespaceOperation; import io.fabric8.kubernetes.client.dsl.RbacAPIGroupDSL; import io.fabric8.kubernetes.client.dsl.Resource; import io.fabric8.kubernetes.client.dsl.internal.rbac.v1.ClusterRoleBindingOperationsImpl; @@ -46,12 +47,12 @@ public MixedOperation> roleB } @Override - public MixedOperation> clusterRoles() { + public NonNamespaceOperation> clusterRoles() { return new ClusterRoleOperationsImpl(httpClient, getConfiguration()); } @Override - public MixedOperation> clusterRoleBindings() { + public NonNamespaceOperation> clusterRoleBindings() { return new ClusterRoleBindingOperationsImpl(httpClient, getConfiguration()); } } diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/RbacAPIGroupDSL.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/RbacAPIGroupDSL.java index ae85a2dd9bc..25fd6beb885 100644 --- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/RbacAPIGroupDSL.java +++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/RbacAPIGroupDSL.java @@ -31,8 +31,8 @@ public interface RbacAPIGroupDSL extends Client{ MixedOperation> roleBindings(); - MixedOperation> clusterRoles(); + NonNamespaceOperation> clusterRoles(); - MixedOperation> clusterRoleBindings(); + NonNamespaceOperation> clusterRoleBindings(); } diff --git a/kubernetes-itests/src/test/java/io/fabric8/openshift/K8sAuthorizationOnOpenShiftIT.java b/kubernetes-itests/src/test/java/io/fabric8/openshift/K8sAuthorizationOnOpenShiftIT.java index 56558d37c11..6fb77bf0985 100644 --- a/kubernetes-itests/src/test/java/io/fabric8/openshift/K8sAuthorizationOnOpenShiftIT.java +++ b/kubernetes-itests/src/test/java/io/fabric8/openshift/K8sAuthorizationOnOpenShiftIT.java @@ -134,7 +134,7 @@ public void createClusterRoleBindingK8s() { assertNotNull(clusterRoleBindingCreated); assertNotNull(clusterRoleBindingCreated.getMetadata().getUid()); assertEquals(name, clusterRoleBindingCreated.getMetadata().getName()); - client.rbac().clusterRoleBindings().inNamespace(session.getNamespace()).withName(name).delete(); + client.rbac().clusterRoleBindings().withName(name).delete(); } @Test @@ -151,13 +151,13 @@ public void createClusterRoleK8s() { .build(); // When - ClusterRole createdClusterRole = client.rbac().clusterRoles().inNamespace(session.getNamespace()).create(clusterRole); + ClusterRole createdClusterRole = client.rbac().clusterRoles().create(clusterRole); // Then assertNotNull(createdClusterRole); assertNotNull(createdClusterRole.getMetadata().getUid()); assertEquals(name, createdClusterRole.getMetadata().getName()); - client.rbac().clusterRoles().inNamespace(session.getNamespace()).withName(name).delete(); + client.rbac().clusterRoles().withName(name).delete(); } @Test diff --git a/kubernetes-itests/src/test/java/io/fabric8/openshift/UserImpersonationIT.java b/kubernetes-itests/src/test/java/io/fabric8/openshift/UserImpersonationIT.java index b0369316057..427f363713e 100644 --- a/kubernetes-itests/src/test/java/io/fabric8/openshift/UserImpersonationIT.java +++ b/kubernetes-itests/src/test/java/io/fabric8/openshift/UserImpersonationIT.java @@ -81,7 +81,7 @@ public void init() { .build() ) .build(); - client.rbac().clusterRoles().inNamespace(currentNamespace).createOrReplace(impersonatorRole); + client.rbac().clusterRoles().createOrReplace(impersonatorRole); // Create Service Account serviceAccount1 = new ServiceAccountBuilder() @@ -109,7 +109,7 @@ public void init() { ) .build(); - client.rbac().clusterRoleBindings().inNamespace(currentNamespace).createOrReplace(impersonatorRoleBinding); + client.rbac().clusterRoleBindings().createOrReplace(impersonatorRoleBinding); } @@ -153,11 +153,11 @@ public void cleanup() { requestConfig.setImpersonateGroups((String) null); // DeleteEntity Cluster Role - client.rbac().clusterRoles().inNamespace(currentNamespace).delete(impersonatorRole); + client.rbac().clusterRoles().delete(impersonatorRole); await().atMost(30, TimeUnit.SECONDS).until(kubernetesClusterRoleIsDeleted()); // DeleteEntity Cluster Role binding - client.rbac().clusterRoleBindings().inNamespace(currentNamespace).delete(impersonatorRoleBinding); + client.rbac().clusterRoleBindings().delete(impersonatorRoleBinding); await().atMost(30, TimeUnit.SECONDS).until(kubernetesClusterRoleBindingIsDeleted()); // DeleteEntity project @@ -178,11 +178,11 @@ private Callable projectIsDeleted() { } private Callable kubernetesClusterRoleBindingIsDeleted() { - return () -> client.rbac().clusterRoleBindings().inNamespace(currentNamespace).withName("impersonator-role").get() == null; + return () -> client.rbac().clusterRoleBindings().withName("impersonator-role").get() == null; } private Callable kubernetesClusterRoleIsDeleted() { - return () -> client.rbac().clusterRoles().inNamespace(currentNamespace).withName("impersonator").get() == null; + return () -> client.rbac().clusterRoles().withName("impersonator").get() == null; }