Skip to content

Commit 25fc88b

Browse files
ibuziukl0rd
authored andcommitted
CHE-3937: Introducing properties for OpenShift liveness probe initial delay / timeout
Signed-off-by: Ilya Buziuk <ibuziuk@redhat.com>
1 parent 9effc07 commit 25fc88b

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/codenvy/che.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ che.openshift.username=openshift-dev
276276
che.openshift.password=devel
277277
che.openshift.project=eclipse-che
278278
che.openshift.serviceaccountname=cheserviceaccount
279+
che.openshift.liveness.probe.delay=300
280+
che.openshift.liveness.probe.timeout=1
279281

280282
# Which implementation of DockerConnector to use in managing containers. In general,
281283
# the base implementation of DockerConnector is appropriate, but OpenShiftConnector

plugins/plugin-docker/che-plugin-openshift-client/src/main/java/org/eclipse/che/plugin/openshift/client/OpenShiftConnector.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ public class OpenShiftConnector extends DockerConnector {
101101
private static final String DOCKER_PREFIX = "docker://";
102102
private static final String DOCKER_PROTOCOL_PORT_DELIMITER = "/";
103103
private static final String OPENSHIFT_SERVICE_TYPE_NODE_PORT = "NodePort";
104-
private static final int OPENSHIFT_LIVENESS_PROBE_DELAY = 120;
105-
private static final int OPENSHIFT_LIVENESS_PROBE_TIMEOUT = 1;
106104
private static final int OPENSHIFT_WAIT_POD_DELAY = 1000;
107105
private static final int OPENSHIFT_WAIT_POD_TIMEOUT = 120;
108106
private static final String OPENSHIFT_POD_STATUS_RUNNING = "Running";
@@ -118,6 +116,8 @@ public class OpenShiftConnector extends DockerConnector {
118116
private final KubernetesService kubernetesService;
119117
private final String openShiftCheProjectName;
120118
private final String openShiftCheServiceAccount;
119+
private final int openShiftLivenessProbeDelay;
120+
private final int openShiftLivenessProbeTimeout;
121121

122122
@Inject
123123
public OpenShiftConnector(DockerConnectorConfiguration connectorConfiguration,
@@ -132,14 +132,19 @@ public OpenShiftConnector(DockerConnectorConfiguration connectorConfiguration,
132132
@Named("che.openshift.username") String openShiftUserName,
133133
@Named("che.openshift.password") String openShiftUserPassword,
134134
@Named("che.openshift.project") String openShiftCheProjectName,
135-
@Named("che.openshift.serviceaccountname") String openShiftCheServiceAccount) {
135+
@Named("che.openshift.serviceaccountname") String openShiftCheServiceAccount,
136+
@Named("che.openshift.liveness.probe.delay") int openShiftLivenessProbeDelay,
137+
@Named("che.openshift.liveness.probe.timeout") int openShiftLivenessProbeTimeout) {
138+
136139
super(connectorConfiguration, connectionFactory, authResolver, dockerApiVersionPathPrefixProvider);
137140
this.openShiftCheProjectName = openShiftCheProjectName;
138141
this.openShiftCheServiceAccount = openShiftCheServiceAccount;
139142
this.kubernetesLabelConverter = kubernetesLabelConverter;
140143
this.kubernetesEnvVar = kubernetesEnvVar;
141144
this.kubernetesContainer = kubernetesContainer;
142145
this.kubernetesService = kubernetesService;
146+
this.openShiftLivenessProbeDelay = openShiftLivenessProbeDelay;
147+
this.openShiftLivenessProbeTimeout = openShiftLivenessProbeTimeout;
143148

144149
Config config = new ConfigBuilder().withMasterUrl(openShiftApiEndpoint)
145150
.withUsername(openShiftUserName)
@@ -671,8 +676,8 @@ private Probe getLivenessProbeFrom(final Set<String> exposedPorts) {
671676
.withNewTcpSocket()
672677
.withNewPort(port)
673678
.endTcpSocket()
674-
.withInitialDelaySeconds(OPENSHIFT_LIVENESS_PROBE_DELAY)
675-
.withTimeoutSeconds(OPENSHIFT_LIVENESS_PROBE_TIMEOUT)
679+
.withInitialDelaySeconds(openShiftLivenessProbeDelay)
680+
.withTimeoutSeconds(openShiftLivenessProbeTimeout)
676681
.build();
677682
}
678683

plugins/plugin-docker/che-plugin-openshift-client/src/test/java/org/eclipse/che/plugin/openshift/client/OpenShiftConnectorTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public class OpenShiftConnectorTest {
4141
private static final String OPENSHIFT_API_ENDPOINT_MINISHIFT = "https://192.168.64.2:8443/";
4242
private static final String OPENSHIFT_DEFAULT_USER_NAME = "openshift-dev";
4343
private static final String OPENSHIFT_DEFAULT_USER_PASSWORD = "devel";
44+
private static final int OPENSHIFT_LIVENESS_PROBE_DELAY = 300;
45+
private static final int OPENSHIFT_LIVENESS_PROBE_TIMEOUT = 1;
4446

4547
@Mock
4648
private DockerConnectorConfiguration dockerConnectorConfiguration;
@@ -77,7 +79,9 @@ public void setup() {
7779
OPENSHIFT_DEFAULT_USER_NAME,
7880
OPENSHIFT_DEFAULT_USER_PASSWORD,
7981
CHE_DEFAULT_OPENSHIFT_PROJECT_NAME,
80-
CHE_DEFAULT_OPENSHIFT_SERVICEACCOUNT));
82+
CHE_DEFAULT_OPENSHIFT_SERVICEACCOUNT,
83+
OPENSHIFT_LIVENESS_PROBE_DELAY,
84+
OPENSHIFT_LIVENESS_PROBE_TIMEOUT));
8185
}
8286

8387
@Test

0 commit comments

Comments
 (0)