Search in sources :

Example 36 with KubernetesInfrastructureException

use of org.eclipse.che.workspace.infrastructure.kubernetes.KubernetesInfrastructureException in project devspaces-images by redhat-developer.

the class OpenShiftProject method delete.

/**
 * Deletes the project. Deleting a non-existent projects is not an error as is not an attempt to
 * delete a project that is already being deleted.
 *
 * @throws InfrastructureException if any unexpected exception occurs during project deletion
 */
void delete() throws InfrastructureException {
    String workspaceId = getWorkspaceId();
    String projectName = getName();
    OpenShiftClient osClient = clientFactory.createOC(workspaceId);
    try {
        delete(projectName, osClient);
    } catch (KubernetesClientException e) {
        if (e.getCode() == 403) {
            throw new InfrastructureException(format("Could not access the project %s when deleting it for workspace %s", projectName, workspaceId), e);
        }
        throw new KubernetesInfrastructureException(e);
    }
}
Also used : OpenShiftClient(io.fabric8.openshift.client.OpenShiftClient) KubernetesInfrastructureException(org.eclipse.che.workspace.infrastructure.kubernetes.KubernetesInfrastructureException) KubernetesInfrastructureException(org.eclipse.che.workspace.infrastructure.kubernetes.KubernetesInfrastructureException) InternalInfrastructureException(org.eclipse.che.api.workspace.server.spi.InternalInfrastructureException) InfrastructureException(org.eclipse.che.api.workspace.server.spi.InfrastructureException) KubernetesClientException(io.fabric8.kubernetes.client.KubernetesClientException)

Aggregations

KubernetesClientException (io.fabric8.kubernetes.client.KubernetesClientException)36 KubernetesInfrastructureException (org.eclipse.che.workspace.infrastructure.kubernetes.KubernetesInfrastructureException)36 InfrastructureException (org.eclipse.che.api.workspace.server.spi.InfrastructureException)26 Watch (io.fabric8.kubernetes.client.Watch)22 CompletableFuture (java.util.concurrent.CompletableFuture)20 ExecutionException (java.util.concurrent.ExecutionException)18 TimeoutException (java.util.concurrent.TimeoutException)18 WatcherException (io.fabric8.kubernetes.client.WatcherException)16 ExecWatch (io.fabric8.kubernetes.client.dsl.ExecWatch)12 Pod (io.fabric8.kubernetes.api.model.Pod)10 Watcher (io.fabric8.kubernetes.client.Watcher)6 ParseException (java.text.ParseException)6 InternalInfrastructureException (org.eclipse.che.api.workspace.server.spi.InternalInfrastructureException)6 Deployment (io.fabric8.kubernetes.api.model.apps.Deployment)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 Test (org.testng.annotations.Test)4 Event (io.fabric8.kubernetes.api.model.Event)2 LocalObjectReference (io.fabric8.kubernetes.api.model.LocalObjectReference)2 Namespace (io.fabric8.kubernetes.api.model.Namespace)2