diff --git a/onyxia-api/src/main/java/fr/insee/onyxia/api/services/impl/kubernetes/KubernetesService.java b/onyxia-api/src/main/java/fr/insee/onyxia/api/services/impl/kubernetes/KubernetesService.java index c53f09b6..16e43623 100644 --- a/onyxia-api/src/main/java/fr/insee/onyxia/api/services/impl/kubernetes/KubernetesService.java +++ b/onyxia-api/src/main/java/fr/insee/onyxia/api/services/impl/kubernetes/KubernetesService.java @@ -169,12 +169,11 @@ private String createNamespace(Region region, String namespaceId, Owner owner) { private boolean isNamespaceAlreadyExisting(Region region, String namespaceId) { return kubernetesClientProvider - .getRootClient(region) - .namespaces() - .list() - .getItems() - .stream() - .anyMatch(ns -> ns.getMetadata().getName().equals(namespaceId)); + .getRootClient(region) + .namespaces() + .withName(namespaceId) + .get() + != null; } private void applyQuotas(