parent
d32c830250
commit
6c987dadac
|
|
@ -172,6 +172,7 @@ public class DockerimageComponentToWorkspaceApplier implements ComponentToWorksp
|
|||
buildDeployment(
|
||||
machineName,
|
||||
dockerimageComponent.getImage(),
|
||||
dockerimageComponent.getMemoryRequest(),
|
||||
dockerimageComponent.getMemoryLimit(),
|
||||
dockerimageComponent.getCpuRequest(),
|
||||
dockerimageComponent.getCpuLimit(),
|
||||
|
|
@ -190,6 +191,7 @@ public class DockerimageComponentToWorkspaceApplier implements ComponentToWorksp
|
|||
private Deployment buildDeployment(
|
||||
String name,
|
||||
String image,
|
||||
String memoryRequest,
|
||||
String memoryLimit,
|
||||
String cpuRequest,
|
||||
String cpuLimit,
|
||||
|
|
@ -207,6 +209,9 @@ public class DockerimageComponentToWorkspaceApplier implements ComponentToWorksp
|
|||
.build();
|
||||
|
||||
Containers.addRamLimit(container, memoryLimit);
|
||||
if (!isNullOrEmpty(memoryRequest)) {
|
||||
Containers.addRamRequest(container, memoryRequest);
|
||||
}
|
||||
if (!isNullOrEmpty(cpuRequest)) {
|
||||
Containers.addCpuRequest(container, KubernetesSize.toCores(cpuRequest));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -243,13 +243,14 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void shouldProvisionContainerWithMemoryLimitSpecified() throws Exception {
|
||||
public void shouldProvisionContainerWithMemoryResourcesSpecified() throws Exception {
|
||||
// given
|
||||
ComponentImpl dockerimageComponent = new ComponentImpl();
|
||||
dockerimageComponent.setAlias("jdk");
|
||||
dockerimageComponent.setType(DOCKERIMAGE_COMPONENT_TYPE);
|
||||
dockerimageComponent.setImage("eclipse/ubuntu_jdk8:latest");
|
||||
dockerimageComponent.setMemoryLimit("1G");
|
||||
dockerimageComponent.setMemoryRequest("128M");
|
||||
|
||||
// when
|
||||
dockerimageComponentApplier.apply(workspaceConfig, dockerimageComponent, null);
|
||||
|
|
@ -271,6 +272,10 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
|||
Quantity memoryLimit = container.getResources().getLimits().get("memory");
|
||||
assertEquals(memoryLimit.getAmount(), "1");
|
||||
assertEquals(memoryLimit.getFormat(), "G");
|
||||
|
||||
Quantity memoryRequest = container.getResources().getRequests().get("memory");
|
||||
assertEquals(memoryRequest.getAmount(), "128");
|
||||
assertEquals(memoryRequest.getFormat(), "M");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -247,46 +247,10 @@
|
|||
"examples": [
|
||||
"https://che-plugin-registry.openshift.io/v3/"
|
||||
]
|
||||
},
|
||||
"memoryLimit": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0
|
||||
}
|
||||
],
|
||||
"description": "Describes memory limit for the component. You can express memory as a plain integer or as a fixed-point integer using one of these suffixes: E, P, T, G, M, K. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki",
|
||||
"examples": [
|
||||
"128974848",
|
||||
"129e6",
|
||||
"129M",
|
||||
"123Mi"
|
||||
]
|
||||
},
|
||||
"memoryRequest": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0
|
||||
}
|
||||
],
|
||||
"description": "Describes memory request for the component. You can express memory as a plain integer or as a fixed-point integer using one of these suffixes: E, P, T, G, M, K. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki",
|
||||
"examples": [
|
||||
"128974848",
|
||||
"129e6",
|
||||
"129M",
|
||||
"123Mi"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
|
|
@ -349,7 +313,7 @@
|
|||
"{\"java.home\": \"/home/user/jdk11\", \"java.jdt.ls.vmargs\": \"-Xmx1G\"}"
|
||||
],
|
||||
"additionalProperties": {
|
||||
"anyOf" : [
|
||||
"anyOf": [
|
||||
{
|
||||
"type": [
|
||||
"boolean",
|
||||
|
|
@ -500,24 +464,8 @@
|
|||
"automountWorkspaceSecrets": {},
|
||||
"volumes": {},
|
||||
"endpoints": {},
|
||||
"memoryLimit": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0
|
||||
}
|
||||
],
|
||||
"description": "Describes memory limit for the component. You can express memory as a plain integer or as a fixed-point integer using one of these suffixes: E, P, T, G, M, K. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki",
|
||||
"examples": [
|
||||
"128974848",
|
||||
"129e6",
|
||||
"129M",
|
||||
"123Mi"
|
||||
]
|
||||
},
|
||||
"memoryLimit": {},
|
||||
"memoryRequest": {},
|
||||
"image": {
|
||||
"type": "string",
|
||||
"description": "Specifies the docker image that should be used for component",
|
||||
|
|
@ -582,6 +530,42 @@
|
|||
"description": "Describes whether projects sources should be mount to the component. `CHE_PROJECTS_ROOT` environment variable should contains a path where projects sources are mount",
|
||||
"default": "false"
|
||||
},
|
||||
"memoryLimit": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0
|
||||
}
|
||||
],
|
||||
"description": "Describes memory limit for the component. You can express memory as a plain integer or as a fixed-point integer using one of these suffixes: E, P, T, G, M, K. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki",
|
||||
"examples": [
|
||||
"128974848",
|
||||
"129e6",
|
||||
"129M",
|
||||
"123Mi"
|
||||
]
|
||||
},
|
||||
"memoryRequest": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0
|
||||
}
|
||||
],
|
||||
"description": "Describes memory request for the component. You can express memory as a plain integer or as a fixed-point integer using one of these suffixes: E, P, T, G, M, K. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki",
|
||||
"examples": [
|
||||
"128974848",
|
||||
"129e6",
|
||||
"129M",
|
||||
"123Mi"
|
||||
]
|
||||
},
|
||||
"cpuLimit": {
|
||||
"anyOf": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ components:
|
|||
public: 'true'
|
||||
discoverable: 'false'
|
||||
memoryLimit: 1536M
|
||||
memoryRequest: 512M
|
||||
cpuLimit: 1.5
|
||||
cpuRequest: 750m
|
||||
command: ['/bin/sh']
|
||||
|
|
|
|||
Loading…
Reference in New Issue