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.LegacyEnvVarProvider;
|
||||||
import org.eclipse.che.api.workspace.server.spi.provision.env.MachineTokenEnvVarProvider;
|
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.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.WorkspaceIdEnvVarProvider;
|
||||||
import org.eclipse.che.api.workspace.server.spi.provision.env.WorkspaceNameEnvVarProvider;
|
import org.eclipse.che.api.workspace.server.spi.provision.env.WorkspaceNameEnvVarProvider;
|
||||||
import org.eclipse.che.api.workspace.server.spi.provision.env.WorkspaceNamespaceNameEnvVarProvider;
|
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(WorkspaceIdEnvVarProvider.class);
|
||||||
envVarProviders.addBinding().to(WorkspaceNamespaceNameEnvVarProvider.class);
|
envVarProviders.addBinding().to(WorkspaceNamespaceNameEnvVarProvider.class);
|
||||||
envVarProviders.addBinding().to(WorkspaceNameEnvVarProvider.class);
|
envVarProviders.addBinding().to(WorkspaceNameEnvVarProvider.class);
|
||||||
envVarProviders.addBinding().to(ProjectsRootEnvVariableProvider.class);
|
|
||||||
|
|
||||||
Multibinder<LegacyEnvVarProvider> legacyEnvVarProviderMultibinders =
|
Multibinder<LegacyEnvVarProvider> legacyEnvVarProviderMultibinders =
|
||||||
Multibinder.newSetBinder(binder(), LegacyEnvVarProvider.class);
|
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.
|
# for major WebSocket interactions and messaging.
|
||||||
che.websocket.internal.endpoint=NULL
|
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.
|
# 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.
|
# 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
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-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.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.Constants.DOCKERIMAGE_COMPONENT_TYPE;
|
||||||
import static org.eclipse.che.api.workspace.server.devfile.convert.component.ComponentToWorkspaceApplier.convertEndpointsIntoServers;
|
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 static org.eclipse.che.workspace.infrastructure.kubernetes.server.external.SingleHostExternalServiceExposureStrategy.SINGLE_HOST_STRATEGY;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
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";
|
static final String CHE_COMPONENT_NAME_LABEL = "che.component.name";
|
||||||
|
|
||||||
private final String projectFolderPath;
|
|
||||||
private final String imagePullPolicy;
|
private final String imagePullPolicy;
|
||||||
private final KubernetesEnvironmentProvisioner k8sEnvProvisioner;
|
private final KubernetesEnvironmentProvisioner k8sEnvProvisioner;
|
||||||
private final String devfileEndpointsExposure;
|
private final String devfileEndpointsExposure;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public DockerimageComponentToWorkspaceApplier(
|
public DockerimageComponentToWorkspaceApplier(
|
||||||
@Named("che.workspace.projects.storage") String projectFolderPath,
|
|
||||||
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
|
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
|
||||||
@Named("che.infra.kubernetes.singlehost.workspace.devfile_endpoint_exposure")
|
@Named("che.infra.kubernetes.singlehost.workspace.devfile_endpoint_exposure")
|
||||||
String devfileEndpointsExposure,
|
String devfileEndpointsExposure,
|
||||||
KubernetesEnvironmentProvisioner k8sEnvProvisioner) {
|
KubernetesEnvironmentProvisioner k8sEnvProvisioner) {
|
||||||
this.projectFolderPath = projectFolderPath;
|
|
||||||
this.imagePullPolicy = imagePullPolicy;
|
this.imagePullPolicy = imagePullPolicy;
|
||||||
this.k8sEnvProvisioner = k8sEnvProvisioner;
|
this.k8sEnvProvisioner = k8sEnvProvisioner;
|
||||||
this.devfileEndpointsExposure = devfileEndpointsExposure;
|
this.devfileEndpointsExposure = devfileEndpointsExposure;
|
||||||
|
|
@ -151,12 +147,6 @@ public class DockerimageComponentToWorkspaceApplier implements ComponentToWorksp
|
||||||
.getVolumes()
|
.getVolumes()
|
||||||
.put(v.getName(), new VolumeImpl().withPath(v.getContainerPath())));
|
.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)) {
|
if (!isNullOrEmpty(componentAlias)) {
|
||||||
machineConfig.getAttributes().put(DEVFILE_COMPONENT_ALIAS_ATTRIBUTE, componentAlias);
|
machineConfig.getAttributes().put(DEVFILE_COMPONENT_ALIAS_ATTRIBUTE, componentAlias);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,6 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
|
||||||
KubernetesRecipeParser objectsParser,
|
KubernetesRecipeParser objectsParser,
|
||||||
KubernetesEnvironmentProvisioner k8sEnvProvisioner,
|
KubernetesEnvironmentProvisioner k8sEnvProvisioner,
|
||||||
EnvVars envVars,
|
EnvVars envVars,
|
||||||
@Named("che.workspace.projects.storage") String projectFolderPath,
|
|
||||||
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
|
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
|
||||||
@Named("che.infra.kubernetes.singlehost.workspace.devfile_endpoint_exposure")
|
@Named("che.infra.kubernetes.singlehost.workspace.devfile_endpoint_exposure")
|
||||||
String devfileEndpointsExposure,
|
String devfileEndpointsExposure,
|
||||||
|
|
@ -86,7 +85,6 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
|
||||||
k8sEnvProvisioner,
|
k8sEnvProvisioner,
|
||||||
envVars,
|
envVars,
|
||||||
KubernetesEnvironment.TYPE,
|
KubernetesEnvironment.TYPE,
|
||||||
projectFolderPath,
|
|
||||||
imagePullPolicy,
|
imagePullPolicy,
|
||||||
devfileEndpointsExposure,
|
devfileEndpointsExposure,
|
||||||
kubernetesBasedComponentTypes);
|
kubernetesBasedComponentTypes);
|
||||||
|
|
@ -97,7 +95,6 @@ public class KubernetesComponentToWorkspaceApplier implements ComponentToWorkspa
|
||||||
KubernetesEnvironmentProvisioner k8sEnvProvisioner,
|
KubernetesEnvironmentProvisioner k8sEnvProvisioner,
|
||||||
EnvVars envVars,
|
EnvVars envVars,
|
||||||
String environmentType,
|
String environmentType,
|
||||||
String projectFolderPath,
|
|
||||||
String imagePullPolicy,
|
String imagePullPolicy,
|
||||||
String devfileEndpointsExposure,
|
String devfileEndpointsExposure,
|
||||||
Set<String> kubernetesBasedComponentTypes) {
|
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
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-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.InfrastructureException;
|
||||||
import org.eclipse.che.api.workspace.server.spi.environment.InternalEnvironment;
|
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.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.ChePluginsApplier;
|
||||||
import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer;
|
import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer;
|
||||||
import org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin;
|
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 defaultSidecarCpuLimitCores;
|
||||||
private final String defaultSidecarCpuRequestCores;
|
private final String defaultSidecarCpuRequestCores;
|
||||||
private final boolean isAuthEnabled;
|
private final boolean isAuthEnabled;
|
||||||
private final ProjectsRootEnvVariableProvider projectsRootEnvVariableProvider;
|
|
||||||
private final ChePluginsVolumeApplier chePluginsVolumeApplier;
|
private final ChePluginsVolumeApplier chePluginsVolumeApplier;
|
||||||
private final EnvVars envVars;
|
private final EnvVars envVars;
|
||||||
|
|
||||||
|
|
@ -90,7 +88,6 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
|
||||||
@Named("che.workspace.sidecar.default_cpu_request_cores")
|
@Named("che.workspace.sidecar.default_cpu_request_cores")
|
||||||
String defaultSidecarCpuRequestCores,
|
String defaultSidecarCpuRequestCores,
|
||||||
@Named("che.agents.auth_enabled") boolean isAuthEnabled,
|
@Named("che.agents.auth_enabled") boolean isAuthEnabled,
|
||||||
ProjectsRootEnvVariableProvider projectsRootEnvVariableProvider,
|
|
||||||
ChePluginsVolumeApplier chePluginsVolumeApplier,
|
ChePluginsVolumeApplier chePluginsVolumeApplier,
|
||||||
EnvVars envVars) {
|
EnvVars envVars) {
|
||||||
this.defaultSidecarMemoryLimitBytes = toBytesString(defaultSidecarMemoryLimitMB);
|
this.defaultSidecarMemoryLimitBytes = toBytesString(defaultSidecarMemoryLimitMB);
|
||||||
|
|
@ -102,7 +99,6 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
|
||||||
this.isAuthEnabled = isAuthEnabled;
|
this.isAuthEnabled = isAuthEnabled;
|
||||||
this.sidecarImagePullPolicy =
|
this.sidecarImagePullPolicy =
|
||||||
validImagePullPolicies.contains(sidecarImagePullPolicy) ? sidecarImagePullPolicy : null;
|
validImagePullPolicies.contains(sidecarImagePullPolicy) ? sidecarImagePullPolicy : null;
|
||||||
this.projectsRootEnvVariableProvider = projectsRootEnvVariableProvider;
|
|
||||||
this.chePluginsVolumeApplier = chePluginsVolumeApplier;
|
this.chePluginsVolumeApplier = chePluginsVolumeApplier;
|
||||||
this.envVars = envVars;
|
this.envVars = envVars;
|
||||||
}
|
}
|
||||||
|
|
@ -257,7 +253,6 @@ public class KubernetesPluginsToolingApplier implements ChePluginsApplier {
|
||||||
.setDefaultSidecarMemoryRequestAttribute(defaultSidecarMemoryRequestBytes)
|
.setDefaultSidecarMemoryRequestAttribute(defaultSidecarMemoryRequestBytes)
|
||||||
.setDefaultSidecarCpuLimitAttribute(defaultSidecarCpuLimitCores)
|
.setDefaultSidecarCpuLimitAttribute(defaultSidecarCpuLimitCores)
|
||||||
.setDefaultSidecarCpuRequestAttribute(defaultSidecarCpuRequestCores)
|
.setDefaultSidecarCpuRequestAttribute(defaultSidecarCpuRequestCores)
|
||||||
.setProjectsRootPathEnvVar(projectsRootEnvVariableProvider.get(runtimeIdentity))
|
|
||||||
.setComponent(pluginRelatedComponent)
|
.setComponent(pluginRelatedComponent)
|
||||||
.build();
|
.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
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-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.CheContainer;
|
||||||
import org.eclipse.che.api.workspace.server.wsplugins.model.ChePluginEndpoint;
|
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.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.Containers;
|
||||||
import org.eclipse.che.workspace.infrastructure.kubernetes.util.KubernetesSize;
|
import org.eclipse.che.workspace.infrastructure.kubernetes.util.KubernetesSize;
|
||||||
|
|
||||||
|
|
@ -51,11 +50,9 @@ public class MachineResolver {
|
||||||
private final String defaultSidecarCpuLimitCores;
|
private final String defaultSidecarCpuLimitCores;
|
||||||
private final String defaultSidecarCpuRequestCores;
|
private final String defaultSidecarCpuRequestCores;
|
||||||
private final List<ChePluginEndpoint> containerEndpoints;
|
private final List<ChePluginEndpoint> containerEndpoints;
|
||||||
private final Pair<String, String> projectsRootPathEnvVar;
|
|
||||||
private final Component component;
|
private final Component component;
|
||||||
|
|
||||||
public MachineResolver(
|
public MachineResolver(
|
||||||
Pair<String, String> projectsRootPathEnvVar,
|
|
||||||
Container container,
|
Container container,
|
||||||
CheContainer cheContainer,
|
CheContainer cheContainer,
|
||||||
String defaultSidecarMemoryLimitBytes,
|
String defaultSidecarMemoryLimitBytes,
|
||||||
|
|
@ -71,7 +68,6 @@ public class MachineResolver {
|
||||||
this.defaultSidecarCpuLimitCores = defaultSidecarCpuLimitCores;
|
this.defaultSidecarCpuLimitCores = defaultSidecarCpuLimitCores;
|
||||||
this.defaultSidecarCpuRequestCores = defaultSidecarCpuRequestCores;
|
this.defaultSidecarCpuRequestCores = defaultSidecarCpuRequestCores;
|
||||||
this.containerEndpoints = containerEndpoints;
|
this.containerEndpoints = containerEndpoints;
|
||||||
this.projectsRootPathEnvVar = projectsRootPathEnvVar;
|
|
||||||
this.component = component;
|
this.component = component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,26 +189,13 @@ public class MachineResolver {
|
||||||
|
|
||||||
Map<String, VolumeImpl> result = new HashMap<>();
|
Map<String, VolumeImpl> result = new HashMap<>();
|
||||||
|
|
||||||
if (container.isMountSources()) {
|
|
||||||
result.put(PROJECTS_VOLUME_NAME, new VolumeImpl().withPath(projectsRootPathEnvVar.second));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Volume volume : container.getVolumes()) {
|
for (Volume volume : container.getVolumes()) {
|
||||||
if (volume.getName().equals(PROJECTS_VOLUME_NAME)
|
if (volume.getName().equals(PROJECTS_VOLUME_NAME)) {
|
||||||
&& !projectsRootPathEnvVar.second.equals(volume.getMountPath())) {
|
|
||||||
throw new InfrastructureException(
|
throw new InfrastructureException(
|
||||||
format(
|
"Plugin '%s' tried to manually mount the '%s' volume into its container '%s' on"
|
||||||
"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"
|
||||||
+ " 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"
|
||||||
+ " the mountSources attribute to true instead and remove the manual volume"
|
+ " mount in the plugin.");
|
||||||
+ " 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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
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
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-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.core.model.workspace.devfile.Component;
|
||||||
import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainer;
|
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.ChePluginEndpoint;
|
||||||
import org.eclipse.che.commons.lang.Pair;
|
|
||||||
|
|
||||||
/** @author Alexander Garagatyi */
|
/** @author Alexander Garagatyi */
|
||||||
public class MachineResolverBuilder {
|
public class MachineResolverBuilder {
|
||||||
|
|
@ -28,7 +27,6 @@ public class MachineResolverBuilder {
|
||||||
private String defaultSidecarCpuLimitAttribute;
|
private String defaultSidecarCpuLimitAttribute;
|
||||||
private String defaultSidecarCpuRequestAttribute;
|
private String defaultSidecarCpuRequestAttribute;
|
||||||
private List<ChePluginEndpoint> containerEndpoints;
|
private List<ChePluginEndpoint> containerEndpoints;
|
||||||
private Pair<String, String> projectsRootPathEnvVar;
|
|
||||||
private Component component;
|
private Component component;
|
||||||
|
|
||||||
public MachineResolver build() {
|
public MachineResolver build() {
|
||||||
|
|
@ -38,14 +36,12 @@ public class MachineResolverBuilder {
|
||||||
|| defaultSidecarMemoryRequestAttribute == null
|
|| defaultSidecarMemoryRequestAttribute == null
|
||||||
|| defaultSidecarCpuLimitAttribute == null
|
|| defaultSidecarCpuLimitAttribute == null
|
||||||
|| defaultSidecarCpuRequestAttribute == null
|
|| defaultSidecarCpuRequestAttribute == null
|
||||||
|| containerEndpoints == null
|
|| containerEndpoints == null) {
|
||||||
|| projectsRootPathEnvVar == null) {
|
|
||||||
throw new IllegalStateException(
|
throw new IllegalStateException(
|
||||||
"Unable to build MachineResolver because some fields are null");
|
"Unable to build MachineResolver because some fields are null");
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MachineResolver(
|
return new MachineResolver(
|
||||||
projectsRootPathEnvVar,
|
|
||||||
container,
|
container,
|
||||||
cheContainer,
|
cheContainer,
|
||||||
defaultSidecarMemoryLimitAttribute,
|
defaultSidecarMemoryLimitAttribute,
|
||||||
|
|
@ -95,12 +91,6 @@ public class MachineResolverBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MachineResolverBuilder setProjectsRootPathEnvVar(
|
|
||||||
Pair<String, String> projectsRootPathEnvVar) {
|
|
||||||
this.projectsRootPathEnvVar = projectsRootPathEnvVar;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MachineResolverBuilder setComponent(Component component) {
|
public MachineResolverBuilder setComponent(Component component) {
|
||||||
this.component = component;
|
this.component = component;
|
||||||
return this;
|
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
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-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)
|
@Listeners(MockitoTestNGListener.class)
|
||||||
public class DockerimageComponentToWorkspaceApplierTest {
|
public class DockerimageComponentToWorkspaceApplierTest {
|
||||||
|
|
||||||
private static final String PROJECTS_MOUNT_PATH = "/projects";
|
|
||||||
|
|
||||||
private WorkspaceConfigImpl workspaceConfig;
|
private WorkspaceConfigImpl workspaceConfig;
|
||||||
|
|
||||||
private DockerimageComponentToWorkspaceApplier dockerimageComponentApplier;
|
private DockerimageComponentToWorkspaceApplier dockerimageComponentApplier;
|
||||||
|
|
@ -82,7 +80,7 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
dockerimageComponentApplier =
|
dockerimageComponentApplier =
|
||||||
new DockerimageComponentToWorkspaceApplier(
|
new DockerimageComponentToWorkspaceApplier(
|
||||||
PROJECTS_MOUNT_PATH, "Always", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
"Always", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
||||||
workspaceConfig = new WorkspaceConfigImpl();
|
workspaceConfig = new WorkspaceConfigImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,8 +135,7 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
||||||
dockerimageComponent.setImage("eclipse/ubuntu_jdk8:latest");
|
dockerimageComponent.setImage("eclipse/ubuntu_jdk8:latest");
|
||||||
dockerimageComponent.setMemoryLimit("1G");
|
dockerimageComponent.setMemoryLimit("1G");
|
||||||
dockerimageComponentApplier =
|
dockerimageComponentApplier =
|
||||||
new DockerimageComponentToWorkspaceApplier(
|
new DockerimageComponentToWorkspaceApplier("Never", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
||||||
PROJECTS_MOUNT_PATH, "Never", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
|
||||||
|
|
||||||
// when
|
// when
|
||||||
dockerimageComponentApplier.apply(workspaceConfig, dockerimageComponent, null);
|
dockerimageComponentApplier.apply(workspaceConfig, dockerimageComponent, null);
|
||||||
|
|
@ -484,10 +481,6 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
||||||
machinesCaptor.capture());
|
machinesCaptor.capture());
|
||||||
MachineConfigImpl machineConfig = machinesCaptor.getValue().get("jdk");
|
MachineConfigImpl machineConfig = machinesCaptor.getValue().get("jdk");
|
||||||
assertNotNull(machineConfig);
|
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
|
@Test
|
||||||
|
|
@ -578,7 +571,7 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
||||||
throws DevfileException {
|
throws DevfileException {
|
||||||
dockerimageComponentApplier =
|
dockerimageComponentApplier =
|
||||||
new DockerimageComponentToWorkspaceApplier(
|
new DockerimageComponentToWorkspaceApplier(
|
||||||
PROJECTS_MOUNT_PATH, "Always", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
"Always", MULTI_HOST_STRATEGY, k8sEnvProvisioner);
|
||||||
|
|
||||||
// given
|
// given
|
||||||
EndpointImpl endpoint = new EndpointImpl("jdk-ls", 4923, emptyMap());
|
EndpointImpl endpoint = new EndpointImpl("jdk-ls", 4923, emptyMap());
|
||||||
|
|
@ -614,7 +607,7 @@ public class DockerimageComponentToWorkspaceApplierTest {
|
||||||
public void serverCantHaveRequireSubdomainWhenSinglehostDevfileExpose() throws DevfileException {
|
public void serverCantHaveRequireSubdomainWhenSinglehostDevfileExpose() throws DevfileException {
|
||||||
dockerimageComponentApplier =
|
dockerimageComponentApplier =
|
||||||
new DockerimageComponentToWorkspaceApplier(
|
new DockerimageComponentToWorkspaceApplier(
|
||||||
PROJECTS_MOUNT_PATH, "Always", SINGLE_HOST_STRATEGY, k8sEnvProvisioner);
|
"Always", SINGLE_HOST_STRATEGY, k8sEnvProvisioner);
|
||||||
|
|
||||||
// given
|
// given
|
||||||
EndpointImpl endpoint = new EndpointImpl("jdk-ls", 4923, emptyMap());
|
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 REFERENCE_FILENAME = "reference.yaml";
|
||||||
public static final String COMPONENT_NAME = "foo";
|
public static final String COMPONENT_NAME = "foo";
|
||||||
public static final String PROJECT_MOUNT_PATH = "/projects";
|
|
||||||
|
|
||||||
private WorkspaceConfigImpl workspaceConfig;
|
private WorkspaceConfigImpl workspaceConfig;
|
||||||
|
|
||||||
|
|
@ -111,7 +110,6 @@ public class KubernetesComponentToWorkspaceApplierTest {
|
||||||
k8sRecipeParser,
|
k8sRecipeParser,
|
||||||
k8sEnvProvisioner,
|
k8sEnvProvisioner,
|
||||||
envVars,
|
envVars,
|
||||||
PROJECT_MOUNT_PATH,
|
|
||||||
"Always",
|
"Always",
|
||||||
MULTI_HOST_STRATEGY,
|
MULTI_HOST_STRATEGY,
|
||||||
k8sBasedComponents);
|
k8sBasedComponents);
|
||||||
|
|
@ -495,7 +493,6 @@ public class KubernetesComponentToWorkspaceApplierTest {
|
||||||
k8sRecipeParser,
|
k8sRecipeParser,
|
||||||
k8sEnvProvisioner,
|
k8sEnvProvisioner,
|
||||||
envVars,
|
envVars,
|
||||||
PROJECT_MOUNT_PATH,
|
|
||||||
"Never",
|
"Never",
|
||||||
MULTI_HOST_STRATEGY,
|
MULTI_HOST_STRATEGY,
|
||||||
k8sBasedComponents);
|
k8sBasedComponents);
|
||||||
|
|
@ -642,7 +639,6 @@ public class KubernetesComponentToWorkspaceApplierTest {
|
||||||
k8sRecipeParser,
|
k8sRecipeParser,
|
||||||
k8sEnvProvisioner,
|
k8sEnvProvisioner,
|
||||||
envVars,
|
envVars,
|
||||||
PROJECT_MOUNT_PATH,
|
|
||||||
"Always",
|
"Always",
|
||||||
SINGLE_HOST_STRATEGY,
|
SINGLE_HOST_STRATEGY,
|
||||||
k8sBasedComponents);
|
k8sBasedComponents);
|
||||||
|
|
@ -692,7 +688,6 @@ public class KubernetesComponentToWorkspaceApplierTest {
|
||||||
k8sRecipeParser,
|
k8sRecipeParser,
|
||||||
k8sEnvProvisioner,
|
k8sEnvProvisioner,
|
||||||
envVars,
|
envVars,
|
||||||
PROJECT_MOUNT_PATH,
|
|
||||||
"Always",
|
"Always",
|
||||||
MULTI_HOST_STRATEGY,
|
MULTI_HOST_STRATEGY,
|
||||||
k8sBasedComponents);
|
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.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.Constants.CHE_ORIGINAL_NAME_LABEL;
|
||||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.server.secure.SecureServerExposerFactoryProvider.SECURE_EXPOSER_IMPL_PROPERTY;
|
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.ArgumentMatchers.eq;
|
||||||
import static org.mockito.Mockito.lenient;
|
import static org.mockito.Mockito.lenient;
|
||||||
import static org.mockito.Mockito.spy;
|
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.InfrastructureException;
|
||||||
import org.eclipse.che.api.workspace.server.spi.environment.InternalEnvironment;
|
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.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.CheContainer;
|
||||||
import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainerPort;
|
import org.eclipse.che.api.workspace.server.wsplugins.model.CheContainerPort;
|
||||||
import org.eclipse.che.api.workspace.server.wsplugins.model.ChePlugin;
|
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.EnvVar;
|
||||||
import org.eclipse.che.api.workspace.server.wsplugins.model.Volume;
|
import org.eclipse.che.api.workspace.server.wsplugins.model.Volume;
|
||||||
import org.eclipse.che.commons.lang.NameGenerator;
|
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.Warnings;
|
||||||
import org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment;
|
import org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment;
|
||||||
import org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment.PodData;
|
import org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment.PodData;
|
||||||
|
|
@ -113,7 +110,6 @@ public class KubernetesPluginsToolingApplierTest {
|
||||||
@Mock private Container userContainer;
|
@Mock private Container userContainer;
|
||||||
@Mock private InternalMachineConfig userMachineConfig;
|
@Mock private InternalMachineConfig userMachineConfig;
|
||||||
@Mock private RuntimeIdentity runtimeIdentity;
|
@Mock private RuntimeIdentity runtimeIdentity;
|
||||||
@Mock private ProjectsRootEnvVariableProvider projectsRootEnvVariableProvider;
|
|
||||||
@Mock private ChePluginsVolumeApplier chePluginsVolumeApplier;
|
@Mock private ChePluginsVolumeApplier chePluginsVolumeApplier;
|
||||||
@Mock private EnvVars envVars;
|
@Mock private EnvVars envVars;
|
||||||
|
|
||||||
|
|
@ -132,7 +128,6 @@ public class KubernetesPluginsToolingApplierTest {
|
||||||
CPU_LIMIT,
|
CPU_LIMIT,
|
||||||
CPU_REQUEST,
|
CPU_REQUEST,
|
||||||
false,
|
false,
|
||||||
projectsRootEnvVariableProvider,
|
|
||||||
chePluginsVolumeApplier,
|
chePluginsVolumeApplier,
|
||||||
envVars);
|
envVars);
|
||||||
|
|
||||||
|
|
@ -147,10 +142,6 @@ public class KubernetesPluginsToolingApplierTest {
|
||||||
lenient().when(meta.getName()).thenReturn(POD_NAME);
|
lenient().when(meta.getName()).thenReturn(POD_NAME);
|
||||||
internalEnvironment.addPod(pod);
|
internalEnvironment.addPod(pod);
|
||||||
internalEnvironment.getMachines().putAll(machines);
|
internalEnvironment.getMachines().putAll(machines);
|
||||||
|
|
||||||
lenient()
|
|
||||||
.when(projectsRootEnvVariableProvider.get(any()))
|
|
||||||
.thenReturn(new Pair<>("projects_root", "/somewhere/over/the/rainbow"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -728,7 +719,6 @@ public class KubernetesPluginsToolingApplierTest {
|
||||||
CPU_LIMIT,
|
CPU_LIMIT,
|
||||||
CPU_REQUEST,
|
CPU_REQUEST,
|
||||||
true,
|
true,
|
||||||
projectsRootEnvVariableProvider,
|
|
||||||
chePluginsVolumeApplier,
|
chePluginsVolumeApplier,
|
||||||
envVars);
|
envVars);
|
||||||
internalEnvironment.getAttributes().put(SECURE_EXPOSER_IMPL_PROPERTY, "somethingElse");
|
internalEnvironment.getAttributes().put(SECURE_EXPOSER_IMPL_PROPERTY, "somethingElse");
|
||||||
|
|
@ -749,7 +739,6 @@ public class KubernetesPluginsToolingApplierTest {
|
||||||
CPU_LIMIT,
|
CPU_LIMIT,
|
||||||
CPU_REQUEST,
|
CPU_REQUEST,
|
||||||
true,
|
true,
|
||||||
projectsRootEnvVariableProvider,
|
|
||||||
chePluginsVolumeApplier,
|
chePluginsVolumeApplier,
|
||||||
envVars);
|
envVars);
|
||||||
|
|
||||||
|
|
@ -778,7 +767,6 @@ public class KubernetesPluginsToolingApplierTest {
|
||||||
CPU_LIMIT,
|
CPU_LIMIT,
|
||||||
CPU_REQUEST,
|
CPU_REQUEST,
|
||||||
true,
|
true,
|
||||||
projectsRootEnvVariableProvider,
|
|
||||||
chePluginsVolumeApplier,
|
chePluginsVolumeApplier,
|
||||||
envVars);
|
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
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-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.ChePluginEndpoint;
|
||||||
import org.eclipse.che.api.workspace.server.wsplugins.model.Volume;
|
import org.eclipse.che.api.workspace.server.wsplugins.model.Volume;
|
||||||
import org.eclipse.che.api.workspace.shared.Constants;
|
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.Containers;
|
||||||
import org.eclipse.che.workspace.infrastructure.kubernetes.util.KubernetesSize;
|
import org.eclipse.che.workspace.infrastructure.kubernetes.util.KubernetesSize;
|
||||||
import org.mockito.testng.MockitoTestNGListener;
|
import org.mockito.testng.MockitoTestNGListener;
|
||||||
|
|
@ -75,7 +74,6 @@ public class MachineResolverTest {
|
||||||
component = new ComponentImpl("chePlugin", PLUGIN_ID);
|
component = new ComponentImpl("chePlugin", PLUGIN_ID);
|
||||||
resolver =
|
resolver =
|
||||||
new MachineResolver(
|
new MachineResolver(
|
||||||
new Pair<>(PROJECTS_ENV_VAR, PROJECTS_MOUNT_PATH),
|
|
||||||
container,
|
container,
|
||||||
cheContainer,
|
cheContainer,
|
||||||
DEFAULT_MEM_LIMIT,
|
DEFAULT_MEM_LIMIT,
|
||||||
|
|
@ -269,17 +267,6 @@ public class MachineResolverTest {
|
||||||
resolver.resolve();
|
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
|
@Test
|
||||||
public void shouldAddVolumesFromDevfileComponent() throws InfrastructureException {
|
public void shouldAddVolumesFromDevfileComponent() throws InfrastructureException {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ public class OpenshiftComponentToWorkspaceApplier extends KubernetesComponentToW
|
||||||
KubernetesRecipeParser objectsParser,
|
KubernetesRecipeParser objectsParser,
|
||||||
KubernetesEnvironmentProvisioner k8sEnvProvisioner,
|
KubernetesEnvironmentProvisioner k8sEnvProvisioner,
|
||||||
EnvVars envVars,
|
EnvVars envVars,
|
||||||
@Named("che.workspace.projects.storage") String projectFolderPath,
|
|
||||||
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
|
@Named("che.workspace.sidecar.image_pull_policy") String imagePullPolicy,
|
||||||
@Named("che.infra.kubernetes.singlehost.workspace.devfile_endpoint_exposure")
|
@Named("che.infra.kubernetes.singlehost.workspace.devfile_endpoint_exposure")
|
||||||
String devfileEndpointsExposure,
|
String devfileEndpointsExposure,
|
||||||
|
|
@ -38,7 +37,6 @@ public class OpenshiftComponentToWorkspaceApplier extends KubernetesComponentToW
|
||||||
k8sEnvProvisioner,
|
k8sEnvProvisioner,
|
||||||
envVars,
|
envVars,
|
||||||
OpenShiftEnvironment.TYPE,
|
OpenShiftEnvironment.TYPE,
|
||||||
projectFolderPath,
|
|
||||||
imagePullPolicy,
|
imagePullPolicy,
|
||||||
devfileEndpointsExposure,
|
devfileEndpointsExposure,
|
||||||
kubernetesBasedComponentTypes);
|
kubernetesBasedComponentTypes);
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,6 @@ public class OpenshiftComponentToWorkspaceApplierTest {
|
||||||
k8sRecipeParser,
|
k8sRecipeParser,
|
||||||
k8sEnvProvisioner,
|
k8sEnvProvisioner,
|
||||||
envVars,
|
envVars,
|
||||||
"/projects",
|
|
||||||
"Always",
|
"Always",
|
||||||
MULTI_HOST_STRATEGY,
|
MULTI_HOST_STRATEGY,
|
||||||
k8sBasedComponents);
|
k8sBasedComponents);
|
||||||
|
|
@ -114,7 +113,6 @@ public class OpenshiftComponentToWorkspaceApplierTest {
|
||||||
k8sRecipeParser,
|
k8sRecipeParser,
|
||||||
k8sEnvProvisioner,
|
k8sEnvProvisioner,
|
||||||
envVars,
|
envVars,
|
||||||
"/projects",
|
|
||||||
"Always",
|
"Always",
|
||||||
SINGLE_HOST_STRATEGY,
|
SINGLE_HOST_STRATEGY,
|
||||||
openshiftBasedComponents);
|
openshiftBasedComponents);
|
||||||
|
|
@ -166,7 +164,6 @@ public class OpenshiftComponentToWorkspaceApplierTest {
|
||||||
k8sRecipeParser,
|
k8sRecipeParser,
|
||||||
k8sEnvProvisioner,
|
k8sEnvProvisioner,
|
||||||
envVars,
|
envVars,
|
||||||
"/projects",
|
|
||||||
"Always",
|
"Always",
|
||||||
MULTI_HOST_STRATEGY,
|
MULTI_HOST_STRATEGY,
|
||||||
openshiftBasedComponents);
|
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