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

Subnet / network profile previously used by deleted container group in a virtual network cannot be deleted #5082

Closed
juho9000 opened this issue Jun 23, 2019 · 10 comments
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Network - Virtual Network Service Attention Workflow: This issue is responsible by Azure service team.

Comments

@juho9000
Copy link

juho9000 commented Jun 23, 2019

I am implementing deployment of container groups in virtual networks for Terraform and ran into an issue where the deletion of subnet and/or network profile fails when trying to delete either the network profile or subnet that were used by a container group that has been deleted.

Code="InUseSubnetCannotBeDeleted" Message="Subnet examplesubnet is in use by /subscriptions/foo-bar/resourceGroups/foobar/providers/Microsoft.Network/networkProfiles/examplenetprofile/containerNetworkInterfaceConfigurations/examplecnic/ipConfigurations/exampleipconfig and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet." Details=[]

Error deleting Network Profile "testnetprofile" (Resource Group "acctestRG-190623214354924962"): network.ProfilesClient#Delete: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="NetworkProfileAlreadyInUseWithContainerNics" Message="Network profile /subscriptions/63f29739-edbf-4318-93b8-7e697dd3d32a/resourceGroups/acctestRG-190623214354924962/providers/Microsoft.Network/networkProfiles/testnetprofile is already in use with container nics f7da78a9-c822-4df1-9f29-209f0835c199_testcnic; cannot update or delete" Details=[]

Please note: I can delete the resource after a short while (maybe a minute or so).

It would seem that resources are still being deleted behind the scenes after ContainerGroupsClient.Delete() has succeeded, and this is preventing the resources from being deleted.

I think that in order to support deploying container groups to virtual networks ContainerGroupsClient.Delete() should return azure.Future where we could call WaitForCompletion() in the same manner as when we're creating the container groups.

@juho9000 juho9000 changed the title Subnet previously used by deleted container group in a virtual network cannot be deleted Subnet / network profile previously used by deleted container group in a virtual network cannot be deleted Jun 23, 2019
@kurtzeborn kurtzeborn added Compute - VM Mgmt This issue is related to a management-plane library. labels Jun 24, 2019
@kurtzeborn kurtzeborn added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Jun 24, 2019
@kurtzeborn
Copy link
Member

Thank you for opening this issue! We are routing it to the appropriate team for follow up.

@katbyte
Copy link

katbyte commented Jul 24, 2019

@jhendrixMSFT, and word on this?

@jhendrixMSFT
Copy link
Member

@yangl900 Is ContainerGroups_Delete an async operation and the swagger just needs to be updated?

@yangl900
Copy link

The container group deletion API is a sync API, so swagger is correct. The network resource clean up is indeed an async process after the resource gets deleted. It's a good feedback the product team should consider. Right now the only way is probably by reading the network profile and see if there are connected IP configurations.

@katbyte
Copy link

katbyte commented Aug 2, 2019

@yangl900,

It sounds like the deletion API should become async, or not return until the resource cleanup is complete as right now it is returning before deletion is complete.

@tombuildsstuff
Copy link
Contributor

tombuildsstuff commented Aug 8, 2019

@yangl900 any idea of a timeframe for when this'll be fixed?

@mvansoens
Copy link

Any update on this?

I can't redeploy the same arm template twice even if i'm adding other unrelated resources and ACI and VNET resources remain unchanged.

@shafqut
Copy link
Member

shafqut commented Nov 26, 2019

Not sure if this is related to the API deletion, but encountering this scenario.
If you deploy ACI using json template, you can redeploy fine UNLESS you change the networkprofile, in our case we are adding a tag.
Assuming that the networkprofile is linked to the container instance and so is the reason it fails.

@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Sep 10, 2021
@lirenhe lirenhe added Service Attention Workflow: This issue is responsible by Azure service team. and removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Sep 10, 2021
@ghost
Copy link

ghost commented Sep 10, 2021

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @vnetsuppgithub.

Issue Details

I am implementing deployment of container groups in virtual networks for Terraform and ran into an issue where the deletion of subnet and/or network profile fails when trying to delete either the network profile or subnet that were used by a container group that has been deleted.

Code="InUseSubnetCannotBeDeleted" Message="Subnet examplesubnet is in use by /subscriptions/foo-bar/resourceGroups/foobar/providers/Microsoft.Network/networkProfiles/examplenetprofile/containerNetworkInterfaceConfigurations/examplecnic/ipConfigurations/exampleipconfig and cannot be deleted. In order to delete the subnet, delete all the resources within the subnet. See aka.ms/deletesubnet." Details=[]

Error deleting Network Profile "testnetprofile" (Resource Group "acctestRG-190623214354924962"): network.ProfilesClient#Delete: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="NetworkProfileAlreadyInUseWithContainerNics" Message="Network profile /subscriptions/63f29739-edbf-4318-93b8-7e697dd3d32a/resourceGroups/acctestRG-190623214354924962/providers/Microsoft.Network/networkProfiles/testnetprofile is already in use with container nics f7da78a9-c822-4df1-9f29-209f0835c199_testcnic; cannot update or delete" Details=[]

Please note: I can delete the resource after a short while (maybe a minute or so).

It would seem that resources are still being deleted behind the scenes after ContainerGroupsClient.Delete() has succeeded, and this is preventing the resources from being deleted.

I think that in order to support deploying container groups to virtual networks ContainerGroupsClient.Delete() should return azure.Future where we could call WaitForCompletion() in the same manner as when we're creating the container groups.

Author: juho9000
Assignees: -
Labels:

Service Attention, Mgmt, customer-reported, Network - Virtual Network

Milestone: -

@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Sep 10, 2021
@lirenhe
Copy link
Member

lirenhe commented Sep 29, 2021

@juho9000, as this item has been created 2 years, i will close this item. If you still face this issue and want this issue to be fixed, please reopen this item.

@lirenhe lirenhe closed this as completed Sep 29, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team Network - Virtual Network Service Attention Workflow: This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

9 participants