In the recent versions of OpenShift when you delete a project, the project will be taken off of the project list, but for whatever reason - the namespace will be unavailable until after some time. I imagine it is still cleaning up and/or shutting down resources in the background.
Before, I was using client.projects.list() to get access to the projects, to verify that the new project I wish to create did not already exist. But now a project may not be in this list, but it's name may still be unavailable (if it were recently deleted), thus throwing an error when I submit a new project request for creation (i.e. stating "This name is already in use").
How can I easily verify, as a regular user, if a project name is available for use?
OpenShiftClient can watch the state of the project.
Project project = new ProjectBuilder().withNewMetadata().addToLabels("key", "label").endMetadata().build();
client.resource(project).watch(new Watcher<Project>() {
@Override
public void eventReceived(Action action, Project resource) {
// logic goes here
}
@Override
public void onClose(KubernetesClientException cause) {
}
});