use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project che-server by eclipse-che.
the class K8sContainerResolver method resolve.
public Container resolve() throws InfrastructureException {
Container container = new ContainerBuilder().withImage(cheContainer.getImage()).withImagePullPolicy(imagePullPolicy).withName(buildContainerName(cheContainer.getName())).withEnv(toK8sEnv(cheContainer.getEnv())).withPorts(getContainerPorts()).withCommand(cheContainer.getCommand()).withArgs(cheContainer.getArgs()).withLifecycle(toK8sLifecycle(cheContainer.getLifecycle())).build();
provisionMemoryLimit(container, cheContainer);
provisionMemoryRequest(container, cheContainer);
provisionCpuLimit(container, cheContainer);
provisionCpuRequest(container, cheContainer);
return container;
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method addToolingContainerWithCommandAndArgs.
@Test
public void addToolingContainerWithCommandAndArgs() throws InfrastructureException {
List<String> command = singletonList("tail");
List<String> args = Arrays.asList("-f", "/dev/null");
lenient().when(podSpec.getContainers()).thenReturn(new ArrayList<>());
ChePlugin chePlugin = createChePlugin();
List<CheContainer> containers = singletonList(createContainer(command, args));
chePlugin.setContainers(containers);
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
verifyPodAndContainersNumber(1);
Container toolingContainer = getOneAndOnlyNonUserContainer(internalEnvironment);
verifyContainer(toolingContainer);
assertEquals(toolingContainer.getCommand(), command);
assertEquals(toolingContainer.getArgs(), args);
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method createContainer.
private CheContainer createContainer(List<String> command, List<String> args) {
CheContainer container = createContainer();
container.setCommand(command);
container.setArgs(args);
return container;
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method createContainer.
private CheContainer createContainer(String name, Command... commands) {
CheContainer cheContainer = new CheContainer();
cheContainer.setImage(TEST_IMAGE);
cheContainer.setName(name);
cheContainer.setEnv(singletonList(new EnvVar().name(ENV_VAR).value(ENV_VAR_VALUE)));
cheContainer.setVolumes(singletonList(new Volume().name(VOLUME_NAME).mountPath(VOLUME_MOUNT_PATH)));
cheContainer.setCommands(Arrays.asList(commands));
return cheContainer;
}
use of org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer in project che-server by eclipse-che.
the class KubernetesPluginsToolingApplierTest method addToolingInitContainerWithCommand.
@Test
public void addToolingInitContainerWithCommand() throws InfrastructureException {
List<String> command = Arrays.asList("cp", "-rf", "test-file", "/some-volume/test");
lenient().when(podSpec.getInitContainers()).thenReturn(new ArrayList<>());
ChePlugin chePlugin = createChePlugin();
List<CheContainer> initContainers = singletonList(createContainer(command, null));
chePlugin.setInitContainers(initContainers);
applier.apply(runtimeIdentity, internalEnvironment, singletonList(chePlugin));
verifyPodAndInitContainersNumber(1);
Container toolingInitContainer = getOnlyOneInitContainerFromPod(internalEnvironment);
verifyContainer(toolingInitContainer);
assertEquals(toolingInitContainer.getCommand(), command);
}
Aggregations