diff --git a/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/RegionScopedTitusClient.java b/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/RegionScopedTitusClient.java index 9564c142a69..d330177ba5d 100644 --- a/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/RegionScopedTitusClient.java +++ b/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/RegionScopedTitusClient.java @@ -231,11 +231,6 @@ public void terminateJob(TerminateJobRequest terminateJobRequest) { execute("killJob", titusRestAdapter.killJob(terminateJobRequest)); } - @Override - public void terminateTask(String taskId) { - execute("terminateTask", titusRestAdapter.terminateTask(taskId)); - } - @Override public void terminateTasksAndShrink(TerminateTasksAndShrinkJobRequest terminateTasksAndShrinkJob) { if(terminateTasksAndShrinkJob.getUser() == null){ diff --git a/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/TitusClient.java b/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/TitusClient.java index ed358179cad..36dda91b380 100644 --- a/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/TitusClient.java +++ b/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/TitusClient.java @@ -80,12 +80,6 @@ public interface TitusClient { */ public void terminateJob(TerminateJobRequest terminateJobRequest); - /** - * - * @param taskId - */ - public void terminateTask(String taskId); - /** * * @param terminateTasksAndShrinkJob diff --git a/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/TitusRestAdapter.java b/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/TitusRestAdapter.java index ba0d6c59175..05c44ece513 100644 --- a/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/TitusRestAdapter.java +++ b/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/client/TitusRestAdapter.java @@ -56,9 +56,6 @@ public interface TitusRestAdapter { @GET("/v2/jobs") Call> getJobsByApplication(@Query("appName") String application); - @POST("/v2/tasks/terminate/{taskId}") - Call terminateTask(@Path("taskId") String taskId); - @POST("/api/v2/tasks/kill") Call terminateTasksAndShrink(@Body TerminateTasksAndShrinkJobRequest terminateTasksAndShrinkJobRequest); diff --git a/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/deploy/description/TerminateTitusInstancesDescription.groovy b/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/deploy/description/TerminateTitusInstancesDescription.groovy index ba08607f767..f8f56478e3f 100644 --- a/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/deploy/description/TerminateTitusInstancesDescription.groovy +++ b/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/deploy/description/TerminateTitusInstancesDescription.groovy @@ -19,4 +19,5 @@ package com.netflix.spinnaker.clouddriver.titus.deploy.description class TerminateTitusInstancesDescription extends AbstractTitusCredentialsDescription { String region List instanceIds + String user } diff --git a/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/deploy/ops/TerminateTitusInstancesAtomicOperation.groovy b/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/deploy/ops/TerminateTitusInstancesAtomicOperation.groovy index 94f8ad43287..12fb05918f5 100644 --- a/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/deploy/ops/TerminateTitusInstancesAtomicOperation.groovy +++ b/clouddriver-titus/src/main/groovy/com/netflix/spinnaker/clouddriver/titus/deploy/ops/TerminateTitusInstancesAtomicOperation.groovy @@ -15,10 +15,12 @@ */ package com.netflix.spinnaker.clouddriver.titus.deploy.ops + import com.netflix.spinnaker.clouddriver.data.task.Task import com.netflix.spinnaker.clouddriver.data.task.TaskRepository import com.netflix.spinnaker.clouddriver.orchestration.AtomicOperation import com.netflix.spinnaker.clouddriver.titus.TitusClientProvider +import com.netflix.spinnaker.clouddriver.titus.client.model.TerminateTasksAndShrinkJobRequest import com.netflix.spinnaker.clouddriver.titus.deploy.description.TerminateTitusInstancesDescription import com.netflix.spinnaker.clouddriver.titus.client.TitusClient @@ -39,10 +41,8 @@ class TerminateTitusInstancesAtomicOperation implements AtomicOperation { TitusClient titusClient = titusClientProvider.getTitusClient(description.credentials, description.region) task.updateStatus PHASE, "Terminating titus tasks: ${description.instanceIds}..." - description.instanceIds.each { - titusClient.terminateTask(it) - task.updateStatus PHASE, "Successfully issued terminate task request to titus for task: ${it}" - } + titusClient.terminateTasksAndShrink(new TerminateTasksAndShrinkJobRequest().withTaskIds(description.instanceIds).withShrink(false).withUser(description.user)) + task.updateStatus PHASE, "Successfully issued terminate task request to titus for task: ${description.instanceIds.toString()}" task.updateStatus PHASE, "Completed terminate instances operation for ${description.instanceIds}" null