kubefirst / kubefirst

The Kubefirst Open Source Platform
https://docs.kubefirst.io
MIT License
1.63k stars 125 forks source link

the deprovision flow in civo cloud doesn't accommodate volumes #1933

Open johndietz opened 8 months ago

johndietz commented 8 months ago

Which version of kubefirst are you using?

2.3.5

Which cloud provider?

Civo

Which DNS?

Cloud ones (default)

Which installation type?

UI (Console app)

Which distributed Git provider?

GitHub

Did you use a fork of gitops-template?

No

Which Operating System?

macOS

What is the issue?

following the deprovision docs against a civo github stack, i wasn't able to delete my network because of dangling volumes attached to the network.

CleanShot 2023-11-30 at 14 24 39@2x
Plan: 0 to add, 0 to change, 3 to destroy.

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

civo_kubernetes_cluster.kubefirst: Destroying... [id=8eea4232-8f9d-421c-8a1b-2d53c329a7f3]
civo_kubernetes_cluster.kubefirst: Destruction complete after 1s
civo_firewall.kubefirst: Destroying... [id=e3ebe482-8bb1-4774-8487-0c25a1dc6856]
civo_firewall.kubefirst: Destruction complete after 4s
civo_network.kubefirst: Destroying... [id=d5390551-ffa4-483b-9adc-bf55b23bc602]
╷
│ Error: error waiting for network (d5390551-ffa4-483b-9adc-bf55b23bc602) to be deleted: DatabaseNetworkInUseByVolumes: Failed to delete the network because it's in use by volumes, Network "cust-management-96eda81a-982dec6a9c39" is used by "pvc-3f0a2af7-96af-48c3-98c0-211e52f286c1,pvc-71928a42-f789-46e4-b870-b2911a8434c5,pvc-9434821c-9b9e-4363-9396-4ebb884822ec,pvc-9f00136d-7081-4b11-b1df-05a690890741,pvc-a5fc80e5-b33c-43e5-807d-45203b7a5a44,pvc-bb32de35-a096-4d1b-8ad9-112d261724c5,pvc-c59c408b-f33b-419a-8408-80a366ea1cd0,pvc-f08e5930-e8ed-4f71-bc01-658b2a0cb437" volumes. Please delete the volumes first in order to delete the network.
│ 
│ 
╵
➜  civo git:(main) terraform destroy
civo_network.kubefirst: Refreshing state... [id=d5390551-ffa4-483b-9adc-bf55b23bc602]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  - destroy

Terraform will perform the following actions:

  # civo_network.kubefirst will be destroyed
  - resource "civo_network" "kubefirst" {
      - default = false -> null
      - id      = "d5390551-ffa4-483b-9adc-bf55b23bc602" -> null
      - label   = "management" -> null
      - name    = "cust-management-96eda81a-982dec6a9c39" -> null
      - region  = "FRA1" -> null
    }

Plan: 0 to add, 0 to change, 1 to destroy.

Do you really want to destroy all resources?
  Terraform will destroy all your managed infrastructure, as shown above.
  There is no undo. Only 'yes' will be accepted to confirm.

  Enter a value: yes

civo_network.kubefirst: Destroying... [id=d5390551-ffa4-483b-9adc-bf55b23bc602]
╷
│ Error: error waiting for network (d5390551-ffa4-483b-9adc-bf55b23bc602) to be deleted: DatabaseNetworkInUseByVolumes: Failed to delete the network because it's in use by volumes, Network "cust-management-96eda81a-982dec6a9c39" is used by "pvc-3f0a2af7-96af-48c3-98c0-211e52f286c1,pvc-71928a42-f789-46e4-b870-b2911a8434c5,pvc-9434821c-9b9e-4363-9396-4ebb884822ec,pvc-9f00136d-7081-4b11-b1df-05a690890741,pvc-a5fc80e5-b33c-43e5-807d-45203b7a5a44,pvc-bb32de35-a096-4d1b-8ad9-112d261724c5,pvc-c59c408b-f33b-419a-8408-80a366ea1cd0,pvc-f08e5930-e8ed-4f71-bc01-658b2a0cb437" volumes. Please delete the volumes first in order to delete the network.

Code of Conduct

johndietz commented 8 months ago

using Civo CLI v1.0.69 if you encounter this error, you can delete detached volumes with the following:

civo region current fra1
civo volume ls --fields id -o custom | while read line ; do civo volume rm "$line" --yes ; done

this will delete all volumes in your configured region, which may extend beyond the cluster of concern. please use carefully.

once volumes are removed you can run terraform destroy successfully