Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rad app delete does not clean up all resources when the application deployment originally failed #7081

Closed
wants to merge 2 commits into from

Conversation

nithyatsu
Copy link
Contributor

@nithyatsu nithyatsu commented Jan 26, 2024

Description

We do not track the outputResources in the event of deplyment failure, but might have created some, potentially with errors.
If the deployment of outResource errors, we should cleanup these so that app can be deleted gracefully using rad app delete command.

Type of change

  • This pull request fixes a bug in Radius and has an approved issue (issue link required).

Fixes: #7052

@nithyatsu nithyatsu marked this pull request as ready for review January 29, 2024 21:56
@nithyatsu nithyatsu requested review from a team as code owners January 29, 2024 21:56
if deleteErr != nil {
logger.Info("Failed to cleanup deployed output resources for resource %q. Error: %s", id.String(), deleteErr.Error())
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT would happen in the following scenario?

  • User deploys an application successfully. They are using a Recipe to create a Redis cache, and a cloud-hosted Redis cache is created successfully.
  • User updates the application. The recipe runs again, but this time it fails - let's say it was on outage on the cloud-provider's part.
  • Then what ???

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would unnecessarily delete the cache too, with potential data loss . :(
I am trying to fix a tricky scenario where rad app delete can't clean up resources upon deployment error since we dont track o/p resources at all in that case.. I am not sure it would be an improvement if I deleted just the errored outputresource in that case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would unnecessarily delete the cache too, with potential data loss .

Yup, that's right 😆

Copy link

@youngbupark youngbupark Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of deleting resource and returning error, what if we add status in deploymentOutput to track the failure state? For updating scenario (failed scenario), we can upsert to the outputresources to keep old resource references for deletion. WDYT?

LocalID: outputResource.LocalID,
ID: outputResource.ID,
}
deployedOutputResources = append(deployedOutputResources, outputResource)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't understand why we need to add the outputResource to a map? The map will only have one item and then the function will exit based on line 302. Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deleting application does not delete resources in some cases
4 participants