From d11c28325ec7e3afab9e92f9e8ebaa393ab01abb Mon Sep 17 00:00:00 2001 From: Andrew Obuchowicz Date: Wed, 27 Jul 2022 17:58:21 -0400 Subject: [PATCH] remove che.infra.kubernetes.pvc.wait_bound property Signed-off-by: Andrew Obuchowicz --- .../webapp/WEB-INF/classes/che/che.properties | 8 ------ .../namespace/pvc/CommonPVCStrategy.java | 4 +-- .../pvc/PerWorkspacePVCStrategy.java | 3 --- .../pvc/UniqueWorkspacePVCStrategy.java | 4 +-- .../pvc/UniqueWorkspacePVCStrategyTest.java | 25 +------------------ 5 files changed, 3 insertions(+), 41 deletions(-) diff --git a/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties b/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties index 1f289d5e73..eb06a24831 100644 --- a/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties +++ b/assembly/assembly-wsmaster-war/src/main/webapp/WEB-INF/classes/che/che.properties @@ -418,14 +418,6 @@ che.infra.kubernetes.pvc.jobs.image.pull_policy=IfNotPresent # Defines Pod memory limit for persistent volume claim maintenance jobs che.infra.kubernetes.pvc.jobs.memorylimit=250Mi -# Defines if {prod-short} Server should wait workspaces Persistent Volume Claims to become bound after creating. -# Default value is `true`. -# The parameter is used by all Persistent Volume Claim strategies. -# -# It should be set to `false` when `volumeBindingMode` is configured to `WaitForFirstConsumer` otherwise workspace starts will hangs up on phase of waiting PVCs. -# -che.infra.kubernetes.pvc.wait_bound=true - # Defines annotations for ingresses which are used for servers exposing. Value depends on the kind of ingress # controller. # diff --git a/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/CommonPVCStrategy.java b/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/CommonPVCStrategy.java index 42e6550ff0..5a5670c70c 100644 --- a/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/CommonPVCStrategy.java +++ b/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/CommonPVCStrategy.java @@ -24,7 +24,6 @@ import io.fabric8.kubernetes.api.model.VolumeMount; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import javax.inject.Named; import org.eclipse.che.account.spi.AccountImpl; import org.eclipse.che.api.core.Page; import org.eclipse.che.api.core.ServerException; @@ -105,7 +104,6 @@ public class CommonPVCStrategy implements WorkspaceVolumesStrategy { @Inject public CommonPVCStrategy( - @Named("che.infra.kubernetes.pvc.wait_bound") boolean waitBound, PVCSubPathHelper pvcSubPathHelper, KubernetesNamespaceFactory factory, EphemeralWorkspaceAdapter ephemeralWorkspaceAdapter, @@ -118,7 +116,7 @@ public class CommonPVCStrategy implements WorkspaceVolumesStrategy { this.pvcAccessMode = "TEST"; this.preCreateDirs = true; this.pvcStorageClassName = "TEST"; - this.waitBound = waitBound; + this.waitBound = true; this.pvcSubPathHelper = pvcSubPathHelper; this.factory = factory; this.ephemeralWorkspaceAdapter = ephemeralWorkspaceAdapter; diff --git a/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/PerWorkspacePVCStrategy.java b/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/PerWorkspacePVCStrategy.java index 426fcb1058..92b7f70ccb 100644 --- a/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/PerWorkspacePVCStrategy.java +++ b/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/PerWorkspacePVCStrategy.java @@ -18,7 +18,6 @@ import static org.eclipse.che.workspace.infrastructure.kubernetes.namespace.Kube import com.google.common.collect.ImmutableMap; import io.fabric8.kubernetes.api.model.PersistentVolumeClaim; import javax.inject.Inject; -import javax.inject.Named; import org.eclipse.che.api.core.model.workspace.Workspace; import org.eclipse.che.api.workspace.server.WorkspaceManager; import org.eclipse.che.api.workspace.server.spi.InfrastructureException; @@ -52,7 +51,6 @@ public class PerWorkspacePVCStrategy extends CommonPVCStrategy { @Inject public PerWorkspacePVCStrategy( - @Named("che.infra.kubernetes.pvc.wait_bound") boolean waitBound, PVCSubPathHelper pvcSubPathHelper, KubernetesNamespaceFactory factory, EphemeralWorkspaceAdapter ephemeralWorkspaceAdapter, @@ -61,7 +59,6 @@ public class PerWorkspacePVCStrategy extends CommonPVCStrategy { SubPathPrefixes subpathPrefixes, WorkspaceManager workspaceManager) { super( - waitBound, pvcSubPathHelper, factory, ephemeralWorkspaceAdapter, diff --git a/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategy.java b/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategy.java index 65ab2d742a..4f5ea58f62 100644 --- a/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategy.java +++ b/infrastructures/kubernetes/src/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategy.java @@ -20,7 +20,6 @@ import java.util.HashMap; import java.util.Map; import java.util.function.Function; import javax.inject.Inject; -import javax.inject.Named; import org.eclipse.che.api.core.model.workspace.Workspace; import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity; import org.eclipse.che.api.workspace.server.spi.InfrastructureException; @@ -85,12 +84,11 @@ public class UniqueWorkspacePVCStrategy implements WorkspaceVolumesStrategy { @Inject public UniqueWorkspacePVCStrategy( - @Named("che.infra.kubernetes.pvc.wait_bound") boolean waitBound, KubernetesNamespaceFactory factory, EphemeralWorkspaceAdapter ephemeralWorkspaceAdapter, PVCProvisioner pvcProvisioner, SubPathPrefixes subpathPrefixes) { - this.waitBound = waitBound; + this.waitBound = true; this.factory = factory; this.ephemeralWorkspaceAdapter = ephemeralWorkspaceAdapter; this.pvcProvisioner = pvcProvisioner; diff --git a/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategyTest.java b/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategyTest.java index d4d396596a..2f6c55f096 100644 --- a/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategyTest.java +++ b/infrastructures/kubernetes/src/test/java/org/eclipse/che/workspace/infrastructure/kubernetes/namespace/pvc/UniqueWorkspacePVCStrategyTest.java @@ -17,8 +17,6 @@ import static java.util.Collections.singletonMap; import static org.eclipse.che.api.workspace.shared.Constants.PERSIST_VOLUMES_ATTRIBUTE; import static org.eclipse.che.workspace.infrastructure.kubernetes.Constants.CHE_WORKSPACE_ID_LABEL; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyLong; -import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.inOrder; @@ -89,7 +87,7 @@ public class UniqueWorkspacePVCStrategyTest { public void setup() throws Exception { strategy = new UniqueWorkspacePVCStrategy( - true, factory, ephemeralWorkspaceAdapter, pvcProvisioner, subpathPrefixes); + factory, ephemeralWorkspaceAdapter, pvcProvisioner, subpathPrefixes); k8sEnv = KubernetesEnvironment.builder().build(); @@ -157,27 +155,6 @@ public class UniqueWorkspacePVCStrategyTest { verify(pvcs).waitBound(uniqueName, 100); } - @Test - public void testCreatesProvisionedPVCsOnPrepareIfWaitIsDisabled() throws Exception { - strategy = - new UniqueWorkspacePVCStrategy( - false, // wait bound PVCs - factory, - ephemeralWorkspaceAdapter, - pvcProvisioner, - subpathPrefixes); - - final String uniqueName = PVC_NAME_PREFIX + "-3121"; - final PersistentVolumeClaim pvc = newPVC(uniqueName); - k8sEnv.getPersistentVolumeClaims().clear(); - k8sEnv.getPersistentVolumeClaims().putAll(singletonMap(uniqueName, pvc)); - - strategy.prepare(k8sEnv, IDENTITY, 100, emptyMap()); - - verify(pvcs).createIfNotExist(any()); - verify(pvcs, never()).waitBound(anyString(), anyLong()); - } - @Test(expectedExceptions = InfrastructureException.class) public void throwsInfrastructureExceptionWhenFailedToCreatePVCs() throws Exception { final PersistentVolumeClaim pvc = mock(PersistentVolumeClaim.class);