-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bab2074
commit ecdbe88
Showing
24 changed files
with
1,407 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2012-2017 Codenvy, S.A. | ||
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: | ||
Codenvy, S.A. - 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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>che-infrastructures-parent</artifactId> | ||
<groupId>org.eclipse.che</groupId> | ||
<version>5.15.0-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>infrastructure-openshift</artifactId> | ||
<name>Infrastructure :: Openshift</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.code.gson</groupId> | ||
<artifactId>gson</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.inject.extensions</groupId> | ||
<artifactId>guice-assistedinject</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.inject.extensions</groupId> | ||
<artifactId>guice-multibindings</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.squareup.okhttp3</groupId> | ||
<artifactId>okhttp</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>kubernetes-model</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>openshift-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.annotation</groupId> | ||
<artifactId>javax.annotation-api</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-dto</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-api-installer</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-api-workspace</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-api-workspace-shared</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.che.core</groupId> | ||
<artifactId>che-core-commons-inject</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.websocket</groupId> | ||
<artifactId>javax.websocket-api</artifactId> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.ws.rs</groupId> | ||
<artifactId>javax.ws.rs-api</artifactId> | ||
<scope>provided</scope> | ||
</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.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> | ||
</project> |
51 changes: 51 additions & 0 deletions
51
.../main/java/org/eclipse/che/workspace/infrastructure/openshift/OpenshiftClientFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* 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: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
package org.eclipse.che.workspace.infrastructure.openshift; | ||
|
||
import io.fabric8.kubernetes.client.Config; | ||
import io.fabric8.openshift.client.DefaultOpenShiftClient; | ||
|
||
import javax.inject.Inject; | ||
import javax.inject.Named; | ||
|
||
import static com.google.common.base.Strings.isNullOrEmpty; | ||
|
||
/** | ||
* @author Sergii Leshchenko | ||
*/ | ||
public class OpenshiftClientFactory { | ||
private final Config config; | ||
|
||
@Inject | ||
public OpenshiftClientFactory(@Named("che.infra.openshift.master_url") String masterUrl, | ||
@Named("che.infra.openshift.username") String username, | ||
@Named("che.infra.openshift.password") String password, | ||
@Named("che.infra.openshift.trust_certs") boolean doTrustCerts) { | ||
this.config = new Config(); | ||
if (!isNullOrEmpty(masterUrl)) { | ||
config.setMasterUrl(masterUrl); | ||
} | ||
|
||
if (!isNullOrEmpty(username)) { | ||
config.setUsername(username); | ||
} | ||
|
||
if (!isNullOrEmpty(password)) { | ||
config.setPassword(password); | ||
} | ||
|
||
config.setTrustCerts(doTrustCerts); | ||
} | ||
|
||
public DefaultOpenShiftClient create() { | ||
return new DefaultOpenShiftClient(config); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...rc/main/java/org/eclipse/che/workspace/infrastructure/openshift/OpenshiftInfraModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2012-2017 Codenvy, S.A. | ||
* 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: | ||
* Codenvy, S.A. - initial API and implementation | ||
*******************************************************************************/ | ||
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.spi.RuntimeInfrastructure; | ||
import org.eclipse.che.workspace.infrastructure.openshift.bootstrapper.OpenshiftBootstrapperFactory; | ||
import org.eclipse.che.workspace.infrastructure.openshift.bootstrapper.OpenshiftBootstrapper; | ||
|
||
/** | ||
* @author Sergii Leshchenko | ||
*/ | ||
public class OpenshiftInfraModule extends AbstractModule { | ||
@Override | ||
protected void configure() { | ||
|
||
Multibinder<RuntimeInfrastructure> infrastructures = Multibinder.newSetBinder(binder(), | ||
RuntimeInfrastructure.class); | ||
infrastructures.addBinding().to(OpenshiftInfrastructure.class); | ||
|
||
// TODO Revise bind(WorkspaceFilesCleaner.class).toInstance(workspace -> {}); | ||
|
||
install(new FactoryModuleBuilder().build(RuntimeContextFactory.class)); | ||
install(new FactoryModuleBuilder().build(OpenshiftBootstrapperFactory.class)); | ||
} | ||
} |
Oops, something went wrong.