cloud-foundrypivotal-web-services

Why does pivotal cloud foundry does not remove a route when a corresponding app is deleted?


I have been exploring Pivotal Cloud Foundry - Public Cloud Version by setting up an Pivotal Web Services account. While exploring the CF CLI I followed the below tutorial. https://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud-foundry/introduction

I was able to successfully push the sample spring boot app to PCF Cloud and follow the tutorial.

When I started to play around with it, I tried deleting the app using the below command. cf-spring is my app name.

cf delete cf-spring CF Delete Command

When navigated to my Pivotal Web Service account, I could see the app has been deleted. The route still displays the name of the route which was created when an app was created using the cf push command.

Pivotal DashBoard

So I tried to delete the route using the below command. Delete Route

It does not allow me to delete using CLI ? Does the app delete command should have taken care to remove the related routes associated with the application ?


Solution

  • Try cf delete-route -h to see the syntax of the delete-route command.

    You probably want to run cf delete-route cfapps.io --hostname cf-spring-rested-platypus.

    In recent versions of cf-cli you can also run cf delete-orphaned-routes.

    I think the reason CF doesn't completely delete the route when you delete an app is so that it kind of keeps the hostname reserved for your use, ie: someone else can't reuse it in another org or space if you've just taken down your app for a refresh. It's kind of annoying when you actually want to reuse the hostname in another space, but considering the multi-tenancy capabilities it kind of makes sense to keep them intact/reserved.