Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

App force delete #1753

Closed
thedadams opened this issue Jun 9, 2023 · 3 comments
Closed

App force delete #1753

thedadams opened this issue Jun 9, 2023 · 3 comments
Assignees
Labels
kind/bug Something isn't working
Milestone

Comments

@thedadams
Copy link
Contributor

If a user creates an app with a delete job, there could be a situation where the user pins themselves into a corner. If their delete job is misconfigured somehow and is unable to complete successfully, then their app will never be cleaned up properly.

There needs to be a way for a user to be able to skip cleanup and force delete their apps.

@thedadams thedadams self-assigned this Jun 9, 2023
@thedadams thedadams added this to the v0.8.0 milestone Jun 9, 2023
thedadams added a commit that referenced this issue Jun 22, 2023
Add ignore-cleanup flag to rm command (#1753)
@cjellick cjellick added the kind/bug Something isn't working label Jun 22, 2023
thedadams added a commit that referenced this issue Jun 23, 2023
Use AppInstance instead of App for app subresouces that update (#1753)
@thedadams
Copy link
Contributor Author

The changes for this have been merged. The easiest way I have found to test this is to deploy an app with following Acornfile:

containers: nginx: {
	image: "nginx:latest"
	ports: "80/http"
	files: "/usr/share/nginx/html/index.html": "Version 2"
}

jobs: "my-job": {
	image:   "busybox:latest"
	command: "sleep 600"
	events: ["delete"]
}

Then, in one terminal, delete the app with acorn rm -af APP_NAME. The delete will hang (for an hour). In another terminal, run acorn rm --ignore-cleanup APP_NAME. Once this second command completes, the command in the other terminal will also complete and the app will be removed.

Note that this requires the latest version of the CLI.

@sangee2004
Copy link
Contributor

Tested with acorn version - v0.7.1-52-g63cbf08a+63cbf08a

  1. Deployed app using the following Acornfile:
containers: nginx: {
	image: "nginx:latest"
	ports: "80/http"
	files: "/usr/share/nginx/html/index.html": "Version 2"
}

jobs: "my-job": {
	image:   "busybox:latest"
	command: "sleep 600"
	events: ["delete"]
}
  1. once app is deployed successfully , attempt to delete the app.
    App is stuck in Waiting for app mytestserive to be removed
 % acorn rm -af  mytestserive
Waiting for app mytestserive to be removed...
  1. In another terminal , attempted to force delete the app:
acorn rm --ignore-cleanup mytestserive
Removed: mytestserive

This resulted in app getting deleted . Also delete that was stuck in "Waiting for app to be removed..." state proceed further and attempts to delete volumes and secrets and exits as expected.

acorn rm -af  mytestserive
Waiting for app mytestserive to be removed...
Removed: mytestserive
  •  No volumes associated with mytestserive
  •  No secrets associated with mytestserive

@sangee2004
Copy link
Contributor

Also tried the following scenario where we were previously unable to delete the apps.
Able to delete app successfully using --ignore-cleanup option.

Deploy app that uses AWS resources which will fail to deploy successfully. Attempt to delete the app.

acorn run -n mytest ghcr.io/acorn-io/aws/rds-aurora-serverless:v0.0.2

%acorn apps
NAME      IMAGE                                               HEALTHY   UP-TO-DATE   CREATED   ENDPOINTS   MESSAGE
mytest    ghcr.io/acorn-io/aws/rds-aurora-serverless:v0.0.2   0         0            43s ago               [jobs: [cdk-cfn-render: [pending create], context-generator: [pending create]]] [services: rds: [pending create]] [secrets: [acorn-service: [waiting: [job not complete]], admin: [waiting: [job not complete]], aws-config: [missing: [context-aws]], cdk-context-json: [waiting: [job not complete]]]]
% acorn rm -af mytest
Waiting for app mytest to be removed...
^CRemoved: mytest
  ✗  ERROR:  context canceled
 % acorn apps         
NAME      IMAGE                                               HEALTHY   UP-TO-DATE   CREATED   ENDPOINTS   MESSAGE
mytest    ghcr.io/acorn-io/aws/rds-aurora-serverless:v0.0.2   0         0            78s ago               [removing] [secrets: [acorn-service: [waiting: [job not complete]], admin: [waiting: [job not complete]], aws-config: [missing: [context-aws]], cdk-context-json: [waiting: [job not complete]]]]
% acorn rm --ignore-cleanup mytest      
Removed: mytest
% acorn apps                      
NAME      IMAGE     HEALTHY   UP-TO-DATE   CREATED   ENDPOINTS   MESSAGE

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants