Skip to content

Commit

Permalink
Explicitly marked cascade selection as Foreground
Browse files Browse the repository at this point in the history
Signed-off-by: Sergii Kabashniuk <skabashniuk@redhat.com>
  • Loading branch information
skabashnyuk committed Apr 6, 2020
1 parent 0d00dcb commit bd638ad
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void delete() throws InfrastructureException {
.configMaps()
.inNamespace(namespace)
.withLabel(CHE_WORKSPACE_ID_LABEL, workspaceId)
.withPropagationPolicy("Foreground")
.delete();
} catch (KubernetesClientException e) {
throw new KubernetesInfrastructureException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,8 @@ protected CompletableFuture<Void> doDeleteDeployment(String deploymentName)
toCloseOnException = watch;
}

Boolean deleteSucceeded = deploymentResource.delete();
Boolean deleteSucceeded =
deploymentResource.cascading(true).withPropagationPolicy("Foreground").delete();

if (deleteSucceeded == null || !deleteSucceeded) {
deleteFuture.complete(null);
Expand Down Expand Up @@ -963,7 +964,8 @@ protected CompletableFuture<Void> doDeletePod(String podName) throws Infrastruct
final Watch watch = podResource.watch(new DeleteWatcher<Pod>(deleteFuture));
toCloseOnException = watch;

Boolean deleteSucceeded = podResource.delete();
Boolean deleteSucceeded =
podResource.cascading(true).withPropagationPolicy("Foreground").delete();
if (deleteSucceeded == null || !deleteSucceeded) {
deleteFuture.complete(null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public void delete() throws InfrastructureException {
.ingresses()
.inNamespace(namespace)
.withLabel(CHE_WORKSPACE_ID_LABEL, workspaceId)
.withPropagationPolicy("Foreground")
.delete();
} catch (KubernetesClientException e) {
throw new KubernetesInfrastructureException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,12 @@ private void update(Namespace namespace, KubernetesClient client) throws Infrast
private void delete(String namespaceName, KubernetesClient client)
throws InfrastructureException {
try {
client.namespaces().withName(namespaceName).delete();
client
.namespaces()
.withName(namespaceName)
.cascading(true)
.withPropagationPolicy("Foreground")
.delete();
} catch (KubernetesClientException e) {
if (e.getCode() == 404) {
LOG.warn(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public void delete(Map<String, String> labels) throws InfrastructureException {
.persistentVolumeClaims()
.inNamespace(namespace)
.withLabels(labels)
.withPropagationPolicy("Foreground")
.delete();
} catch (KubernetesClientException e) {
throw new KubernetesInfrastructureException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.eclipse.che.api.workspace.server.spi.InfrastructureException;
import org.eclipse.che.workspace.infrastructure.kubernetes.KubernetesClientFactory;
import org.eclipse.che.workspace.infrastructure.kubernetes.KubernetesInfrastructureException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Defines an internal API for managing {@link Secret} instances in {@link
Expand Down Expand Up @@ -64,6 +66,7 @@ public void delete() throws InfrastructureException {
.secrets()
.inNamespace(namespace)
.withLabel(CHE_WORKSPACE_ID_LABEL, workspaceId)
.withPropagationPolicy("Foreground")
.delete();
} catch (KubernetesClientException e) {
throw new KubernetesInfrastructureException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void delete() throws InfrastructureException {
.services()
.inNamespace(namespace)
.withLabel(CHE_WORKSPACE_ID_LABEL, workspaceId)
.withPropagationPolicy("Foreground")
.delete();
} catch (KubernetesClientException e) {
throw new KubernetesInfrastructureException(e);
Expand Down

0 comments on commit bd638ad

Please sign in to comment.