Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openshift connector improvements #5052

Merged
merged 35 commits into from
Jul 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f1e6664
CHE-4141 - Use Persistent Volumes Claims when creating workspaces
snjeza Feb 14, 2017
bd110c0
Implement getContainerLogs method in OpenShiftConnector
snjeza Mar 1, 2017
8c5bcf8
Implement createExec() and startExec() in OpenShiftConnector
amisevsk Mar 3, 2017
bb7cdf3
Update Dockerfile to avoid permissions issues
l0rd Mar 8, 2017
787c854
Che server and workpaces exposed on the same single TCP port (#4351)
l0rd Mar 10, 2017
cf51b1c
Add implementation of getEvents() to avoid busy wait
amisevsk Mar 8, 2017
77329e3
Disabling usage of user account service in openshift-connector
sunix Jun 29, 2017
fba68ea
Update Docker Compose tests to fix test failure
amisevsk Mar 22, 2017
d9ec4e8
Find an alternative to subPath in volumeMount
snjeza Mar 24, 2017
1f8feec
Setting rwx permissions for all on /data/ in case it's not mounted
l0rd Mar 25, 2017
4b0aa10
Fix dockerImageConfig is null (since v1.5 of OpenShift API)
l0rd Mar 27, 2017
1e52375
Add support for resource limits when running on Openshift
amisevsk Mar 17, 2017
4276e98
Add Nullable annotation to che.docker.ip.external
amisevsk Mar 31, 2017
fe8c3fb
Adding property to set requests for RAM
l0rd Apr 3, 2017
1c28f25
CHE-158 Adding TLS support for Workspace routes
ibuziuk Mar 29, 2017
fbaa6b9
CHE-158 Using '-' instead of '.' for generating OpenShift route Urls
ibuziuk Apr 5, 2017
3760901
Fixing tests after changing Url generation logic
ibuziuk Apr 5, 2017
ef3fae6
Redirect insecure HTTP requests to TLS endpoint
l0rd Apr 11, 2017
edd1318
CHE-180: Creating and closing OpenShiftClient in every method of Open…
ibuziuk Apr 12, 2017
45f3648
Update route naming to make it work on OSO
l0rd Apr 18, 2017
4acf79c
Delete ReplicaSets explicitly when shutting down a workspace
amisevsk Apr 18, 2017
2510ba8
Rework PVC management on OpenShift
l0rd Apr 18, 2017
84fe5ea
Fix OpenShiftConnectorTest
l0rd Apr 24, 2017
6b78b07
Fix route server names if unknown should start with server-.
sunix Apr 28, 2017
44818af
Add property to control manual workspace dir creation in OpenShift
amisevsk May 4, 2017
bd1cbbe
CHE-102 - Idle detection of che-server and workspaces
snjeza Jun 4, 2017
521ade6
Recent changes required access to `/` which is impossible under OS
davidfestal Jun 8, 2017
aee7227
Add and modify tests for OpenShift helper classes
amisevsk May 23, 2017
89641ad
adapt che-server entrypoint.sh to environments without write permissi…
Jun 13, 2017
46b2f8c
CHE-280: Adding container's state info to the 'inspectContainer' API
ibuziuk Jun 12, 2017
a822958
Factorize code of `ServerEvaluationStrategy` classes, to use the Cust…
davidfestal Jun 15, 2017
15c1b6c
Multi-container workspace Support (#5110)
davidfestal Jun 16, 2017
c533f7a
Fix failing Traeffik tests...
davidfestal Jun 19, 2017
715e5d5
Fix tests in the LocalDockerEvaluationStrategy...
davidfestal Jun 19, 2017
0028e4b
Replace OSIO-specific `single-port` strategy by `docker-local-custom`
davidfestal Jun 22, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,14 @@ che.docker.ip.external=NULL
# - 'docker-local': internal address is address of container within docker network, and exposed ports
# are used.
# - 'custom': The evaluation strategy may be customized through a template property.
# - 'docker-local-custom': internal address is set as in docker-local strategy, external address is composed
# as in the custom strategy with the 'template' and the 'external.protocol' properties.

# The 'docker-local' strategy may be useful if a firewall prevents communication between che-server and
# workspace containers, but will prevent communication when che-server and workspace containers are not
# on the same Docker network.
# The 'docker-local-custom' strategy may be useful when Che and the workspace servers need to be exposed on the
# same single TCP port.
che.docker.server_evaluation_strategy=default


Expand Down Expand Up @@ -298,12 +303,52 @@ che.openshift.project=eclipse-che
che.openshift.serviceaccountname=cheserviceaccount
che.openshift.liveness.probe.delay=300
che.openshift.liveness.probe.timeout=1
che.openshift.workspaces.pvc.name=claim-che-workspace
che.openshift.workspaces.pvc.quantity=10Gi
# Create secure route against HTTPS
# NOTE: In order to create routes against HTTPS
# Property 'strategy.che.docker.server_evaluation_strategy.secure.external.urls' should be also set to true
che.openshift.secure.routes=false
# Pod that is launched when performing persistent volume claim maintenance jobs on OpenShift
che.openshift.jobs.image=centos:centos7
che.openshift.jobs.memorylimit=250Mi

# Run job to create workspace subpath directories in persistent volume before launching workspace.
# Necessary in some versions of OpenShift/Kubernetes as workspace subpath volumemounts are created
# with root permissions, and thus cannot be modified by workspaces running as user (presents as error
# importing projects into workspace in Che). Default is "true", but should be set to false if version
# of Openshift/Kubernetes creates subdirectories with user permissions.
# Relevant issue: https://github.com/kubernetes/kubernetes/issues/41638
che.openshift.precreate.workspace.dirs=true

# Specifications of compute resources that can be consumed
# by the workspace container:
#
# - Amount of memory required for a workspace container to run e.g. 512Mi
che.openshift.workspace.memory.request=NULL
#
# - Maximum amount of memory a workspace container can use e.g. 1.3Gi
che.openshift.workspace.memory.override=NULL

# The Openshift will idle the server if no workspace is run for
# this length of time.
che.openshift.server.inactive.stop.timeout.ms=1800000

#
#
# Be aware that setting che.openshift.workspace.memory.override
# will override Che memory limits
#
# More information about setting Compute Resources in OpenShift can be
# found here: https://docs.openshift.org/latest/dev_guide/compute_resources.html#dev-compute-resources

# Which implementation of DockerConnector to use in managing containers. In general,
# the base implementation of DockerConnector is appropriate, but OpenShiftConnector
# is necessary for deploying Che on OpenShift. Options:
# - 'default' : Use DockerConnector
# - 'openshift' : use OpenShiftConnector
# Note that if 'openshift' connector is used, the property che.docker.ip.external
# MUST be set.
che.docker.connector=default

# Defines whether stacks loaded once or each time server starts.
Expand Down
11 changes: 11 additions & 0 deletions core/che-core-api-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,17 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<excludes>
<!-- Exclude files until #3281 is resolved -->
<exclude>**/ServerIdleEvent.java</exclude>
<!-- End excluded files -->
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*******************************************************************************
* 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.api.core.event;
/**
* Event informing about idling the che server.
*/
public class ServerIdleEvent {
private long timeout;

/**
* Implements the handler to handle idling.
*/
public ServerIdleEvent(long timeout) {
super();
this.timeout = timeout;
}


public long getTimeout() {
return timeout;
}

public void setTimeout(long timeout) {
this.timeout = timeout;
}
}
3 changes: 3 additions & 0 deletions dockerfiles/che/Dockerfile.centos
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ EXPOSE 8000 8080
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
ADD eclipse-che.tar.gz /home/user/
RUN mkdir /logs && chmod 0777 /logs
RUN chmod -R 0777 /home/user/
RUN mkdir /data && chmod 0777 /data
42 changes: 32 additions & 10 deletions dockerfiles/che/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Variables:
export CHE_REGISTRY_HOST=${CHE_REGISTRY_HOST:-${DEFAULT_CHE_REGISTRY_HOST}}

DEFAULT_CHE_PORT=8080
CHE_PORT=${CHE_PORT:-${DEFAULT_CHE_PORT}}
export CHE_PORT=${CHE_PORT:-${DEFAULT_CHE_PORT}}

DEFAULT_CHE_IP=
CHE_IP=${CHE_IP:-${DEFAULT_CHE_IP}}
Expand Down Expand Up @@ -244,18 +244,40 @@ init() {
fi
### Are we going to use the embedded che.properties or one provided by user?`
### CHE_LOCAL_CONF_DIR is internal Che variable that sets where to load
export CHE_LOCAL_CONF_DIR="/conf"
if [ -f "/conf/che.properties" ]; then
echo "Found custom che.properties..."
if [ "$CHE_USER" != "root" ]; then
sudo chown -R ${CHE_USER} ${CHE_LOCAL_CONF_DIR}
# check if we have permissions to create /conf folder.
if [ -w / ]; then
export CHE_LOCAL_CONF_DIR="/conf"
if [ -f "/conf/che.properties" ]; then
echo "Found custom che.properties..."
if [ "$CHE_USER" != "root" ]; then
sudo chown -R ${CHE_USER} ${CHE_LOCAL_CONF_DIR}
fi
else
if [ ! -d ${CHE_LOCAL_CONF_DIR} ]; then
mkdir -p ${CHE_LOCAL_CONF_DIR}
fi
if [ -w ${CHE_LOCAL_CONF_DIR} ];then
echo "ERROR: user ${CHE_USER} does OK have write permissions to ${CHE_LOCAL_CONF_DIR}"
echo "Using embedded che.properties... Copying template to ${CHE_LOCAL_CONF_DIR}/che.properties"
cp -rf "${CHE_HOME}/conf/che.properties" ${CHE_LOCAL_CONF_DIR}/che.properties
else
echo "ERROR: user ${CHE_USER} does not have write permissions to ${CHE_LOCAL_CONF_DIR}"
exit 1
fi
fi
else
if [ ! -d /conf ]; then
mkdir -p /conf
echo "WARN: parent dir is not writeable, CHE_LOCAL_CONF_DIR will be set to ${CHE_DATA}/conf"
export CHE_LOCAL_CONF_DIR="${CHE_DATA}/conf"
if [ ! -d ${CHE_LOCAL_CONF_DIR} ]; then
mkdir -p ${CHE_LOCAL_CONF_DIR}
fi
if [ -w ${CHE_LOCAL_CONF_DIR} ];then
echo "Using embedded che.properties... Copying template to ${CHE_LOCAL_CONF_DIR}/che.properties"
cp -rf "${CHE_HOME}/conf/che.properties" ${CHE_LOCAL_CONF_DIR}/che.properties
else
echo "ERROR: user ${CHE_USER} does not have write permissions to ${CHE_LOCAL_CONF_DIR}"
exit 1
fi
echo "Using embedded che.properties... Copying template to ${CHE_LOCAL_CONF_DIR}/che.properties"
cp -rf "${CHE_HOME}/conf/che.properties" ${CHE_LOCAL_CONF_DIR}/che.properties
fi

# Update the provided che.properties with the location of the /data mounts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Exec {
private final String[] command;
private final String id;

Exec(String[] command, String id) {
public Exec(String[] command, String id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what for?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since OpenShiftConnector is in a different package, we cannot implement startExec() or createExec() without this class being public -- there seems to be no factory method.

this.command = command;
this.id = id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public void composeServiceCommandShouldBeParsedSuccessfully(String command,
assertEquals(environment.get("MYSQL_PASSWORD"), "password");
assertTrue(service.getExpose().containsAll(asList("4403", "5502")));

assertEquals(service.getCommand(), commandWords);
assertTrue(service.getCommand().containsAll(commandWords));
assertEquals(service.getCommand().size(), commandNumberOfWords);
}

@DataProvider(name = "validCommand")
Expand Down Expand Up @@ -137,7 +138,7 @@ private Object[][] validCommand() {
{"\"echo ${PWD}\"", asList("echo", "${PWD}"), 2},
{"\"(Test)\"", singletonList("(Test)"), 1},

{"", null, 1},
{"\"\"", singletonList(""), 1},
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public Object[][] correctContentTestData() {
+ " dev-machine: \n"
+ " image: codenvy/ubuntu_jdk8\n"
+ " environment:\n"
+ " MYSQL_ROOT_PASSWORD: ",
ImmutableMap.of("MYSQL_ROOT_PASSWORD", null)
+ " MYSQL_ROOT_PASSWORD: \"\"",
ImmutableMap.of("MYSQL_ROOT_PASSWORD", "")
},

// dictionary format, value of variable contains colon sign
Expand Down
3 changes: 3 additions & 0 deletions plugins/plugin-docker/che-plugin-docker-machine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,11 @@
<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>
<exclude>**/ServerIdleDetector.java</exclude>
<!-- End excluded files -->
</excludes>
</configuration>
Expand Down
Loading