diff --git a/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftConnector.java b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftConnector.java index 7cfcab3de69..c97007cb22e 100644 --- a/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftConnector.java +++ b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftConnector.java @@ -40,7 +40,6 @@ import io.fabric8.kubernetes.api.model.VolumeMountBuilder; import io.fabric8.kubernetes.api.model.extensions.Deployment; import io.fabric8.kubernetes.api.model.extensions.DeploymentBuilder; -import io.fabric8.kubernetes.api.model.extensions.ReplicaSet; import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.kubernetes.client.Watcher; import io.fabric8.kubernetes.client.dsl.ExecWatch; @@ -52,8 +51,6 @@ import io.fabric8.openshift.api.model.Image; import io.fabric8.openshift.api.model.ImageStream; import io.fabric8.openshift.api.model.ImageStreamTag; -import io.fabric8.openshift.api.model.Route; -import io.fabric8.openshift.api.model.RouteList; import io.fabric8.openshift.client.DefaultOpenShiftClient; import io.fabric8.openshift.client.OpenShiftClient; import io.fabric8.openshift.client.dsl.DeployableScalableResource; @@ -173,8 +170,8 @@ public class OpenShiftConnector extends DockerConnector { private static final int CHE_WORKSPACE_AGENT_PORT = 4401; private static final int CHE_TERMINAL_AGENT_PORT = 4411; private static final String DOCKER_PROTOCOL_PORT_DELIMITER = "/"; - private static final int OPENSHIFT_WAIT_POD_DELAY = 1000; private static final int OPENSHIFT_WAIT_POD_TIMEOUT = 240; + private static final int OPENSHIFT_WAIT_POD_DELAY = 1000; private static final int OPENSHIFT_IMAGESTREAM_WAIT_DELAY = 2000; private static final int OPENSHIFT_IMAGESTREAM_MAX_WAIT_COUNT = 30; private static final String OPENSHIFT_POD_STATUS_RUNNING = "Running"; @@ -191,19 +188,21 @@ public class OpenShiftConnector extends DockerConnector { private Map execMap = new HashMap<>(); - private final String openShiftCheProjectName; - private final int openShiftLivenessProbeDelay; - private final int openShiftLivenessProbeTimeout; - private final String workspacesPersistentVolumeClaim; - private final String workspacesPvcQuantity; - private final String cheWorkspaceStorage; - private final String cheWorkspaceProjectsStorage; - private final String cheServerExternalAddress; - private final String cheWorkspaceMemoryLimit; - private final String cheWorkspaceMemoryRequest; - private final boolean secureRoutes; - private final boolean createWorkspaceDirs; - private final OpenShiftPvcHelper openShiftPvcHelper; + private final String openShiftCheProjectName; + private final int openShiftLivenessProbeDelay; + private final int openShiftLivenessProbeTimeout; + private final String workspacesPersistentVolumeClaim; + private final String workspacesPvcQuantity; + private final String cheWorkspaceStorage; + private final String cheWorkspaceProjectsStorage; + private final String cheServerExternalAddress; + private final String cheWorkspaceMemoryLimit; + private final String cheWorkspaceMemoryRequest; + private final boolean secureRoutes; + private final boolean createWorkspaceDirs; + private final OpenShiftPvcHelper openShiftPvcHelper; + private final OpenShiftRouteCreator openShiftRouteCreator; + private final OpenShiftDeploymentCleaner openShiftDeploymentCleaner; @Inject public OpenShiftConnector(DockerConnectorConfiguration connectorConfiguration, @@ -211,6 +210,8 @@ public OpenShiftConnector(DockerConnectorConfiguration connectorConfiguration, DockerRegistryAuthResolver authResolver, DockerApiVersionPathPrefixProvider dockerApiVersionPathPrefixProvider, OpenShiftPvcHelper openShiftPvcHelper, + OpenShiftRouteCreator openShiftRouteCreator, + OpenShiftDeploymentCleaner openShiftDeploymentCleaner, EventService eventService, @Nullable @Named("che.docker.ip.external") String cheServerExternalAddress, @Named("che.openshift.project") String openShiftCheProjectName, @@ -239,6 +240,8 @@ public OpenShiftConnector(DockerConnectorConfiguration connectorConfiguration, this.secureRoutes = secureRoutes; this.createWorkspaceDirs = createWorkspaceDirs; this.openShiftPvcHelper = openShiftPvcHelper; + this.openShiftRouteCreator = openShiftRouteCreator; + this.openShiftDeploymentCleaner = openShiftDeploymentCleaner; eventService.subscribe(new EventSubscriber() { @Override @@ -407,7 +410,7 @@ public ContainerCreated createContainer(CreateContainerParams createContainerPar // in an inconsistent state. LOG.info("Error while creating Pod, removing deployment"); LOG.info(e.getMessage()); - cleanUpWorkspaceResources(deploymentName); + openShiftDeploymentCleaner.cleanDeploymentResources(deploymentName, openShiftCheProjectName); openShiftClient.resource(imageStreamTag).delete(); throw e; } finally { @@ -493,10 +496,8 @@ public ContainerInfo inspectContainer(String containerId) throws IOException { @Override public void removeContainer(final RemoveContainerParams params) throws IOException { - String containerId = params.getContainer(); - Pod pod = getChePodByContainerId(containerId); - String deploymentName = pod.getMetadata().getLabels().get(OPENSHIFT_DEPLOYMENT_LABEL); - cleanUpWorkspaceResources(deploymentName); + String deploymentName = getDeploymentName(params); + openShiftDeploymentCleaner.cleanDeploymentResources(deploymentName, openShiftCheProjectName); } @Override @@ -1005,50 +1006,6 @@ private Service getCheServiceBySelector(String selectorKey, String selectorValue } } - private Deployment getDeploymentByName(String deploymentName) throws IOException { - try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { - Deployment deployment = openShiftClient - .extensions().deployments() - .inNamespace(this.openShiftCheProjectName) - .withName(deploymentName) - .get(); - if (deployment == null) { - LOG.warn("No Deployment with name {} could be found", deploymentName); - } - return deployment; - } - } - - private List getRoutesByLabel(String labelKey, String labelValue) throws IOException { - try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { - RouteList routeList = openShiftClient - .routes() - .inNamespace(this.openShiftCheProjectName) - .withLabel(labelKey, labelValue) - .list(); - - List items = routeList.getItems(); - - if (items.isEmpty()) { - LOG.warn("No Route with label {}={} could be found", labelKey, labelValue); - throw new IOException("No Route with label " + labelKey + "=" + labelValue + " could be found"); - } - - return items; - } - } - - private List getReplicaSetByLabel(String key, String value) { - try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { - List replicaSets = openShiftClient.extensions() - .replicaSets() - .inNamespace(openShiftCheProjectName) - .withLabel(key, value) - .list().getItems(); - return replicaSets; - } - } - private Pod getChePodByContainerId(String containerId) throws IOException { try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { PodList pods = openShiftClient.pods() @@ -1155,7 +1112,7 @@ private void createOpenShiftRoute(String serviceName, String deploymentName, String serverRef) { String routeId = serviceName.replaceFirst(CHE_OPENSHIFT_RESOURCES_PREFIX, ""); - OpenShiftRouteCreator.createRoute(openShiftCheProjectName, + openShiftRouteCreator.createRoute(openShiftCheProjectName, cheServerExternalAddress, serverRef, serviceName, @@ -1383,56 +1340,6 @@ private List getContainerStates(final Pod pod) throws OpenShiftE return containerStates; } - private void cleanUpWorkspaceResources(String deploymentName) throws IOException { - - Deployment deployment = getDeploymentByName(deploymentName); - Service service = getCheServiceBySelector(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); - List routes = getRoutesByLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); - List replicaSets = getReplicaSetByLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); - - try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { - if (routes != null) { - for (Route route: routes) { - LOG.info("Removing OpenShift Route {}", route.getMetadata().getName()); - openShiftClient.resource(route).delete(); - } - } - - if (service != null) { - LOG.info("Removing OpenShift Service {}", service.getMetadata().getName()); - openShiftClient.resource(service).delete(); - } - - if (deployment != null) { - LOG.info("Removing OpenShift Deployment {}", deployment.getMetadata().getName()); - openShiftClient.resource(deployment).delete(); - } - - if (replicaSets != null && replicaSets.size() > 0) { - LOG.info("Removing OpenShift ReplicaSets for deployment {}", deploymentName); - replicaSets.forEach(rs -> openShiftClient.resource(rs).delete()); - } - - // Wait for all pods to terminate before returning. - for (int waitCount = 0; waitCount < OPENSHIFT_WAIT_POD_TIMEOUT; waitCount++) { - List pods = openShiftClient.pods() - .inNamespace(openShiftCheProjectName) - .withLabel(OPENSHIFT_DEPLOYMENT_LABEL, deploymentName) - .list() - .getItems(); - if (pods.size() == 0) { - return; - } - Thread.sleep(OPENSHIFT_WAIT_POD_DELAY); - } - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - LOG.info("Thread interrupted while cleaning up workspace"); - } - - throw new OpenShiftException("Timeout while waiting for pods to terminate"); - } - private void createWorkspaceDir(String[] volumes) throws OpenShiftException { PersistentVolumeClaim pvc = getClaimCheWorkspace(); String workspaceSubpath = getWorkspaceSubpath(volumes); @@ -1681,4 +1588,12 @@ private boolean isTerminalAgentInjected(final Set exposedPorts) { private boolean isDevMachine(final Set exposedPorts) { return exposedPorts.contains(CHE_WORKSPACE_AGENT_PORT + "/tcp"); } + + private String getDeploymentName(final RemoveContainerParams params) throws IOException { + String containerId = params.getContainer(); + Pod pod = getChePodByContainerId(containerId); + String deploymentName = pod.getMetadata().getLabels().get(OPENSHIFT_DEPLOYMENT_LABEL); + return deploymentName; + } + } diff --git a/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftDeploymentCleaner.java b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftDeploymentCleaner.java new file mode 100644 index 00000000000..de9cbfb52f6 --- /dev/null +++ b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftDeploymentCleaner.java @@ -0,0 +1,141 @@ +/******************************************************************************* + * Copyright (c) 2012-2017 Red Hat, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Red Hat, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.openshift.client; + +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import javax.inject.Singleton; + +import org.eclipse.che.plugin.openshift.client.exception.OpenShiftException; +import org.eclipse.che.plugin.openshift.client.kubernetes.KubernetesResourceUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.fabric8.kubernetes.api.model.Pod; +import io.fabric8.kubernetes.api.model.PodList; +import io.fabric8.kubernetes.api.model.Service; +import io.fabric8.kubernetes.api.model.extensions.Deployment; +import io.fabric8.kubernetes.api.model.extensions.DoneableDeployment; +import io.fabric8.kubernetes.api.model.extensions.ReplicaSet; +import io.fabric8.kubernetes.client.KubernetesClientException; +import io.fabric8.kubernetes.client.Watch; +import io.fabric8.kubernetes.client.Watcher; +import io.fabric8.kubernetes.client.dsl.FilterWatchListDeletable; +import io.fabric8.kubernetes.client.dsl.ScalableResource; +import io.fabric8.openshift.api.model.Route; +import io.fabric8.openshift.client.DefaultOpenShiftClient; +import io.fabric8.openshift.client.OpenShiftClient; + +@Singleton +public class OpenShiftDeploymentCleaner { + private static final Logger LOG = LoggerFactory.getLogger(OpenShiftDeploymentCleaner.class); + private static final int OPENSHIFT_POD_DELETION_TIMEOUT = 120; + + public void cleanDeploymentResources(final String deploymentName, final String namespace) throws IOException { + scaleDownDeployment(deploymentName, namespace); + cleanUpWorkspaceResources(deploymentName, namespace); + waitUntilWorkspacePodIsDeleted(deploymentName, namespace); + } + + private void scaleDownDeployment(String deploymentName, final String namespace) throws OpenShiftException { + try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { + ScalableResource deployment = openShiftClient.extensions() + .deployments() + .inNamespace(namespace) + .withName(deploymentName); + + if (deployment != null) { + deployment.scale(0, true); + } + } + } + + private void cleanUpWorkspaceResources(final String deploymentName, final String namespace) throws IOException { + Deployment deployment = KubernetesResourceUtil.getDeploymentByName(deploymentName, namespace); + Service service = KubernetesResourceUtil.getServiceBySelector(OpenShiftConnector.OPENSHIFT_DEPLOYMENT_LABEL, deploymentName, namespace); + List routes = KubernetesResourceUtil.getRoutesByLabel(OpenShiftConnector.OPENSHIFT_DEPLOYMENT_LABEL, deploymentName, namespace); + List replicaSets = KubernetesResourceUtil.getReplicaSetByLabel(OpenShiftConnector.OPENSHIFT_DEPLOYMENT_LABEL, deploymentName, namespace); + + try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { + + if (deployment != null) { + LOG.info("Removing OpenShift Deployment {}", deployment.getMetadata().getName()); + openShiftClient.resource(deployment).delete(); + } + + if (replicaSets != null && replicaSets.size() > 0) { + LOG.info("Removing OpenShift ReplicaSets for deployment {}", deploymentName); + replicaSets.forEach(rs -> openShiftClient.resource(rs).delete()); + } + + if (routes != null) { + for (Route route: routes) { + LOG.info("Removing OpenShift Route {}", route.getMetadata().getName()); + openShiftClient.resource(route).delete(); + } + } + + if (service != null) { + LOG.info("Removing OpenShift Service {}", service.getMetadata().getName()); + openShiftClient.resource(service).delete(); + } + } + } + + private void waitUntilWorkspacePodIsDeleted(final String deploymentName, final String namespace) throws OpenShiftException { + try (OpenShiftClient client = new DefaultOpenShiftClient()) { + FilterWatchListDeletable> pods = client.pods() + .inNamespace(namespace) + .withLabel(OpenShiftConnector.OPENSHIFT_DEPLOYMENT_LABEL, deploymentName); + + int numberOfPodsToStop = pods.list().getItems().size(); + LOG.info("Number of workspace pods to stop {}", numberOfPodsToStop); + if (numberOfPodsToStop > 0) { + final CountDownLatch podCount = new CountDownLatch(numberOfPodsToStop); + pods.watch(new Watcher() { + @Override + public void eventReceived(Action action, Pod pod) { + try { + switch (action) { + case ADDED: + case MODIFIED: + case ERROR: + break; + case DELETED: + LOG.info("Pod {} deleted", pod.getMetadata().getName()); + podCount.countDown(); + break; + } + } catch (Exception e) { + LOG.error("Failed to process {} on Pod {}. Error: ", action, pod, e); + } + } + + @Override + public void onClose(KubernetesClientException ex) { + } + }); + + try { + LOG.info("Waiting for all pods to be deleted for deployment '{}'", deploymentName); + podCount.await(OPENSHIFT_POD_DELETION_TIMEOUT, TimeUnit.SECONDS); + } catch (InterruptedException e) { + LOG.error("Exception while waiting for pods to be deleted", e); + throw new OpenShiftException("Timeout while waiting for pods to terminate", e); + } + } + } + } + +} diff --git a/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftPvcHelper.java b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftPvcHelper.java index 23681d85681..60e94118ec0 100644 --- a/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftPvcHelper.java +++ b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftPvcHelper.java @@ -30,6 +30,8 @@ import javax.inject.Inject; import javax.inject.Named; +import javax.inject.Singleton; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -54,6 +56,7 @@ * * @author amisevsk */ +@Singleton public class OpenShiftPvcHelper { private static final Logger LOG = LoggerFactory.getLogger(OpenShiftPvcHelper.class); diff --git a/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftRouteCreator.java b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftRouteCreator.java index 39af1378902..e55f0f754b5 100644 --- a/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftRouteCreator.java +++ b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftRouteCreator.java @@ -16,15 +16,18 @@ import io.fabric8.openshift.client.DefaultOpenShiftClient; import io.fabric8.openshift.client.OpenShiftClient; +import javax.inject.Singleton; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; +@Singleton public class OpenShiftRouteCreator { private static final Logger LOG = LoggerFactory.getLogger(OpenShiftRouteCreator.class); private static final String TLS_TERMINATION_EDGE = "edge"; private static final String REDIRECT_INSECURE_EDGE_TERMINATION_POLICY = "Redirect"; - public static void createRoute (final String namespace, + public void createRoute (final String namespace, final String openShiftNamespaceExternalAddress, final String serverRef, final String serviceName, @@ -39,7 +42,7 @@ public static void createRoute (final String namespace, try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { String routeName = generateRouteName(routeId, serverRef); String serviceHost = generateRouteHost(routeName, openShiftNamespaceExternalAddress); - + SpecNested routeSpec = openShiftClient .routes() .inNamespace(namespace) @@ -59,25 +62,25 @@ public static void createRoute (final String namespace, .withStrVal(serverRef) .endTargetPort() .endPort(); - + if (enableTls) { routeSpec.withNewTls() .withTermination(TLS_TERMINATION_EDGE) .withInsecureEdgeTerminationPolicy(REDIRECT_INSECURE_EDGE_TERMINATION_POLICY) .endTls(); } - + Route route = routeSpec.endSpec().done(); - + LOG.info("OpenShift route {} created", route.getMetadata().getName()); } } - private static String generateRouteName(final String serviceName, final String serverRef) { + private String generateRouteName(final String serviceName, final String serverRef) { return serverRef + "-" + serviceName; } - private static String generateRouteHost(final String routeName, final String openShiftNamespaceExternalAddress) { + private String generateRouteHost(final String routeName, final String openShiftNamespaceExternalAddress) { return routeName + "-" + openShiftNamespaceExternalAddress; } } diff --git a/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/kubernetes/KubernetesResourceUtil.java b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/kubernetes/KubernetesResourceUtil.java new file mode 100644 index 00000000000..e2ecf5825a1 --- /dev/null +++ b/plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/kubernetes/KubernetesResourceUtil.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2012-2017 Red Hat, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Red Hat, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.plugin.openshift.client.kubernetes; + +import java.io.IOException; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import io.fabric8.kubernetes.api.model.Service; +import io.fabric8.kubernetes.api.model.ServiceList; +import io.fabric8.kubernetes.api.model.extensions.Deployment; +import io.fabric8.kubernetes.api.model.extensions.ReplicaSet; +import io.fabric8.openshift.api.model.Route; +import io.fabric8.openshift.api.model.RouteList; +import io.fabric8.openshift.client.DefaultOpenShiftClient; +import io.fabric8.openshift.client.OpenShiftClient; + +public final class KubernetesResourceUtil { + private static final Logger LOG = LoggerFactory.getLogger(KubernetesResourceUtil.class); + + private KubernetesResourceUtil() { + } + + public static Deployment getDeploymentByName(String deploymentName, String namespace) throws IOException { + try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { + Deployment deployment = openShiftClient.extensions().deployments().inNamespace(namespace) + .withName(deploymentName).get(); + if (deployment == null) { + LOG.warn("No Deployment with name {} could be found", deploymentName); + } + return deployment; + } + } + + public static Service getServiceBySelector(final String selectorKey, final String selectorValue, + final String namespace) { + try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { + ServiceList svcs = openShiftClient.services().inNamespace(namespace).list(); + + Service svc = svcs.getItems().stream().filter(s -> s.getSpec().getSelector().containsKey(selectorKey)) + .filter(s -> s.getSpec().getSelector().get(selectorKey).equals(selectorValue)).findAny() + .orElse(null); + + if (svc == null) { + LOG.warn("No Service with selector {}={} could be found", selectorKey, selectorValue); + } + return svc; + } + } + + public static List getRoutesByLabel(final String labelKey, final String labelValue, final String namespace) + throws IOException { + try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { + RouteList routeList = openShiftClient.routes().inNamespace(namespace).withLabel(labelKey, labelValue) + .list(); + + List items = routeList.getItems(); + + if (items.isEmpty()) { + LOG.warn("No Route with label {}={} could be found", labelKey, labelValue); + throw new IOException("No Route with label " + labelKey + "=" + labelValue + " could be found"); + } + + return items; + } + } + + public static List getReplicaSetByLabel(final String key, final String value, final String namespace) { + try (OpenShiftClient openShiftClient = new DefaultOpenShiftClient()) { + List replicaSets = openShiftClient.extensions() + .replicaSets() + .inNamespace(namespace) + .withLabel(key, value) + .list().getItems(); + return replicaSets; + } + } +} diff --git a/plugins/plugin-docker/che-plugin-openshift-client/src/test/java/org/eclipse/che/plugin/openshift/client/OpenShiftConnectorTest.java b/plugins/plugin-docker/che-plugin-openshift-client/src/test/java/org/eclipse/che/plugin/openshift/client/OpenShiftConnectorTest.java index 16fd1ddccd8..93053938c96 100644 --- a/plugins/plugin-docker/che-plugin-openshift-client/src/test/java/org/eclipse/che/plugin/openshift/client/OpenShiftConnectorTest.java +++ b/plugins/plugin-docker/che-plugin-openshift-client/src/test/java/org/eclipse/che/plugin/openshift/client/OpenShiftConnectorTest.java @@ -58,6 +58,10 @@ public class OpenShiftConnectorTest { private EventService eventService; @Mock private OpenShiftPvcHelper openShiftPvcHelper; + @Mock + private OpenShiftRouteCreator openShiftRouteCreator; + @Mock + private OpenShiftDeploymentCleaner openShiftDeploymentCleaner; private OpenShiftConnector openShiftConnector; @@ -76,6 +80,8 @@ public void shouldGetWorkspaceIDWhenAValidOneIsProvidedInCreateContainerParams() authManager, dockerApiVersionPathPrefixProvider, openShiftPvcHelper, + openShiftRouteCreator, + openShiftDeploymentCleaner, eventService, CHE_DEFAULT_SERVER_EXTERNAL_ADDRESS, CHE_DEFAULT_OPENSHIFT_PROJECT_NAME,