Source:
public ContainerCreated createContainer(CreateContainerParams createContainerParams) throws IOException { String containerName = KubernetesStringUtils.getContainerName(createContainerParams.getContainerName()); String workspaceID = getCheWorkspaceId(createContainerParams); workspaceID = workspaceID.isEmpty() ? generateWorkspaceID() : workspaceID; String imageForDocker = createContainerParams.getContainerConfig().getImage(); String imageStreamTagName = KubernetesStringUtils.getTagNameFromRepoString(imageForDocker); ImageStreamTag imageStreamTag = getImageStreamTagFromRepo(imageStreamTagName); String imageStreamTagPullSpec = imageStreamTag.getMetadata().getName(); String imageStreamName = imageStreamTagPullSpec.split(":")[0]; ImageStream imageStream = openShiftClient.imageStreams() .inNamespace(openShiftCheProjectName) .withName(imageStreamName) .get(); String registryAddress = imageStream.getStatus() .getDockerImageRepository() .split("/")[0]; String dockerPullSpec = String.format("%s/%s/%s", registryAddress, openShiftCheProjectName, imageStreamTagPullSpec); Set<String> containerExposedPorts = createContainerParams.getContainerConfig().getExposedPorts().keySet(); Set<String> imageExposedPorts = inspectImage(imageForDocker).getConfig().getExposedPorts().keySet(); Set<String> exposedPorts = getExposedPorts(containerExposedPorts, imageExposedPorts); boolean runContainerAsRoot = runContainerAsRoot(imageForDocker); String[] envVariables = createContainerParams.getContainerConfig().getEnv(); String[] volumes = createContainerParams.getContainerConfig().getHostConfig().getBinds(); Map<String, String> additionalLabels = createContainerParams.getContainerConfig().getLabels(); createOpenShiftService(workspaceID, exposedPorts, additionalLabels); String deploymentName = createOpenShiftDeployment(workspaceID, dockerPullSpec, containerName, exposedPorts, envVariables, volumes, runContainerAsRoot); String containerID = waitAndRetrieveContainerID(deploymentName); if (containerID == null) { throw new OpenShiftException("Failed to get the ID of the container running in the OpenShift pod"); } return new ContainerCreated(containerID, null); }

Target:
public ContainerCreated createContainer(CreateContainerParams createContainerParams) throws IOException { String containerName = KubernetesStringUtils.getContainerName(createContainerParams.getContainerName()); String workspaceID = getCheWorkspaceId(createContainerParams); workspaceID = workspaceID.isEmpty() ? generateWorkspaceID() : workspaceID; String imageForDocker = createContainerParams.getContainerConfig().getImage(); String imageStreamTagName = KubernetesStringUtils.getTagNameFromRepoString(imageForDocker); ImageStreamTag imageStreamTag = getImageStreamTagFromRepo(imageStreamTagName); String imageStreamTagPullSpec = imageStreamTag.getMetadata().getName(); String imageStreamName = imageStreamTagPullSpec.contains(":") ? imageStreamTagPullSpec.split(":")[0] : imageStreamTagPullSpec; ImageStream imageStream = openShiftClient.imageStreams() .inNamespace(openShiftCheProjectName) .withName(imageStreamName) .get(); if (imageStream == null) { throw new OpenShiftException("ImageStream not found"); } String registryAddress = imageStream.getStatus() .getDockerImageRepository() .split("/")[0]; String dockerPullSpec = String.format("%s/%s/%s", registryAddress, openShiftCheProjectName, imageStreamTagPullSpec); Set<String> containerExposedPorts = createContainerParams.getContainerConfig().getExposedPorts().keySet(); Set<String> imageExposedPorts = inspectImage(imageForDocker).getConfig().getExposedPorts().keySet(); Set<String> exposedPorts = getExposedPorts(containerExposedPorts, imageExposedPorts); boolean runContainerAsRoot = runContainerAsRoot(imageForDocker); String[] envVariables = createContainerParams.getContainerConfig().getEnv(); String[] volumes = createContainerParams.getContainerConfig().getHostConfig().getBinds(); Map<String, String> additionalLabels = createContainerParams.getContainerConfig().getLabels(); createOpenShiftService(workspaceID, exposedPorts, additionalLabels); String deploymentName = createOpenShiftDeployment(workspaceID, dockerPullSpec, containerName, exposedPorts, envVariables, volumes, runContainerAsRoot); String containerID = waitAndRetrieveContainerID(deploymentName); if (containerID == null) { throw new OpenShiftException("Failed to get the ID of the container running in the OpenShift pod"); } return new ContainerCreated(containerID, null); }