0

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?

Humair
  • 91
  • 5

1 Answers1

0

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) {
}
});
Hrishikesh
  • 370
  • 3
  • 11
  • 1
    To view/watch all projects in an OpenShift cluster you would need to have cluster level access, which a regular user wouldn't have. The question was whether it can be done as a regular user. – Graham Dumpleton Dec 17 '17 at 10:13