Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cpu and memory request for jwtproxy #18551

Merged
merged 2 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,9 @@ che.server.secure_exposer.jwtproxy.token.issuer=wsmaster
che.server.secure_exposer.jwtproxy.token.ttl=8800h
che.server.secure_exposer.jwtproxy.auth.loader.path=/_app/loader.html
che.server.secure_exposer.jwtproxy.image=quay.io/eclipse/che-jwtproxy:0.10.0
che.server.secure_exposer.jwtproxy.memory_request=15mb
che.server.secure_exposer.jwtproxy.memory_limit=128mb
che.server.secure_exposer.jwtproxy.cpu_request=0.03
che.server.secure_exposer.jwtproxy.cpu_limit=0.5

### Configuration of major "/websocket" endpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static org.eclipse.che.api.core.model.workspace.config.MachineConfig.CPU_LIMIT_ATTRIBUTE;
import static org.eclipse.che.api.core.model.workspace.config.MachineConfig.CPU_REQUEST_ATTRIBUTE;
import static org.eclipse.che.api.core.model.workspace.config.MachineConfig.MEMORY_LIMIT_ATTRIBUTE;
import static org.eclipse.che.api.core.model.workspace.config.MachineConfig.MEMORY_REQUEST_ATTRIBUTE;
import static org.eclipse.che.api.workspace.shared.Constants.CONTAINER_SOURCE_ATTRIBUTE;
Expand Down Expand Up @@ -103,7 +104,9 @@ abstract class AbstractJwtProxyProvisioner implements ProxyProvisioner {
CookiePathStrategy cookiePathStrategy,
MultiHostCookiePathStrategy multihostCookiePathStrategy,
String jwtProxyImage,
String memoryRequestBytes,
String memoryLimitBytes,
String cpuRequestCores,
String cpuLimitCores,
String imagePullPolicy,
String workspaceId,
Expand All @@ -120,14 +123,18 @@ abstract class AbstractJwtProxyProvisioner implements ProxyProvisioner {

this.availablePort = FIRST_AVAILABLE_PROXY_PORT;
long memoryLimitLong = Size.parseSizeToMegabytes(memoryLimitBytes) * MEGABYTES_TO_BYTES_DIVIDER;
long memoryRequestLong =
Size.parseSizeToMegabytes(memoryRequestBytes) * MEGABYTES_TO_BYTES_DIVIDER;
this.attributes =
ImmutableMap.of(
MEMORY_LIMIT_ATTRIBUTE,
Long.toString(memoryLimitLong),
MEMORY_REQUEST_ATTRIBUTE,
Long.toString(memoryLimitLong),
Long.toString(memoryRequestLong),
CPU_LIMIT_ATTRIBUTE,
cpuLimitCores,
CPU_REQUEST_ATTRIBUTE,
cpuRequestCores,
CONTAINER_SOURCE_ATTRIBUTE,
TOOL_CONTAINER_SOURCE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ public JwtProxyProvisioner(
CookiePathStrategy cookiePathStrategy,
MultiHostCookiePathStrategy multiHostCookiePathStrategy,
@Named("che.server.secure_exposer.jwtproxy.image") String jwtProxyImage,
@Named("che.server.secure_exposer.jwtproxy.memory_request") String memoryRequestBytes,
@Named("che.server.secure_exposer.jwtproxy.memory_limit") String memoryLimitBytes,
@Named("che.server.secure_exposer.jwtproxy.cpu_request") String cpuRequestCores,
@Named("che.server.secure_exposer.jwtproxy.cpu_limit") String cpuLimitCores,
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
@Assisted RuntimeIdentity identity)
Expand All @@ -66,7 +68,9 @@ public JwtProxyProvisioner(
cookiePathStrategy,
multiHostCookiePathStrategy,
jwtProxyImage,
memoryRequestBytes,
memoryLimitBytes,
cpuRequestCores,
cpuLimitCores,
imagePullPolicy,
identity.getWorkspaceId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public PassThroughProxyProvisioner(
CookiePathStrategy cookiePathStrategy,
MultiHostCookiePathStrategy multiHostCookiePathStrategy,
@Named("che.server.secure_exposer.jwtproxy.image") String jwtImage,
@Named("che.server.secure_exposer.jwtproxy.memory_request") String memoryRequestBytes,
@Named("che.server.secure_exposer.jwtproxy.memory_limit") String memoryLimitBytes,
@Named("che.server.secure_exposer.jwtproxy.cpu_request") String cpuRequestCores,
@Named("che.server.secure_exposer.jwtproxy.cpu_limit") String cpuLimitCores,
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
@Assisted RuntimeIdentity identity)
Expand All @@ -52,7 +54,9 @@ public PassThroughProxyProvisioner(
cookiePathStrategy,
multiHostCookiePathStrategy,
jwtImage,
memoryRequestBytes,
memoryLimitBytes,
cpuRequestCores,
cpuLimitCores,
imagePullPolicy,
identity.getWorkspaceId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public void setUp() throws Exception {
cookiePathStrategy,
multiHostCookiePathStrategy,
"eclipse/che-jwtproxy",
"10m",
"128mb",
"0.02",
"0.5",
"Always",
runtimeId);
Expand Down Expand Up @@ -237,7 +239,9 @@ public void shouldUseCookiesAuthEnabledFromServersConfigs() throws Exception {
cookiePathStrategy,
multiHostCookiePathStrategy,
"eclipse/che-jwtproxy",
"10m",
"128mb",
"0.02",
"500m",
"Always",
runtimeId);
Expand Down Expand Up @@ -287,7 +291,9 @@ public void shouldFalseValueAsDefaultForCookiesAuthEnabledAttribute() throws Exc
cookiePathStrategy,
multiHostCookiePathStrategy,
"eclipse/che-jwtproxy",
"10m",
"128mb",
"0.02",
"0.5",
"Always",
runtimeId);
Expand Down Expand Up @@ -328,7 +334,9 @@ public void shouldBindToLocalhostWhenNoServiceForServerExists() throws Exception
cookiePathStrategy,
multiHostCookiePathStrategy,
"eclipse/che-jwtproxy",
"10m",
"128mb",
"0.02",
"0.5",
"Always",
runtimeId);
Expand Down Expand Up @@ -369,7 +377,9 @@ public void multiHostStrategiesUsedForServerRequiringSubdomain() throws Exceptio
cookiePathStrategy,
multiHostCookiePathStrategy,
"eclipse/che-jwtproxy",
"10m",
"128mb",
"0.02",
"0.5",
"Always",
runtimeId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public void shouldConfigureProxyWithExcludes() throws Exception {
new CookiePathStrategy(MULTI_HOST_STRATEGY),
new MultiHostCookiePathStrategy(),
"eclipse/che-jwtproxy",
"10m",
"128mb",
"0.02",
"0.5",
"Always",
runtimeId);
Expand Down