CHE-6463 Exclude docker infrastructure from multiuser packaging

6.19.x
Sergii Leshchenko 2017-09-27 14:59:10 +03:00
parent 861f4eccbb
commit d207193377
8 changed files with 18 additions and 264 deletions

View File

@ -103,14 +103,14 @@
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-activity-wsmaster</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.eclipse.che.plugin</groupId>-->
<!--<artifactId>che-plugin-docker-machine-auth</artifactId>-->
<!--</dependency>-->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che</groupId>
<artifactId>infrastructure-openshift</artifactId>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -25,12 +25,15 @@ import org.eclipse.che.multiuser.organization.api.OrganizationJpaModule;
import org.eclipse.che.multiuser.resource.api.ResourceModule;
import org.eclipse.che.security.PBKDF2PasswordEncryptor;
import org.eclipse.che.security.PasswordEncryptor;
import org.eclipse.che.workspace.infrastructure.openshift.OpenShiftInfraModule;
@DynaModule
public class MultiUserCheWsMasterModule extends AbstractModule {
@Override
protected void configure() {
install(new OpenShiftInfraModule());
bind(DataSource.class).toProvider(org.eclipse.che.core.db.JndiDataSourceProvider.class);
install(new org.eclipse.che.multiuser.api.permission.server.jpa.SystemPermissionsJpaModule());
install(new org.eclipse.che.multiuser.api.permission.server.PermissionsModule());

View File

@ -14,6 +14,9 @@ import com.google.inject.AbstractModule;
import javax.sql.DataSource;
import org.eclipse.che.api.user.server.TokenValidator;
import org.eclipse.che.inject.DynaModule;
import org.eclipse.che.workspace.infrastructure.docker.DockerInfraModule;
import org.eclipse.che.workspace.infrastructure.docker.local.LocalDockerModule;
import org.eclipse.che.workspace.infrastructure.openshift.OpenShiftInfraModule;
/**
* Single-user version Che specific bindings
@ -25,6 +28,14 @@ public class CheWsMasterModule extends AbstractModule {
@Override
protected void configure() {
String infrastructure = System.getenv("CHE_INFRASTRUCTURE_ACTIVE");
if ("openshift".equals(infrastructure)) {
install(new OpenShiftInfraModule());
} else {
install(new LocalDockerModule());
install(new DockerInfraModule());
}
bind(TokenValidator.class).to(org.eclipse.che.api.local.DummyTokenValidator.class);
bind(org.eclipse.che.api.workspace.server.stack.StackLoader.class);

View File

@ -167,13 +167,6 @@ 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);
String infrastructure = System.getenv("CHE_INFRASTRUCTURE_ACTIVE");
if ("openshift".equals(infrastructure)) {
install(new OpenShiftInfraModule());
} else {
install(new LocalDockerModule());
install(new DockerInfraModule());
}
bind(ServerCheckerFactory.class).to(ServerCheckerFactoryImpl.class);
}
}

View File

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012-2017 Red Hat, Inc.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Red Hat, Inc. - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>che-plugin-docker-parent</artifactId>
<groupId>org.eclipse.che.plugin</groupId>
<version>5.19.0-SNAPSHOT</version>
</parent>
<artifactId>che-plugin-docker-machine-auth</artifactId>
<packaging>jar</packaging>
<name>Che Plugin :: Docker :: Machine Auth</name>
<properties>
<findbugs.failonerror>false</findbugs.failonerror>
</properties>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-model</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-lang</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.multiuser</groupId>
<artifactId>che-multiuser-machine-authentication</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-docker-client</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-docker-machine</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-dto</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockitong</groupId>
<artifactId>mockitong</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/integration/**</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<excludes>
<!-- Exclude files until #3281 is resolved -->
<exclude>**/ServerEvaluationStrategyProvider.java</exclude>
<exclude>**/ServerEvaluationStrategy.java</exclude>
<exclude>**/ServerEvaluationStrategyTest.java</exclude>
<exclude>**/DefaultServerEvaluationStrategy.java</exclude>
<exclude>**/DefaultServerEvaluationStrategyTest.java</exclude>
<exclude>**/LocalDockerServerEvaluationStrategy.java</exclude>
<exclude>**/LocalDockerServerEvaluationStrategyTest.java</exclude>
<exclude>**/LocalDockerCustomServerEvaluationStrategy.java</exclude>
<exclude>**/LocalDockerCustomServerEvaluationStrategyTest.java</exclude>
<exclude>**/DockerInstanceRuntimeInfo.java</exclude>
<exclude>**/DockerInstanceRuntimeInfoTest.java</exclude>
<!-- End excluded files -->
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,113 +0,0 @@
/*
* Copyright (c) 2012-2017 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/
package org.eclipse.che.plugin.docker.machine;
import com.google.common.base.MoreObjects;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.che.api.core.NotFoundException;
import org.eclipse.che.api.core.jsonrpc.commons.RequestTransmitter;
import org.eclipse.che.api.core.model.machine.ServerConf;
import org.eclipse.che.api.core.util.JsonRpcEndpointToMachineNameHolder;
import org.eclipse.che.api.machine.server.spi.Instance;
import org.eclipse.che.commons.annotation.Nullable;
import org.eclipse.che.commons.env.EnvironmentContext;
import org.eclipse.che.commons.lang.os.WindowsPathEscaper;
import org.eclipse.che.multiuser.machine.authentication.server.MachineTokenRegistry;
import org.eclipse.che.plugin.docker.client.DockerConnectorProvider;
import org.eclipse.che.plugin.docker.client.UserSpecificDockerRegistryCredentialsProvider;
/**
* Creates/destroys docker networks and creates docker compose based {@link Instance}.
*
* @author Alexander Garagatyi
*/
public class AuthMachineProviderImpl extends MachineProviderImpl {
private final MachineTokenRegistry machineTokenRegistry;
@Inject
public AuthMachineProviderImpl(
DockerConnectorProvider dockerConnectorProvider,
UserSpecificDockerRegistryCredentialsProvider dockerCredentials,
DockerMachineFactory dockerMachineFactory,
DockerInstanceStopDetector dockerInstanceStopDetector,
WindowsPathEscaper windowsPathEscaper,
RequestTransmitter requestTransmitter,
MachineTokenRegistry machineTokenRegistry,
JsonRpcEndpointToMachineNameHolder endpointIdsHolder,
@Named("machine.docker.dev_machine.machine_servers") Set<ServerConf> devMachineServers,
@Named("machine.docker.machine_servers") Set<ServerConf> allMachinesServers,
@Named("machine.docker.dev_machine.machine_volumes") Set<String> devMachineSystemVolumes,
@Named("machine.docker.machine_volumes") Set<String> allMachinesSystemVolumes,
@Named("che.docker.always_pull_image") boolean doForcePullOnBuild,
@Named("che.docker.privileged") boolean privilegedMode,
@Named("che.docker.pids_limit") int pidsLimit,
@Named("machine.docker.dev_machine.machine_env") Set<String> devMachineEnvVariables,
@Named("machine.docker.machine_env") Set<String> allMachinesEnvVariables,
@Named("che.docker.registry_for_snapshots") boolean snapshotUseRegistry,
@Named("che.docker.swap") double memorySwapMultiplier,
@Named("machine.docker.networks") Set<Set<String>> additionalNetworks,
@Nullable @Named("che.docker.network_driver") String networkDriver,
@Nullable @Named("che.docker.parent_cgroup") String parentCgroup,
@Nullable @Named("che.docker.cpuset_cpus") String cpusetCpus,
@Named("che.docker.cpu_period") long cpuPeriod,
@Named("che.docker.cpu_quota") long cpuQuota,
@Named("che.docker.extra_hosts") Set<Set<String>> additionalHosts,
@Nullable @Named("che.docker.dns_resolvers") String[] dnsResolvers,
@Named("che.docker.build_args") Map<String, String> buildArgs)
throws IOException {
super(
dockerConnectorProvider,
dockerCredentials,
dockerMachineFactory,
dockerInstanceStopDetector,
requestTransmitter,
endpointIdsHolder,
devMachineServers,
allMachinesServers,
devMachineSystemVolumes,
allMachinesSystemVolumes,
doForcePullOnBuild,
privilegedMode,
pidsLimit,
devMachineEnvVariables,
allMachinesEnvVariables,
snapshotUseRegistry,
memorySwapMultiplier,
additionalNetworks,
networkDriver,
parentCgroup,
cpusetCpus,
cpuPeriod,
cpuQuota,
windowsPathEscaper,
additionalHosts,
dnsResolvers,
buildArgs);
this.machineTokenRegistry = machineTokenRegistry;
}
@Override
protected String getUserToken(String wsId) {
String userToken = null;
try {
userToken =
machineTokenRegistry.getOrCreateToken(
EnvironmentContext.getCurrent().getSubject().getUserId(), wsId);
} catch (NotFoundException ignore) {
}
return MoreObjects.firstNonNull(userToken, "");
}
}

View File

@ -24,7 +24,6 @@
<name>Che Plugin :: Docker :: Parent</name>
<modules>
<module>che-plugin-docker-client</module>
<!--<module>che-plugin-docker-machine-auth</module>-->
<module>che-plugin-openshift-client</module>
</modules>
<properties>

View File

@ -897,11 +897,6 @@
<artifactId>che-plugin-docker-machine</artifactId>
<version>${che.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-docker-machine-auth</artifactId>
<version>${che.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-ext-dashboard-client</artifactId>