CHE-6085: Add posibility to choose WS infra impl
Environment variable CHE_INFRASTRUCTURE_ACTIVE sets which implementation of workspace runtime infrastructure is used in Che. Notice that corresponding property does not work - only env var. Signed-off-by: Oleksandr Garagatyi <ogaragat@redhat.com>6.19.x
parent
86a8540673
commit
bd723b849a
|
|
@ -41,14 +41,14 @@ import org.eclipse.che.api.workspace.server.RemoveWorkspaceFilesAfterRemoveWorks
|
|||
import org.eclipse.che.api.workspace.server.adapter.StackMessageBodyAdapter;
|
||||
import org.eclipse.che.api.workspace.server.adapter.WorkspaceConfigMessageBodyAdapter;
|
||||
import org.eclipse.che.api.workspace.server.adapter.WorkspaceMessageBodyAdapter;
|
||||
import org.eclipse.che.api.workspace.server.hc.ServerCheckerFactory;
|
||||
import org.eclipse.che.api.workspace.server.hc.ServerCheckerFactoryImpl;
|
||||
import org.eclipse.che.api.workspace.server.stack.StackLoader;
|
||||
import org.eclipse.che.core.db.schema.SchemaInitializer;
|
||||
import org.eclipse.che.inject.DynaModule;
|
||||
import org.eclipse.che.plugin.github.factory.resolver.GithubFactoryParametersResolver;
|
||||
import org.eclipse.che.workspace.infrastructure.docker.DockerInfraModule;
|
||||
import org.eclipse.che.workspace.infrastructure.docker.local.LocalDockerModule;
|
||||
import org.eclipse.che.workspace.infrastructure.docker.snapshot.JpaSnapshotDao;
|
||||
import org.eclipse.che.workspace.infrastructure.docker.snapshot.SnapshotDao;
|
||||
import org.eclipse.che.workspace.infrastructure.openshift.OpenShiftInfraModule;
|
||||
import org.flywaydb.core.internal.util.PlaceholderReplacer;
|
||||
|
||||
|
|
@ -62,10 +62,7 @@ public class WsMasterModule extends AbstractModule {
|
|||
install(new org.eclipse.che.account.api.AccountModule());
|
||||
install(new org.eclipse.che.api.user.server.jpa.UserJpaModule());
|
||||
install(new org.eclipse.che.api.ssh.server.jpa.SshJpaModule());
|
||||
// install(new org.eclipse.che.api.machine.server.jpa.MachineJpaModule());
|
||||
bind(RecipeDao.class).to(JpaRecipeDao.class);
|
||||
// TODO spi move into docker infra impl
|
||||
bind(SnapshotDao.class).to(JpaSnapshotDao.class);
|
||||
install(new org.eclipse.che.api.workspace.server.jpa.WorkspaceJpaModule());
|
||||
install(new org.eclipse.che.api.core.jsonrpc.impl.JsonRpcModule());
|
||||
install(new org.eclipse.che.api.core.websocket.impl.WebSocketModule());
|
||||
|
|
@ -135,7 +132,6 @@ public class WsMasterModule extends AbstractModule {
|
|||
.asEagerSingleton();
|
||||
bind(org.eclipse.che.api.workspace.server.event.MachineLogJsonRpcMessenger.class)
|
||||
.asEagerSingleton();
|
||||
//
|
||||
|
||||
bind(org.eclipse.che.security.oauth.OAuthAuthenticatorProvider.class)
|
||||
.to(org.eclipse.che.security.oauth.OAuthAuthenticatorProviderImpl.class);
|
||||
|
|
@ -153,7 +149,6 @@ public class WsMasterModule extends AbstractModule {
|
|||
|
||||
// installers
|
||||
install(new InstallerModule());
|
||||
|
||||
binder().bind(new TypeLiteral<Set<Installer>>() {}).toProvider(InstallersProvider.class);
|
||||
|
||||
bind(org.eclipse.che.api.deploy.WsMasterAnalyticsAddresser.class);
|
||||
|
|
@ -184,10 +179,14 @@ public class WsMasterModule extends AbstractModule {
|
|||
// bind(org.eclipse.che.api.agent.server.filters.AddExecInstallerInWorkspaceFilter.class);
|
||||
// bind(org.eclipse.che.api.agent.server.filters.AddExecInstallerInStackFilter.class);
|
||||
|
||||
// FIXME: spi
|
||||
install(new DockerInfraModule());
|
||||
install(new LocalDockerModule());
|
||||
install(new OpenShiftInfraModule());
|
||||
String infrastructure = System.getenv("CHE_INFRASTRUCTURE_ACTIVE");
|
||||
if ("openshift".equals(infrastructure)) {
|
||||
install(new OpenShiftInfraModule());
|
||||
} else {
|
||||
install(new LocalDockerModule());
|
||||
install(new DockerInfraModule());
|
||||
}
|
||||
bind(RemoveWorkspaceFilesAfterRemoveWorkspaceEventSubscriber.class).asEagerSingleton();
|
||||
bind(ServerCheckerFactory.class).to(ServerCheckerFactoryImpl.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ package org.eclipse.che.workspace.infrastructure.docker;
|
|||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.assistedinject.FactoryModuleBuilder;
|
||||
import com.google.inject.multibindings.Multibinder;
|
||||
import org.eclipse.che.api.workspace.server.hc.ServerCheckerFactory;
|
||||
import org.eclipse.che.api.workspace.server.hc.ServerCheckerFactoryImpl;
|
||||
import org.eclipse.che.api.workspace.server.spi.RuntimeInfrastructure;
|
||||
import org.eclipse.che.plugin.docker.client.DockerRegistryDynamicAuthResolver;
|
||||
import org.eclipse.che.plugin.docker.client.NoOpDockerRegistryDynamicAuthResolverImpl;
|
||||
|
|
@ -33,6 +31,8 @@ import org.eclipse.che.workspace.infrastructure.docker.provisioner.priviliged.Pr
|
|||
import org.eclipse.che.workspace.infrastructure.docker.provisioner.proxy.ProxySettingsProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.docker.provisioner.server.ServersEnvVarsProvisioningModule;
|
||||
import org.eclipse.che.workspace.infrastructure.docker.provisioner.volume.ExtraVolumesProvisioner;
|
||||
import org.eclipse.che.workspace.infrastructure.docker.snapshot.JpaSnapshotDao;
|
||||
import org.eclipse.che.workspace.infrastructure.docker.snapshot.SnapshotDao;
|
||||
|
||||
/** @author Alexander Garagatyi */
|
||||
public class DockerInfraModule extends AbstractModule {
|
||||
|
|
@ -66,6 +66,6 @@ public class DockerInfraModule extends AbstractModule {
|
|||
install(new FactoryModuleBuilder().build(DockerBootstrapperFactory.class));
|
||||
install(new FactoryModuleBuilder().build(DockerRuntimeContextFactory.class));
|
||||
|
||||
bind(ServerCheckerFactory.class).to(ServerCheckerFactoryImpl.class);
|
||||
bind(SnapshotDao.class).to(JpaSnapshotDao.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ package org.eclipse.che.workspace.infrastructure.openshift;
|
|||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.assistedinject.FactoryModuleBuilder;
|
||||
import com.google.inject.multibindings.Multibinder;
|
||||
import org.eclipse.che.api.workspace.server.WorkspaceFilesCleaner;
|
||||
import org.eclipse.che.api.workspace.server.spi.RuntimeInfrastructure;
|
||||
import org.eclipse.che.workspace.infrastructure.openshift.bootstrapper.OpenShiftBootstrapperFactory;
|
||||
|
||||
|
|
@ -30,5 +31,6 @@ public class OpenShiftInfraModule extends AbstractModule {
|
|||
install(new FactoryModuleBuilder().build(OpenShiftRuntimeContextFactory.class));
|
||||
install(new FactoryModuleBuilder().build(OpenShiftRuntimeFactory.class));
|
||||
install(new FactoryModuleBuilder().build(OpenShiftBootstrapperFactory.class));
|
||||
bind(WorkspaceFilesCleaner.class).to(WorkspaceFilesCleaner.NoOpCleaner.class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,4 +28,10 @@ public interface WorkspaceFilesCleaner {
|
|||
* @param workspace workspace to clean up files
|
||||
*/
|
||||
void clear(Workspace workspace) throws IOException, ServerException;
|
||||
|
||||
/** An implementation which do nothing on workspace cleanup call. */
|
||||
class NoOpCleaner implements WorkspaceFilesCleaner {
|
||||
@Override
|
||||
public void clear(Workspace workspace) throws IOException, ServerException {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue