Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.0.2
-
None
Description
Azure ARM orphaned networks not cleaned up when node deleted which also prevents the resource group from being removed.
Not sure this is actually a bug.
According to https://github.com/duncangrant/jclouds-labs/blob/dbadb279f14848f21879f7eb6c7136e1a5f11192/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/strategy/CleanupResources.java#L94-L95 the network should be cleaned up when the resource group is deleted.
However this is not the case. As can be seen here: https://github.com/duncangrant/jclouds-labs/blob/dbadb279f14848f21879f7eb6c7136e1a5f11192/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/strategy/CleanupResources.java#L207
As the resource group contains the network this will prevent the resource group from being deleted leaving both the network and the resource group.
I think that, assuming the network was created by jclouds at the same time as the resource group, it is reasonable to delete both here.
This is intentional since the addition of the feature for attaching VMs to existing networks via the new Azure ARM specific template options. We don't want to delete what jclouds didn't create.
A good fix could be to do the same we do with the Availability Sets: tag the networks jclouds creates here and only delete the tagged ones when cleaning up the resources.
If this makes sense, wanna try raising a PR with the fix? I'd be happy to help.