chore: remove che.workspace.logs.root_dir property
Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>pull/378/head
parent
f3700dba05
commit
0c3afb1f22
|
|
@ -29,12 +29,6 @@ che.websocket.endpoint=ws://${CHE_HOST}:${CHE_PORT}/api/websocket
|
|||
# for major WebSocket interactions and messaging.
|
||||
che.websocket.internal.endpoint=NULL
|
||||
|
||||
|
||||
# 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.
|
||||
# This is to ensure that agent developers can use this directory to back up agent logs.
|
||||
che.workspace.logs.root_dir=/workspace_logs
|
||||
|
||||
# Configures environment variable HTTP_PROXY to a specified value in containers powering workspaces.
|
||||
che.workspace.http_proxy=
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import org.eclipse.che.api.workspace.server.spi.RuntimeInfrastructure;
|
|||
import org.eclipse.che.api.workspace.server.spi.environment.InternalEnvironmentFactory;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.CheApiExternalEnvVarProvider;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.CheApiInternalEnvVarProvider;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.EnvVarProvider;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.ChePluginsApplier;
|
||||
import org.eclipse.che.api.workspace.shared.Constants;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.api.server.KubernetesNamespaceService;
|
||||
|
|
@ -63,7 +62,6 @@ import org.eclipse.che.workspace.infrastructure.kubernetes.provision.KubernetesT
|
|||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.PreviewUrlCommandProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.TlsProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.TrustedCAProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.env.LogsRootEnvVariableProvider;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.server.ServersConverter;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.server.IngressAnnotationsProvider;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.server.PreviewUrlExposer;
|
||||
|
|
@ -188,10 +186,6 @@ public class KubernetesInfraModule extends AbstractModule {
|
|||
bind(PreviewUrlCommandProvisioner.class)
|
||||
.to(new TypeLiteral<KubernetesPreviewUrlCommandProvisioner>() {});
|
||||
|
||||
Multibinder<EnvVarProvider> envVarProviders =
|
||||
Multibinder.newSetBinder(binder(), EnvVarProvider.class);
|
||||
envVarProviders.addBinding().to(LogsRootEnvVariableProvider.class);
|
||||
|
||||
bind(new TypeLiteral<Map<String, String>>() {})
|
||||
.annotatedWith(named("infra.kubernetes.ingress.annotations"))
|
||||
.toProvider(IngressAnnotationsProvider.class);
|
||||
|
|
|
|||
|
|
@ -1,50 +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.workspace.infrastructure.kubernetes.provision;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
|
||||
import org.eclipse.che.api.workspace.server.model.impl.VolumeImpl;
|
||||
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
|
||||
import org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig;
|
||||
import org.eclipse.che.commons.annotation.Traced;
|
||||
import org.eclipse.che.commons.tracing.TracingTags;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.environment.KubernetesEnvironment;
|
||||
|
||||
/**
|
||||
* Adds to each machine inside environment volume with logs root.
|
||||
*
|
||||
* @author Anton Korneta
|
||||
*/
|
||||
public class LogsVolumeMachineProvisioner implements ConfigurationProvisioner {
|
||||
public static final String LOGS_VOLUME_NAME = "che-logs";
|
||||
|
||||
private final String logsRootPath;
|
||||
|
||||
@Inject
|
||||
public LogsVolumeMachineProvisioner(@Named("che.workspace.logs.root_dir") String logsRootPath) {
|
||||
this.logsRootPath = logsRootPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Traced
|
||||
public void provision(KubernetesEnvironment environment, RuntimeIdentity identity)
|
||||
throws InfrastructureException {
|
||||
|
||||
TracingTags.WORKSPACE_ID.set(identity::getWorkspaceId);
|
||||
|
||||
for (InternalMachineConfig machine : environment.getMachines().values()) {
|
||||
machine.getVolumes().put(LOGS_VOLUME_NAME, new VolumeImpl().withPath(logsRootPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +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.workspace.infrastructure.kubernetes.provision.env;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
|
||||
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.EnvVarProvider;
|
||||
import org.eclipse.che.commons.lang.Pair;
|
||||
|
||||
/**
|
||||
* Add env variable to machines with path to root folder of workspace logs.
|
||||
*
|
||||
* @author Anton Korneta
|
||||
*/
|
||||
public class LogsRootEnvVariableProvider implements EnvVarProvider {
|
||||
|
||||
/** Environment variable that points to root folder of projects inside machine */
|
||||
public static final String WORKSPACE_LOGS_ROOT_ENV_VAR = "CHE_WORKSPACE_LOGS_ROOT__DIR";
|
||||
|
||||
private String logsRootPath;
|
||||
|
||||
@Inject
|
||||
public LogsRootEnvVariableProvider(@Named("che.workspace.logs.root_dir") String logsRootPath) {
|
||||
this.logsRootPath = logsRootPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pair<String, String> get(RuntimeIdentity identity) throws InfrastructureException {
|
||||
return Pair.of(WORKSPACE_LOGS_ROOT_ENV_VAR, logsRootPath);
|
||||
}
|
||||
}
|
||||
|
|
@ -23,7 +23,6 @@ import org.eclipse.che.workspace.infrastructure.kubernetes.provision.GatewayRout
|
|||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.GitConfigProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.ImagePullSecretProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.KubernetesTrustedCAProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.LogsVolumeMachineProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.NodeSelectorProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.PodTerminationGracePeriodProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner;
|
||||
|
|
@ -62,7 +61,6 @@ public class KubernetesEnvironmentProvisionerTest {
|
|||
@Mock private ServersConverter<KubernetesEnvironment> serversProvisioner;
|
||||
@Mock private RestartPolicyRewriter restartPolicyRewriter;
|
||||
@Mock private ContainerResourceProvisioner ramLimitProvisioner;
|
||||
@Mock private LogsVolumeMachineProvisioner logsVolumeMachineProvisioner;
|
||||
@Mock private SecurityContextProvisioner securityContextProvisioner;
|
||||
@Mock private PodTerminationGracePeriodProvisioner podTerminationGracePeriodProvisioner;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,51 +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.workspace.infrastructure.kubernetes.provision.env;
|
||||
|
||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.provision.env.LogsRootEnvVariableProvider.WORKSPACE_LOGS_ROOT_ENV_VAR;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
|
||||
import org.eclipse.che.commons.lang.Pair;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.testng.MockitoTestNGListener;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Listeners;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests {@link LogsRootEnvVariableProvider}.
|
||||
*
|
||||
* @author Anton Korneta
|
||||
*/
|
||||
@Listeners(MockitoTestNGListener.class)
|
||||
public class LogsRootEnvVariableProviderTest {
|
||||
|
||||
private static final String WORKSPACE_LOGS_ROOT_PATH = "/workspace_logs";
|
||||
|
||||
@Mock private RuntimeIdentity identity;
|
||||
|
||||
private LogsRootEnvVariableProvider logsRootEnvVariableProvider;
|
||||
|
||||
@BeforeMethod
|
||||
public void setup() {
|
||||
logsRootEnvVariableProvider = new LogsRootEnvVariableProvider(WORKSPACE_LOGS_ROOT_PATH);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProviderReturnsLogsEnvironmentVariable() throws Exception {
|
||||
final Pair<String, String> eVar = logsRootEnvVariableProvider.get(identity);
|
||||
|
||||
assertEquals(eVar.first, WORKSPACE_LOGS_ROOT_ENV_VAR);
|
||||
assertEquals(eVar.second, WORKSPACE_LOGS_ROOT_PATH);
|
||||
}
|
||||
}
|
||||
|
|
@ -23,7 +23,6 @@ import org.eclipse.che.workspace.infrastructure.kubernetes.provision.DeploymentM
|
|||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.GatewayRouterProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.GitConfigProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.ImagePullSecretProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.LogsVolumeMachineProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.NodeSelectorProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.PodTerminationGracePeriodProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner;
|
||||
|
|
@ -65,7 +64,6 @@ public class OpenShiftEnvironmentProvisioner
|
|||
private final EnvVarsConverter envVarsConverter;
|
||||
private final RestartPolicyRewriter restartPolicyRewriter;
|
||||
private final ContainerResourceProvisioner resourceLimitRequestProvisioner;
|
||||
private final LogsVolumeMachineProvisioner logsVolumeMachineProvisioner;
|
||||
private final PodTerminationGracePeriodProvisioner podTerminationGracePeriodProvisioner;
|
||||
private final ImagePullSecretProvisioner imagePullSecretProvisioner;
|
||||
private final ProxySettingsProvisioner proxySettingsProvisioner;
|
||||
|
|
@ -89,7 +87,6 @@ public class OpenShiftEnvironmentProvisioner
|
|||
EnvVarsConverter envVarsConverter,
|
||||
RestartPolicyRewriter restartPolicyRewriter,
|
||||
ContainerResourceProvisioner resourceLimitRequestProvisioner,
|
||||
LogsVolumeMachineProvisioner logsVolumeMachineProvisioner,
|
||||
PodTerminationGracePeriodProvisioner podTerminationGracePeriodProvisioner,
|
||||
ImagePullSecretProvisioner imagePullSecretProvisioner,
|
||||
ProxySettingsProvisioner proxySettingsProvisioner,
|
||||
|
|
@ -110,7 +107,6 @@ public class OpenShiftEnvironmentProvisioner
|
|||
this.envVarsConverter = envVarsConverter;
|
||||
this.restartPolicyRewriter = restartPolicyRewriter;
|
||||
this.resourceLimitRequestProvisioner = resourceLimitRequestProvisioner;
|
||||
this.logsVolumeMachineProvisioner = logsVolumeMachineProvisioner;
|
||||
this.podTerminationGracePeriodProvisioner = podTerminationGracePeriodProvisioner;
|
||||
this.imagePullSecretProvisioner = imagePullSecretProvisioner;
|
||||
this.proxySettingsProvisioner = proxySettingsProvisioner;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import org.eclipse.che.api.workspace.server.spi.RuntimeInfrastructure;
|
|||
import org.eclipse.che.api.workspace.server.spi.environment.InternalEnvironmentFactory;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.CheApiExternalEnvVarProvider;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.CheApiInternalEnvVarProvider;
|
||||
import org.eclipse.che.api.workspace.server.spi.provision.env.EnvVarProvider;
|
||||
import org.eclipse.che.api.workspace.server.wsplugins.ChePluginsApplier;
|
||||
import org.eclipse.che.api.workspace.shared.Constants;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.InconsistentRuntimesDetector;
|
||||
|
|
@ -63,7 +62,6 @@ import org.eclipse.che.workspace.infrastructure.kubernetes.provision.KubernetesC
|
|||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.PreviewUrlCommandProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.TlsProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.TrustedCAProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.env.LogsRootEnvVariableProvider;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.server.ServersConverter;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.server.PreviewUrlExposer;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.server.WorkspaceExposureType;
|
||||
|
|
@ -165,10 +163,6 @@ public class OpenShiftInfraModule extends AbstractModule {
|
|||
bind(PreviewUrlCommandProvisioner.class)
|
||||
.to(new TypeLiteral<OpenShiftPreviewUrlCommandProvisioner>() {});
|
||||
|
||||
Multibinder<EnvVarProvider> envVarProviders =
|
||||
Multibinder.newSetBinder(binder(), EnvVarProvider.class);
|
||||
envVarProviders.addBinding().to(LogsRootEnvVariableProvider.class);
|
||||
|
||||
install(new JpaKubernetesRuntimeCacheModule());
|
||||
|
||||
Multibinder.newSetBinder(binder(), ServiceTermination.class)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import org.eclipse.che.workspace.infrastructure.kubernetes.provision.DeploymentM
|
|||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.GatewayRouterProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.GitConfigProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.ImagePullSecretProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.LogsVolumeMachineProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.NodeSelectorProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.PodTerminationGracePeriodProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.ProxySettingsProvisioner;
|
||||
|
|
@ -63,7 +62,6 @@ public class OpenShiftEnvironmentProvisionerTest {
|
|||
@Mock private ServersConverter<OpenShiftEnvironment> serversProvisioner;
|
||||
@Mock private RestartPolicyRewriter restartPolicyRewriter;
|
||||
@Mock private ContainerResourceProvisioner ramLimitProvisioner;
|
||||
@Mock private LogsVolumeMachineProvisioner logsVolumeMachineProvisioner;
|
||||
@Mock private PodTerminationGracePeriodProvisioner podTerminationGracePeriodProvisioner;
|
||||
@Mock private ImagePullSecretProvisioner imagePullSecretProvisioner;
|
||||
@Mock private ProxySettingsProvisioner proxySettingsProvisioner;
|
||||
|
|
@ -94,7 +92,6 @@ public class OpenShiftEnvironmentProvisionerTest {
|
|||
envVarsProvisioner,
|
||||
restartPolicyRewriter,
|
||||
ramLimitProvisioner,
|
||||
logsVolumeMachineProvisioner,
|
||||
podTerminationGracePeriodProvisioner,
|
||||
imagePullSecretProvisioner,
|
||||
proxySettingsProvisioner,
|
||||
|
|
@ -111,7 +108,6 @@ public class OpenShiftEnvironmentProvisionerTest {
|
|||
trustedCAProvisioner);
|
||||
provisionOrder =
|
||||
inOrder(
|
||||
logsVolumeMachineProvisioner,
|
||||
serversProvisioner,
|
||||
envVarsProvisioner,
|
||||
uniqueNamesProvisioner,
|
||||
|
|
|
|||
|
|
@ -1,70 +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.workspace.infrastructure.openshift.provision;
|
||||
|
||||
import static org.eclipse.che.workspace.infrastructure.kubernetes.provision.LogsVolumeMachineProvisioner.LOGS_VOLUME_NAME;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.HashMap;
|
||||
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
|
||||
import org.eclipse.che.api.workspace.server.spi.environment.InternalMachineConfig;
|
||||
import org.eclipse.che.workspace.infrastructure.kubernetes.provision.LogsVolumeMachineProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.openshift.environment.OpenShiftEnvironment;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.testng.MockitoTestNGListener;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Listeners;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Tests {@link LogsVolumeMachineProvisioner}.
|
||||
*
|
||||
* @author Anton Korneta
|
||||
*/
|
||||
@Listeners(MockitoTestNGListener.class)
|
||||
public class LogsVolumeMachineProvisionerTest {
|
||||
|
||||
private static final String WORKSPACE_LOGS_ROOT_PATH = "/workspace_logs";
|
||||
private static final String MACHINE_NAME_1 = "web/main";
|
||||
private static final String MACHINE_NAME_2 = "db/main";
|
||||
|
||||
@Mock private OpenShiftEnvironment openShiftEnvironment;
|
||||
@Mock private RuntimeIdentity identity;
|
||||
@Mock private InternalMachineConfig machine1;
|
||||
@Mock private InternalMachineConfig machine2;
|
||||
|
||||
private LogsVolumeMachineProvisioner logsVolumeProvisioner;
|
||||
|
||||
@BeforeMethod
|
||||
public void setup() {
|
||||
logsVolumeProvisioner = new LogsVolumeMachineProvisioner(WORKSPACE_LOGS_ROOT_PATH);
|
||||
when(machine1.getVolumes()).thenReturn(new HashMap<>());
|
||||
when(machine2.getVolumes()).thenReturn(new HashMap<>());
|
||||
when(openShiftEnvironment.getMachines())
|
||||
.thenReturn(ImmutableMap.of(MACHINE_NAME_1, machine1, MACHINE_NAME_2, machine2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProvisionLogsVolumeToAllMachineInEnvironment() throws Exception {
|
||||
logsVolumeProvisioner.provision(openShiftEnvironment, identity);
|
||||
|
||||
InternalMachineConfig m1 = openShiftEnvironment.getMachines().get(MACHINE_NAME_1);
|
||||
InternalMachineConfig m2 = openShiftEnvironment.getMachines().get(MACHINE_NAME_2);
|
||||
assertTrue(m1.getVolumes().containsKey(LOGS_VOLUME_NAME));
|
||||
assertEquals(m1.getVolumes().get(LOGS_VOLUME_NAME).getPath(), WORKSPACE_LOGS_ROOT_PATH);
|
||||
assertTrue(m2.getVolumes().containsKey(LOGS_VOLUME_NAME));
|
||||
assertEquals(m2.getVolumes().get(LOGS_VOLUME_NAME).getPath(), WORKSPACE_LOGS_ROOT_PATH);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue