chore: remove che.workspace.projects.storage property
Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>pull/378/head
parent
b7f8fea502
commit
f3700dba05
|
|
@ -74,7 +74,6 @@ import org.eclipse.che.api.workspace.server.spi.provision.env.JavaOptsEnvVariabl
|
|||
import org.eclipse.che.api.workspace.server.spi.provision.env.LegacyEnvVarProvider;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.MachineTokenEnvVarProvider;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.MavenOptsEnvVariableProvider;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.ProjectsRootEnvVariableProvider;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.WorkspaceIdEnvVarProvider;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.WorkspaceNameEnvVarProvider;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.WorkspaceNamespaceNameEnvVarProvider;
|
||||
|
|
@ -221,7 +220,6 @@ public class WsMasterModule extends AbstractModule {
|
|||
envVarProviders.addBinding().to(WorkspaceIdEnvVarProvider.class);
|
||||
envVarProviders.addBinding().to(WorkspaceNamespaceNameEnvVarProvider.class);
|
||||
envVarProviders.addBinding().to(WorkspaceNameEnvVarProvider.class);
|
||||
envVarProviders.addBinding().to(ProjectsRootEnvVariableProvider.class);
|
||||
|
||||
Multibinder<LegacyEnvVarProvider> legacyEnvVarProviderMultibinders =
|
||||
Multibinder.newSetBinder(binder(), LegacyEnvVarProvider.class);
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@ che.websocket.endpoint=ws://${CHE_HOST}:${CHE_PORT}/api/websocket
|
|||
# for major WebSocket interactions and messaging.
|
||||
che.websocket.internal.endpoint=NULL
|
||||
|
||||
# Your projects are synchronized from the {prod-short} server into the machine running each
|
||||
# workspace. This is the directory in the machine where your projects are placed.
|
||||
che.workspace.projects.storage=/projects
|
||||
|
||||
|
||||
# Defines the directory inside the machine where all the workspace logs are placed.
|
||||
# Provide this value into the machine, for example, as an environment variable.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
||||
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
|
@ -18,7 +18,6 @@ import static org.eclipse.che.api.core.model.workspace.config.Command.MACHINE_NA
|
|||
import static org.eclipse.che.api.core.model.workspace.config.MachineConfig.DEVFILE_COMPONENT_ALIAS_ATTRIBUTE;
|
||||
import static org.eclipse.che.api.workspace.server.devfile.Constants.DOCKERIMAGE_COMPONENT_TYPE;
|
||||
import static org.eclipse.che.api.workspace.server.devfile.convert.component.ComponentToWorkspaceApplier.convertEndpointsIntoServers;
|
||||
import static org.eclipse.che.api.workspace.shared.Constants.PROJECTS_VOLUME_NAME;
|
||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.server.external.SingleHostExternalServiceExposureStrategy.SINGLE_HOST_STRATEGY;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
|
@ -62,19 +61,16 @@ public class DockerimageComponentToWorkspaceApplier implements ComponentToWorksp
|
|||
*/
|
||||
static final String CHE_COMPONENT_NAME_LABEL = "che.component.name";
|
||||
|
||||
private final String projectFolderPath;
|
||||
private final String imagePullPolicy;
|
||||
private final KubernetesEnvironmentProvisioner k8sEnvProvisioner;
|
||||
private final String devfileEndpointsExposure;
|
||||
|
||||
@Inject
|
||||
public DockerimageComponentToWorkspaceApplier(
|
||||
@Named("che.workspace.projects.storage") String projectFolderPath,
|
||||
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
|
||||
@Named("che.infra.kubernetes.singlehost.workspace.devfile_endpoint_exposure")
|
||||
String devfileEndpointsExposure,
|
||||
KubernetesEnvironmentProvisioner k8sEnvProvisioner) {
|
||||
this.projectFolderPath = projectFolderPath;
|
||||
this.imagePullPolicy = imagePullPolicy;
|
||||
this.k8sEnvProvisioner = k8sEnvProvisioner;
|
||||
this.devfileEndpointsExposure = devfileEndpointsExposure;
|
||||
|
|
@ -151,12 +147,6 @@ public class DockerimageComponentToWorkspaceApplier implements ComponentToWorksp
|
|||
.getVolumes()
|
||||
.put(v.getName(), new VolumeImpl().withPath(v.getContainerPath())));
|
||||
|
||||
if (Boolean.TRUE.equals(dockerimageComponent.getMountSources())) {
|
||||
machineConfig
|
||||
.getVolumes()
|
||||
.put(PROJECTS_VOLUME_NAME, new VolumeImpl().withPath(projectFolderPath));
|
||||
}
|
||||
|
||||
if (!isNullOrEmpty(componentAlias)) {
|
||||
machineConfig.getAttributes().put(DEVFILE_COMPONENT_ALIAS_ATTRIBUTE, componentAlias);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
|
|||
KubernetesRecipeParser objectsParser,
|
||||
KubernetesEnvironmentProvisioner k8sEnvProvisioner,
|
||||
EnvVars envVars,
|
||||
@Named("che.workspace.projects.storage") String projectFolderPath,
|
||||
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
|
||||
@Named("che.infra.kubernetes.singlehost.workspace.devfile_endpoint_exposure")
|
||||
String devfileEndpointsExposure,
|
||||
|
|
@ -86,7 +85,6 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
|
|||
k8sEnvProvisioner,
|
||||
envVars,
|
||||
KubernetesEnvironment.TYPE,
|
||||
projectFolderPath,
|
||||
imagePullPolicy,
|
||||
devfileEndpointsExposure,
|
||||
kubernetesBasedComponentTypes);
|
||||
|
|
@ -97,7 +95,6 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
|
|||
KubernetesEnvironmentProvisioner k8sEnvProvisioner,
|
||||
EnvVars envVars,
|
||||
String environmentType,
|
||||
String projectFolderPath,
|
||||
String imagePullPolicy,
|
||||
String devfileEndpointsExposure,
|
||||
Set<String> kubernetesBasedComponentTypes) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
||||
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
|
@ -44,7 +44,6 @@ import org.eclipse.che.api.workspace.server.model.impl.devfile.ComponentImpl;
|
|||
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
|
||||
import org.eclipse.che.api.workspace.server.spi.environment.InternalEnvironment;
|
||||
import org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.ProjectsRootEnvVariableProvider;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.ChePluginsApplier;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin;
|
||||
|
|
@ -77,7 +76,6 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
|
|||
private final String defaultSidecarCpuLimitCores;
|
||||
private final String defaultSidecarCpuRequestCores;
|
||||
private final boolean isAuthEnabled;
|
||||
private final ProjectsRootEnvVariableProvider projectsRootEnvVariableProvider;
|
||||
private final ChePluginsVolumeApplier chePluginsVolumeApplier;
|
||||
private final EnvVars envVars;
|
||||
|
||||
|
|
@ -90,7 +88,6 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
|
|||
@Named("che.workspace.sidecar.default_cpu_request_cores")
|
||||
String defaultSidecarCpuRequestCores,
|
||||
@Named("che.agents.auth_enabled") boolean isAuthEnabled,
|
||||
ProjectsRootEnvVariableProvider projectsRootEnvVariableProvider,
|
||||
ChePluginsVolumeApplier chePluginsVolumeApplier,
|
||||
EnvVars envVars) {
|
||||
this.defaultSidecarMemoryLimitBytes = toBytesString(defaultSidecarMemoryLimitMB);
|
||||
|
|
@ -102,7 +99,6 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
|
|||
this.isAuthEnabled = isAuthEnabled;
|
||||
this.sidecarImagePullPolicy =
|
||||
validImagePullPolicies.contains(sidecarImagePullPolicy) ? sidecarImagePullPolicy : null;
|
||||
this.projectsRootEnvVariableProvider = projectsRootEnvVariableProvider;
|
||||
this.chePluginsVolumeApplier = chePluginsVolumeApplier;
|
||||
this.envVars = envVars;
|
||||
}
|
||||
|
|
@ -257,7 +253,6 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
|
|||
.setDefaultSidecarMemoryRequestAttribute(defaultSidecarMemoryRequestBytes)
|
||||
.setDefaultSidecarCpuLimitAttribute(defaultSidecarCpuLimitCores)
|
||||
.setDefaultSidecarCpuRequestAttribute(defaultSidecarCpuRequestCores)
|
||||
.setProjectsRootPathEnvVar(projectsRootEnvVariableProvider.get(runtimeIdentity))
|
||||
.setComponent(pluginRelatedComponent)
|
||||
.build();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
||||
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
|
@ -37,7 +37,6 @@ import org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfi
|
|||
import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.Volume;
|
||||
import org.eclipse.che.commons.lang.Pair;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.util.Containers;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.util.KubernetesSize;
|
||||
|
||||
|
|
@ -51,11 +50,9 @@ public class MachineResolver {
|
|||
private final String defaultSidecarCpuLimitCores;
|
||||
private final String defaultSidecarCpuRequestCores;
|
||||
private final List<ChePluginEndpoint> containerEndpoints;
|
||||
private final Pair<String, String> projectsRootPathEnvVar;
|
||||
private final Component component;
|
||||
|
||||
public MachineResolver(
|
||||
Pair<String, String> projectsRootPathEnvVar,
|
||||
Container container,
|
||||
CheContainer cheContainer,
|
||||
String defaultSidecarMemoryLimitBytes,
|
||||
|
|
@ -71,7 +68,6 @@ public class MachineResolver {
|
|||
this.defaultSidecarCpuLimitCores = defaultSidecarCpuLimitCores;
|
||||
this.defaultSidecarCpuRequestCores = defaultSidecarCpuRequestCores;
|
||||
this.containerEndpoints = containerEndpoints;
|
||||
this.projectsRootPathEnvVar = projectsRootPathEnvVar;
|
||||
this.component = component;
|
||||
}
|
||||
|
||||
|
|
@ -193,26 +189,13 @@ public class MachineResolver {
|
|||
|
||||
Map<String, VolumeImpl> result = new HashMap<>();
|
||||
|
||||
if (container.isMountSources()) {
|
||||
result.put(PROJECTS_VOLUME_NAME, new VolumeImpl().withPath(projectsRootPathEnvVar.second));
|
||||
}
|
||||
|
||||
for (Volume volume : container.getVolumes()) {
|
||||
if (volume.getName().equals(PROJECTS_VOLUME_NAME)
|
||||
&& !projectsRootPathEnvVar.second.equals(volume.getMountPath())) {
|
||||
if (volume.getName().equals(PROJECTS_VOLUME_NAME)) {
|
||||
throw new InfrastructureException(
|
||||
format(
|
||||
"Plugin '%s' tried to manually mount the '%s' volume into its container '%s' on"
|
||||
+ " path '%s'. This is illegal because sources need to be mounted to '%s'. Set"
|
||||
+ " the mountSources attribute to true instead and remove the manual volume"
|
||||
+ " mount in the plugin. After that the mount path of the sources will be"
|
||||
+ " available automatically in the '%s' environment variable.",
|
||||
component.getId(),
|
||||
PROJECTS_VOLUME_NAME,
|
||||
container.getName(),
|
||||
volume.getMountPath(),
|
||||
projectsRootPathEnvVar.second,
|
||||
projectsRootPathEnvVar.first));
|
||||
"Plugin '%s' tried to manually mount the '%s' volume into its container '%s' on"
|
||||
+ " path '%s'. This is illegal because sources need to be mounted to '%s'. Set"
|
||||
+ " the mountSources attribute to true instead and remove the manual volume"
|
||||
+ " mount in the plugin.");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
||||
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
|
@ -16,7 +16,6 @@ import java.util.List;
|
|||
import org.eclipse.che.api.core.model.workspace.devfile.Component;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint;
|
||||
import org.eclipse.che.commons.lang.Pair;
|
||||
|
||||
/** @author Alexander Garagatyi */
|
||||
public class MachineResolverBuilder {
|
||||
|
|
@ -28,7 +27,6 @@ public class MachineResolverBuilder {
|
|||
private String defaultSidecarCpuLimitAttribute;
|
||||
private String defaultSidecarCpuRequestAttribute;
|
||||
private List<ChePluginEndpoint> containerEndpoints;
|
||||
private Pair<String, String> projectsRootPathEnvVar;
|
||||
private Component component;
|
||||
|
||||
public MachineResolver build() {
|
||||
|
|
@ -38,14 +36,12 @@ public class MachineResolverBuilder {
|
|||
|| defaultSidecarMemoryRequestAttribute == null
|
||||
|| defaultSidecarCpuLimitAttribute == null
|
||||
|| defaultSidecarCpuRequestAttribute == null
|
||||
|| containerEndpoints == null
|
||||
|| projectsRootPathEnvVar == null) {
|
||||
|| containerEndpoints == null) {
|
||||
throw new IllegalStateException(
|
||||
"Unable to build MachineResolver because some fields are null");
|
||||
}
|
||||
|
||||
return new MachineResolver(
|
||||
projectsRootPathEnvVar,
|
||||
container,
|
||||
cheContainer,
|
||||
defaultSidecarMemoryLimitAttribute,
|
||||
|
|
@ -95,12 +91,6 @@ public class MachineResolverBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public MachineResolverBuilder setProjectsRootPathEnvVar(
|
||||
Pair<String, String> projectsRootPathEnvVar) {
|
||||
this.projectsRootPathEnvVar = projectsRootPathEnvVar;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MachineResolverBuilder setComponent(Component component) {
|
||||
this.component = component;
|
||||
return this;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
||||
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
|
@ -67,8 +67,6 @@ import org.testng.annotations.Test;
|
|||
@Listeners(MockitoTestNGListener.class)
|
||||
public class DockerimageComponentToWorkspaceApplierTest {
|
||||
|
||||
private static final String PROJECTS_MOUNT_PATH = "/projects";
|
||||
|
||||
private WorkspaceConfigImpl workspaceConfig;
|
||||
|
||||
private DockerimageComponentToWorkspaceApplier dockerimageComponentApplier;
|
||||
|
|
@ -82,7 +80,7 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
|||
public void setUp() throws Exception {
|
||||
dockerimageComponentApplier =
|
||||
new DockerimageComponentToWorkspaceApplier(
|
||||
PROJECTS_MOUNT_PATH, "Always", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
||||
"Always", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
||||
workspaceConfig = new WorkspaceConfigImpl();
|
||||
}
|
||||
|
||||
|
|
@ -137,8 +135,7 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
|||
dockerimageComponent.setImage("eclipse/ubuntu_jdk8:latest");
|
||||
dockerimageComponent.setMemoryLimit("1G");
|
||||
dockerimageComponentApplier =
|
||||
new DockerimageComponentToWorkspaceApplier(
|
||||
PROJECTS_MOUNT_PATH, "Never", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
||||
new DockerimageComponentToWorkspaceApplier("Never", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
||||
|
||||
// when
|
||||
dockerimageComponentApplier.apply(workspaceConfig, dockerimageComponent, null);
|
||||
|
|
@ -484,10 +481,6 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
|||
machinesCaptor.capture());
|
||||
MachineConfigImpl machineConfig = machinesCaptor.getValue().get("jdk");
|
||||
assertNotNull(machineConfig);
|
||||
org.eclipse.che.api.workspace.server.model.impl.VolumeImpl projectsVolume =
|
||||
machineConfig.getVolumes().get(PROJECTS_VOLUME_NAME);
|
||||
assertNotNull(projectsVolume);
|
||||
assertEquals(projectsVolume.getPath(), PROJECTS_MOUNT_PATH);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -578,7 +571,7 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
|||
throws DevfileException {
|
||||
dockerimageComponentApplier =
|
||||
new DockerimageComponentToWorkspaceApplier(
|
||||
PROJECTS_MOUNT_PATH, "Always", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
||||
"Always", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
||||
|
||||
// given
|
||||
EndpointImpl endpoint = new EndpointImpl("jdk-ls", 4923, emptyMap());
|
||||
|
|
@ -614,7 +607,7 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
|||
public void serverCantHaveRequireSubdomainWhenSinglehostDevfileExpose() throws DevfileException {
|
||||
dockerimageComponentApplier =
|
||||
new DockerimageComponentToWorkspaceApplier(
|
||||
PROJECTS_MOUNT_PATH, "Always", SINGLE_HOST_STRATEGY, k8sEnvProvisioner);
|
||||
"Always", SINGLE_HOST_STRATEGY, k8sEnvProvisioner);
|
||||
|
||||
// given
|
||||
EndpointImpl endpoint = new EndpointImpl("jdk-ls", 4923, emptyMap());
|
||||
|
|
|
|||
|
|
@ -87,7 +87,6 @@ public class KubernetesComponentToWorkspaceApplierTest {
|
|||
|
||||
public static final String REFERENCE_FILENAME = "reference.yaml";
|
||||
public static final String COMPONENT_NAME = "foo";
|
||||
public static final String PROJECT_MOUNT_PATH = "/projects";
|
||||
|
||||
private WorkspaceConfigImpl workspaceConfig;
|
||||
|
||||
|
|
@ -111,7 +110,6 @@ public class KubernetesComponentToWorkspaceApplierTest {
|
|||
k8sRecipeParser,
|
||||
k8sEnvProvisioner,
|
||||
envVars,
|
||||
PROJECT_MOUNT_PATH,
|
||||
"Always",
|
||||
MULTI_HOST_STRATEGY,
|
||||
k8sBasedComponents);
|
||||
|
|
@ -495,7 +493,6 @@ public class KubernetesComponentToWorkspaceApplierTest {
|
|||
k8sRecipeParser,
|
||||
k8sEnvProvisioner,
|
||||
envVars,
|
||||
PROJECT_MOUNT_PATH,
|
||||
"Never",
|
||||
MULTI_HOST_STRATEGY,
|
||||
k8sBasedComponents);
|
||||
|
|
@ -642,7 +639,6 @@ public class KubernetesComponentToWorkspaceApplierTest {
|
|||
k8sRecipeParser,
|
||||
k8sEnvProvisioner,
|
||||
envVars,
|
||||
PROJECT_MOUNT_PATH,
|
||||
"Always",
|
||||
SINGLE_HOST_STRATEGY,
|
||||
k8sBasedComponents);
|
||||
|
|
@ -692,7 +688,6 @@ public class KubernetesComponentToWorkspaceApplierTest {
|
|||
k8sRecipeParser,
|
||||
k8sEnvProvisioner,
|
||||
envVars,
|
||||
PROJECT_MOUNT_PATH,
|
||||
"Always",
|
||||
MULTI_HOST_STRATEGY,
|
||||
k8sBasedComponents);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import static org.eclipse.che.api.workspace.shared.Constants.TOOL_CONTAINER_SOUR
|
|||
import static org.eclipse.che.commons.lang.NameGenerator.generate;
|
||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.Constants.CHE_ORIGINAL_NAME_LABEL;
|
||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.server.secure.SecureServerExposerFactoryProvider.SECURE_EXPOSER_IMPL_PROPERTY;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.lenient;
|
||||
import static org.mockito.Mockito.spy;
|
||||
|
|
@ -68,7 +67,6 @@ import org.eclipse.che.api.workspace.server.model.impl.devfile.EnvImpl;
|
|||
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
|
||||
import org.eclipse.che.api.workspace.server.spi.environment.InternalEnvironment;
|
||||
import org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.ProjectsRootEnvVariableProvider;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainerPort;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin;
|
||||
|
|
@ -77,7 +75,6 @@ import org.eclipse.che.api.workspace.server.wsplugins.model.Command;
|
|||
import org.eclipse.che.api.workspace.server.wsplugins.model.EnvVar;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.Volume;
|
||||
import org.eclipse.che.commons.lang.NameGenerator;
|
||||
import org.eclipse.che.commons.lang.Pair;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.Warnings;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment.PodData;
|
||||
|
|
@ -113,7 +110,6 @@ public class KubernetesPluginsToolingApplierTest {
|
|||
@Mock private Container userContainer;
|
||||
@Mock private InternalMachineConfig userMachineConfig;
|
||||
@Mock private RuntimeIdentity runtimeIdentity;
|
||||
@Mock private ProjectsRootEnvVariableProvider projectsRootEnvVariableProvider;
|
||||
@Mock private ChePluginsVolumeApplier chePluginsVolumeApplier;
|
||||
@Mock private EnvVars envVars;
|
||||
|
||||
|
|
@ -132,7 +128,6 @@ public class KubernetesPluginsToolingApplierTest {
|
|||
CPU_LIMIT,
|
||||
CPU_REQUEST,
|
||||
false,
|
||||
projectsRootEnvVariableProvider,
|
||||
chePluginsVolumeApplier,
|
||||
envVars);
|
||||
|
||||
|
|
@ -147,10 +142,6 @@ public class KubernetesPluginsToolingApplierTest {
|
|||
lenient().when(meta.getName()).thenReturn(POD_NAME);
|
||||
internalEnvironment.addPod(pod);
|
||||
internalEnvironment.getMachines().putAll(machines);
|
||||
|
||||
lenient()
|
||||
.when(projectsRootEnvVariableProvider.get(any()))
|
||||
.thenReturn(new Pair<>("projects_root", "/somewhere/over/the/rainbow"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -728,7 +719,6 @@ public class KubernetesPluginsToolingApplierTest {
|
|||
CPU_LIMIT,
|
||||
CPU_REQUEST,
|
||||
true,
|
||||
projectsRootEnvVariableProvider,
|
||||
chePluginsVolumeApplier,
|
||||
envVars);
|
||||
internalEnvironment.getAttributes().put(SECURE_EXPOSER_IMPL_PROPERTY, "somethingElse");
|
||||
|
|
@ -749,7 +739,6 @@ public class KubernetesPluginsToolingApplierTest {
|
|||
CPU_LIMIT,
|
||||
CPU_REQUEST,
|
||||
true,
|
||||
projectsRootEnvVariableProvider,
|
||||
chePluginsVolumeApplier,
|
||||
envVars);
|
||||
|
||||
|
|
@ -778,7 +767,6 @@ public class KubernetesPluginsToolingApplierTest {
|
|||
CPU_LIMIT,
|
||||
CPU_REQUEST,
|
||||
true,
|
||||
projectsRootEnvVariableProvider,
|
||||
chePluginsVolumeApplier,
|
||||
envVars);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
||||
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
|
|
@ -37,7 +37,6 @@ import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer;
|
|||
import org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.model.Volume;
|
||||
import org.eclipse.che.api.workspace.shared.Constants;
|
||||
import org.eclipse.che.commons.lang.Pair;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.util.Containers;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.util.KubernetesSize;
|
||||
import org.mockito.testng.MockitoTestNGListener;
|
||||
|
|
@ -75,7 +74,6 @@ public class MachineResolverTest {
|
|||
component = new ComponentImpl("chePlugin", PLUGIN_ID);
|
||||
resolver =
|
||||
new MachineResolver(
|
||||
new Pair<>(PROJECTS_ENV_VAR, PROJECTS_MOUNT_PATH),
|
||||
container,
|
||||
cheContainer,
|
||||
DEFAULT_MEM_LIMIT,
|
||||
|
|
@ -269,17 +267,6 @@ public class MachineResolverTest {
|
|||
resolver.resolve();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldAddProjectMountPointWhenMountSources() throws InfrastructureException {
|
||||
cheContainer.setMountSources(true);
|
||||
|
||||
InternalMachineConfig config = resolver.resolve();
|
||||
|
||||
assertEquals(1, config.getVolumes().size());
|
||||
assertEquals(
|
||||
PROJECTS_MOUNT_PATH, config.getVolumes().get(Constants.PROJECTS_VOLUME_NAME).getPath());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldAddVolumesFromDevfileComponent() throws InfrastructureException {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ public class OpenshiftComponentToWorkspaceApplier extends KubernetesComponentToW
|
|||
KubernetesRecipeParser objectsParser,
|
||||
KubernetesEnvironmentProvisioner k8sEnvProvisioner,
|
||||
EnvVars envVars,
|
||||
@Named("che.workspace.projects.storage") String projectFolderPath,
|
||||
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
|
||||
@Named("che.infra.kubernetes.singlehost.workspace.devfile_endpoint_exposure")
|
||||
String devfileEndpointsExposure,
|
||||
|
|
@ -38,7 +37,6 @@ public class OpenshiftComponentToWorkspaceApplier extends KubernetesComponentToW
|
|||
k8sEnvProvisioner,
|
||||
envVars,
|
||||
OpenShiftEnvironment.TYPE,
|
||||
projectFolderPath,
|
||||
imagePullPolicy,
|
||||
devfileEndpointsExposure,
|
||||
kubernetesBasedComponentTypes);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ public class OpenshiftComponentToWorkspaceApplierTest {
|
|||
k8sRecipeParser,
|
||||
k8sEnvProvisioner,
|
||||
envVars,
|
||||
"/projects",
|
||||
"Always",
|
||||
MULTI_HOST_STRATEGY,
|
||||
k8sBasedComponents);
|
||||
|
|
@ -114,7 +113,6 @@ public class OpenshiftComponentToWorkspaceApplierTest {
|
|||
k8sRecipeParser,
|
||||
k8sEnvProvisioner,
|
||||
envVars,
|
||||
"/projects",
|
||||
"Always",
|
||||
SINGLE_HOST_STRATEGY,
|
||||
openshiftBasedComponents);
|
||||
|
|
@ -166,7 +164,6 @@ public class OpenshiftComponentToWorkspaceApplierTest {
|
|||
k8sRecipeParser,
|
||||
k8sEnvProvisioner,
|
||||
envVars,
|
||||
"/projects",
|
||||
"Always",
|
||||
MULTI_HOST_STRATEGY,
|
||||
openshiftBasedComponents);
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2018 Red Hat, Inc.
|
||||
* This program and the accompanying materials are made
|
||||
* available under the terms of the Eclipse Public License 2.0
|
||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0
|
||||
*
|
||||
* Contributors:
|
||||
* Red Hat, Inc. - initial API and implementation
|
||||
*/
|
||||
package org.eclipse.che.api.workspace.server.spi.provision.env;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
|
||||
import org.eclipse.che.commons.lang.Pair;
|
||||
|
||||
/**
|
||||
* Add env variable to machines with path to root folder of projects
|
||||
*
|
||||
* @author Alexander Garagatyi
|
||||
*/
|
||||
public class ProjectsRootEnvVariableProvider implements EnvVarProvider {
|
||||
|
||||
/** Env variable that points to root folder of projects in a machine */
|
||||
public static final String PROJECTS_ROOT_VARIABLE = "CHE_PROJECTS_ROOT";
|
||||
|
||||
private String projectFolderPath;
|
||||
|
||||
@Inject
|
||||
public ProjectsRootEnvVariableProvider(
|
||||
@Named("che.workspace.projects.storage") String projectFolderPath) {
|
||||
this.projectFolderPath = projectFolderPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<String, String> get(RuntimeIdentity runtimeIdentity) {
|
||||
return Pair.of(PROJECTS_ROOT_VARIABLE, projectFolderPath);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue