chore: remove che.infra.kubernetes.workspace_start_timeout_min property
Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>pull/378/head
parent
ee3f2b9911
commit
5360484f28
|
|
@ -354,9 +354,6 @@ che.infra.kubernetes.workspace_sa_cluster_roles=NULL
|
||||||
# Cluster roles to assign to user in their namespace.
|
# Cluster roles to assign to user in their namespace.
|
||||||
che.infra.kubernetes.user_cluster_roles=NULL
|
che.infra.kubernetes.user_cluster_roles=NULL
|
||||||
|
|
||||||
# Defines wait time that limits the Kubernetes workspace start time.
|
|
||||||
che.infra.kubernetes.workspace_start_timeout_min=8
|
|
||||||
|
|
||||||
# Defines the timeout (in minutes) that limits the period for which {orch-ingress} becomes ready.
|
# Defines the timeout (in minutes) that limits the period for which {orch-ingress} becomes ready.
|
||||||
che.infra.kubernetes.ingress_start_timeout_min=5
|
che.infra.kubernetes.ingress_start_timeout_min=5
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,6 @@ public class KubernetesInternalRuntime<E extends KubernetesEnvironment>
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(KubernetesInternalRuntime.class);
|
private static final Logger LOG = LoggerFactory.getLogger(KubernetesInternalRuntime.class);
|
||||||
|
|
||||||
private final int workspaceStartTimeoutMin;
|
|
||||||
private final long ingressStartTimeoutMillis;
|
private final long ingressStartTimeoutMillis;
|
||||||
private final UnrecoverablePodEventListenerFactory unrecoverableEventListenerFactory;
|
private final UnrecoverablePodEventListenerFactory unrecoverableEventListenerFactory;
|
||||||
private final ServersCheckerFactory serverCheckerFactory;
|
private final ServersCheckerFactory serverCheckerFactory;
|
||||||
|
|
@ -139,7 +138,6 @@ public class KubernetesInternalRuntime<E extends KubernetesEnvironment>
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public KubernetesInternalRuntime(
|
public KubernetesInternalRuntime(
|
||||||
@Named("che.infra.kubernetes.workspace_start_timeout_min") int workspaceStartTimeoutMin,
|
|
||||||
@Named("che.infra.kubernetes.ingress_start_timeout_min") int ingressStartTimeoutMin,
|
@Named("che.infra.kubernetes.ingress_start_timeout_min") int ingressStartTimeoutMin,
|
||||||
NoOpURLRewriter urlRewriter,
|
NoOpURLRewriter urlRewriter,
|
||||||
UnrecoverablePodEventListenerFactory unrecoverableEventListenerFactory,
|
UnrecoverablePodEventListenerFactory unrecoverableEventListenerFactory,
|
||||||
|
|
@ -166,7 +164,6 @@ public class KubernetesInternalRuntime<E extends KubernetesEnvironment>
|
||||||
super(context, urlRewriter);
|
super(context, urlRewriter);
|
||||||
this.unrecoverableEventListenerFactory = unrecoverableEventListenerFactory;
|
this.unrecoverableEventListenerFactory = unrecoverableEventListenerFactory;
|
||||||
this.serverCheckerFactory = serverCheckerFactory;
|
this.serverCheckerFactory = serverCheckerFactory;
|
||||||
this.workspaceStartTimeoutMin = workspaceStartTimeoutMin;
|
|
||||||
this.ingressStartTimeoutMillis = TimeUnit.MINUTES.toMillis(ingressStartTimeoutMin);
|
this.ingressStartTimeoutMillis = TimeUnit.MINUTES.toMillis(ingressStartTimeoutMin);
|
||||||
this.probeScheduler = probeScheduler;
|
this.probeScheduler = probeScheduler;
|
||||||
this.probesFactory = probesFactory;
|
this.probesFactory = probesFactory;
|
||||||
|
|
@ -299,38 +296,6 @@ public class KubernetesInternalRuntime<E extends KubernetesEnvironment>
|
||||||
LOG.debug("Provisioning of workspace '{}' completed.", workspaceId);
|
LOG.debug("Provisioning of workspace '{}' completed.", workspaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedules runtime state checks that are needed after recovering of runtime.
|
|
||||||
*
|
|
||||||
* <p>Different checks will be scheduled according to current runtime status:
|
|
||||||
*
|
|
||||||
* <ul>
|
|
||||||
* <li>STARTING - schedules servers checkers and starts tracking of starting runtime
|
|
||||||
* <li>RUNNING - schedules servers checkers
|
|
||||||
* <li>STOPPING - starts tracking of stopping runtime
|
|
||||||
* <li>STOPPED - do nothing. Should not happen since only active runtimes are recovered
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
public void scheduleRuntimeStateChecks() throws InfrastructureException {
|
|
||||||
switch (getStatus()) {
|
|
||||||
case RUNNING:
|
|
||||||
scheduleServersCheckers();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STOPPING:
|
|
||||||
runtimeHangingDetector.trackStopping(this, workspaceStartTimeoutMin);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case STARTING:
|
|
||||||
runtimeHangingDetector.trackStarting(this, workspaceStartTimeoutMin);
|
|
||||||
scheduleServersCheckers();
|
|
||||||
break;
|
|
||||||
case STOPPED:
|
|
||||||
default:
|
|
||||||
// do nothing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Returns new function that wraps given with set/unset context logic */
|
/** Returns new function that wraps given with set/unset context logic */
|
||||||
private <T, R> Function<T, R> setContext(EnvironmentContext context, Function<T, R> func) {
|
private <T, R> Function<T, R> setContext(EnvironmentContext context, Function<T, R> func) {
|
||||||
return funcArgument -> {
|
return funcArgument -> {
|
||||||
|
|
@ -574,18 +539,13 @@ public class KubernetesInternalRuntime<E extends KubernetesEnvironment>
|
||||||
runtimeHangingDetector.stopTracking(getContext().getIdentity());
|
runtimeHangingDetector.stopTracking(getContext().getIdentity());
|
||||||
if (startSynchronizer.interrupt()) {
|
if (startSynchronizer.interrupt()) {
|
||||||
// runtime is STARTING. Need to wait until start will be interrupted properly
|
// runtime is STARTING. Need to wait until start will be interrupted properly
|
||||||
try {
|
|
||||||
if (!startSynchronizer.awaitInterruption(workspaceStartTimeoutMin, TimeUnit.MINUTES)) {
|
// Runtime is not interrupted yet. It may occur when start was performing by another
|
||||||
// Runtime is not interrupted yet. It may occur when start was performing by another
|
// Che Server that is crashed so start is hung up in STOPPING phase.
|
||||||
// Che Server that is crashed so start is hung up in STOPPING phase.
|
// Need to clean up runtime resources
|
||||||
// Need to clean up runtime resources
|
probeScheduler.cancel(identity.getWorkspaceId());
|
||||||
probeScheduler.cancel(identity.getWorkspaceId());
|
runtimeCleaner.cleanUp(namespace, identity.getWorkspaceId());
|
||||||
runtimeCleaner.cleanUp(namespace, identity.getWorkspaceId());
|
|
||||||
}
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new InfrastructureException(
|
|
||||||
"Interrupted while waiting for start task cancellation", e);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// runtime is RUNNING. Clean up used resources
|
// runtime is RUNNING. Clean up used resources
|
||||||
// Cancels workspace servers probes if any
|
// Cancels workspace servers probes if any
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
|
@ -86,8 +86,6 @@ public class KubernetesRuntimeContext<T extends KubernetesEnvironment> extends R
|
||||||
runtimeFactory.create(
|
runtimeFactory.create(
|
||||||
this, namespaceFactory.access(workspaceId, runtimeState.getNamespace()));
|
this, namespaceFactory.access(workspaceId, runtimeState.getNamespace()));
|
||||||
|
|
||||||
runtime.scheduleRuntimeStateChecks();
|
|
||||||
|
|
||||||
return runtime;
|
return runtime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
|
@ -18,7 +18,6 @@ import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
|
||||||
import org.eclipse.che.api.core.model.workspace.WorkspaceStatus;
|
import org.eclipse.che.api.core.model.workspace.WorkspaceStatus;
|
||||||
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
|
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity;
|
||||||
import org.eclipse.che.api.core.notification.EventService;
|
import org.eclipse.che.api.core.notification.EventService;
|
||||||
|
|
@ -116,10 +115,7 @@ public class StartSynchronizer {
|
||||||
private final RuntimeStopWatcher runtimeStopWatcher;
|
private final RuntimeStopWatcher runtimeStopWatcher;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public StartSynchronizer(
|
public StartSynchronizer(EventService eventService, @Assisted RuntimeIdentity runtimeId) {
|
||||||
EventService eventService,
|
|
||||||
@Named("che.infra.kubernetes.workspace_start_timeout_min") int workspaceStartTimeoutMin,
|
|
||||||
@Assisted RuntimeIdentity runtimeId) {
|
|
||||||
this.eventService = eventService;
|
this.eventService = eventService;
|
||||||
this.startFailure = new CompletableFuture<>();
|
this.startFailure = new CompletableFuture<>();
|
||||||
this.completionLatch = new CountDownLatch(0);
|
this.completionLatch = new CountDownLatch(0);
|
||||||
|
|
@ -127,7 +123,7 @@ public class StartSynchronizer {
|
||||||
this.runtimeStartInterrupter = new RuntimeStartInterrupter();
|
this.runtimeStartInterrupter = new RuntimeStartInterrupter();
|
||||||
this.runtimeStopWatcher = new RuntimeStopWatcher();
|
this.runtimeStopWatcher = new RuntimeStopWatcher();
|
||||||
this.isStarting = false;
|
this.isStarting = false;
|
||||||
this.workspaceStartTimeoutMillis = TimeUnit.MINUTES.toMillis(workspaceStartTimeoutMin);
|
this.workspaceStartTimeoutMillis = TimeUnit.MINUTES.toMillis(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Registers a runtime start. */
|
/** Registers a runtime start. */
|
||||||
|
|
|
||||||
|
|
@ -270,12 +270,11 @@ public class KubernetesInternalRuntimeTest {
|
||||||
MULTI_HOST_STRATEGY,
|
MULTI_HOST_STRATEGY,
|
||||||
WorkspaceExposureType.NATIVE.getConfigValue());
|
WorkspaceExposureType.NATIVE.getConfigValue());
|
||||||
|
|
||||||
startSynchronizer = spy(new StartSynchronizer(eventService, 5, IDENTITY));
|
startSynchronizer = spy(new StartSynchronizer(eventService, IDENTITY));
|
||||||
when(startSynchronizerFactory.create(any())).thenReturn(startSynchronizer);
|
when(startSynchronizerFactory.create(any())).thenReturn(startSynchronizer);
|
||||||
|
|
||||||
internalRuntime =
|
internalRuntime =
|
||||||
new KubernetesInternalRuntime<>(
|
new KubernetesInternalRuntime<>(
|
||||||
13,
|
|
||||||
5,
|
5,
|
||||||
new URLRewriter.NoOpURLRewriter(),
|
new URLRewriter.NoOpURLRewriter(),
|
||||||
unrecoverablePodEventListenerFactory,
|
unrecoverablePodEventListenerFactory,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
|
@ -55,7 +55,7 @@ public class StartSynchronizerTest {
|
||||||
@BeforeMethod
|
@BeforeMethod
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
runtimeId = new RuntimeIdentityImpl("workspace123", "envName", "ownerId", "infraNamespace");
|
runtimeId = new RuntimeIdentityImpl("workspace123", "envName", "ownerId", "infraNamespace");
|
||||||
startSynchronizer = new StartSynchronizer(eventService, 5, runtimeId);
|
startSynchronizer = new StartSynchronizer(eventService, runtimeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -173,7 +173,7 @@ public class StartSynchronizerTest {
|
||||||
public void shouldInterruptStartWhenStoppingEventIsPublished() throws Exception {
|
public void shouldInterruptStartWhenStoppingEventIsPublished() throws Exception {
|
||||||
// given
|
// given
|
||||||
EventService eventService = new EventService();
|
EventService eventService = new EventService();
|
||||||
StartSynchronizer localStartSynchronizer = new StartSynchronizer(eventService, 5, runtimeId);
|
StartSynchronizer localStartSynchronizer = new StartSynchronizer(eventService, runtimeId);
|
||||||
localStartSynchronizer.start();
|
localStartSynchronizer.start();
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
|
@ -187,7 +187,7 @@ public class StartSynchronizerTest {
|
||||||
public void shouldCompleteStartWhenStoppedEventIsPublished() {
|
public void shouldCompleteStartWhenStoppedEventIsPublished() {
|
||||||
// given
|
// given
|
||||||
EventService eventService = new EventService();
|
EventService eventService = new EventService();
|
||||||
StartSynchronizer localStartSynchronizer = new StartSynchronizer(eventService, 5, runtimeId);
|
StartSynchronizer localStartSynchronizer = new StartSynchronizer(eventService, runtimeId);
|
||||||
localStartSynchronizer.start();
|
localStartSynchronizer.start();
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
|
@ -212,7 +212,7 @@ public class StartSynchronizerTest {
|
||||||
// given
|
// given
|
||||||
runtimeId = new RuntimeIdentityImpl("workspace123", "envName", "ownerId", "infraNamespace");
|
runtimeId = new RuntimeIdentityImpl("workspace123", "envName", "ownerId", "infraNamespace");
|
||||||
EventService eventService = new EventService();
|
EventService eventService = new EventService();
|
||||||
startSynchronizer = new StartSynchronizer(eventService, 5, runtimeId);
|
startSynchronizer = new StartSynchronizer(eventService, runtimeId);
|
||||||
startSynchronizer.start();
|
startSynchronizer.start();
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
|
@ -228,7 +228,7 @@ public class StartSynchronizerTest {
|
||||||
// given
|
// given
|
||||||
runtimeId = new RuntimeIdentityImpl("workspace123", "envName", "ownerId", "infraNamespace");
|
runtimeId = new RuntimeIdentityImpl("workspace123", "envName", "ownerId", "infraNamespace");
|
||||||
EventService eventService = new EventService();
|
EventService eventService = new EventService();
|
||||||
startSynchronizer = new StartSynchronizer(eventService, 5, runtimeId);
|
startSynchronizer = new StartSynchronizer(eventService, runtimeId);
|
||||||
startSynchronizer.start();
|
startSynchronizer.start();
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
|
@ -246,7 +246,7 @@ public class StartSynchronizerTest {
|
||||||
EventService eventService = new EventService();
|
EventService eventService = new EventService();
|
||||||
|
|
||||||
// when
|
// when
|
||||||
startSynchronizer = new StartSynchronizer(eventService, 5, runtimeId);
|
startSynchronizer = new StartSynchronizer(eventService, runtimeId);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
assertSubscriberTypesNumber(eventService, 0);
|
assertSubscriberTypesNumber(eventService, 0);
|
||||||
|
|
@ -257,7 +257,7 @@ public class StartSynchronizerTest {
|
||||||
// given
|
// given
|
||||||
runtimeId = new RuntimeIdentityImpl("workspace123", "envName", "ownerId", "infraNamespace");
|
runtimeId = new RuntimeIdentityImpl("workspace123", "envName", "ownerId", "infraNamespace");
|
||||||
EventService eventService = new EventService();
|
EventService eventService = new EventService();
|
||||||
startSynchronizer = new StartSynchronizer(eventService, 5, runtimeId);
|
startSynchronizer = new StartSynchronizer(eventService, runtimeId);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
startSynchronizer.start();
|
startSynchronizer.start();
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ public class OpenShiftInternalRuntime extends KubernetesInternalRuntime<OpenShif
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public OpenShiftInternalRuntime(
|
public OpenShiftInternalRuntime(
|
||||||
@Named("che.infra.kubernetes.workspace_start_timeout_min") int workspaceStartTimeout,
|
|
||||||
@Named("che.infra.kubernetes.ingress_start_timeout_min") int ingressStartTimeout,
|
@Named("che.infra.kubernetes.ingress_start_timeout_min") int ingressStartTimeout,
|
||||||
NoOpURLRewriter urlRewriter,
|
NoOpURLRewriter urlRewriter,
|
||||||
UnrecoverablePodEventListenerFactory unrecoverablePodEventListenerFactory,
|
UnrecoverablePodEventListenerFactory unrecoverablePodEventListenerFactory,
|
||||||
|
|
@ -85,7 +84,6 @@ public class OpenShiftInternalRuntime extends KubernetesInternalRuntime<OpenShif
|
||||||
@Assisted OpenShiftRuntimeContext context,
|
@Assisted OpenShiftRuntimeContext context,
|
||||||
@Assisted OpenShiftProject project) {
|
@Assisted OpenShiftProject project) {
|
||||||
super(
|
super(
|
||||||
workspaceStartTimeout,
|
|
||||||
ingressStartTimeout,
|
ingressStartTimeout,
|
||||||
urlRewriter,
|
urlRewriter,
|
||||||
unrecoverablePodEventListenerFactory,
|
unrecoverablePodEventListenerFactory,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012-2021 Red Hat, Inc.
|
* Copyright (c) 2012-2022 Red Hat, Inc.
|
||||||
* This program and the accompanying materials are made
|
* This program and the accompanying materials are made
|
||||||
* available under the terms of the Eclipse Public License 2.0
|
* available under the terms of the Eclipse Public License 2.0
|
||||||
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
||||||
|
|
@ -81,8 +81,6 @@ public class OpenShiftRuntimeContext extends KubernetesRuntimeContext<OpenShiftE
|
||||||
runtimeFactory.create(
|
runtimeFactory.create(
|
||||||
this, projectFactory.access(workspaceId, runtimeState.getNamespace()));
|
this, projectFactory.access(workspaceId, runtimeState.getNamespace()));
|
||||||
|
|
||||||
runtime.scheduleRuntimeStateChecks();
|
|
||||||
|
|
||||||
return runtime;
|
return runtime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,6 @@ public class OpenShiftInternalRuntimeTest {
|
||||||
|
|
||||||
internalRuntime =
|
internalRuntime =
|
||||||
new OpenShiftInternalRuntime(
|
new OpenShiftInternalRuntime(
|
||||||
13,
|
|
||||||
5,
|
5,
|
||||||
new URLRewriter.NoOpURLRewriter(),
|
new URLRewriter.NoOpURLRewriter(),
|
||||||
unrecoverablePodEventListenerFactory,
|
unrecoverablePodEventListenerFactory,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue