Floating IP deleting only on second time
When I use client.FloatingIPs.Delete(context.TODO(), ip) it looks like on first request it did only unassigned floating IP, and on second deleted. I expect it to be deleted on first time while we have different API call to "unassign".
Or is it expected behaviour on your side?
Hi @vlad2095,
I'm not able to reproduce this. When deleting a floating IP attached to a Droplet, it is completely deleted, not just unassigned. For example, with doctl which uses godo:
$ doctl compute floating-ip create --droplet-id 270960839
IP Region Droplet ID Droplet Name
143.244.220.237 nyc3 270960839 ubuntu-s-1vcpu-1gb-nyc3-02
$ doctl compute floating-ip get 143.244.220.237
IP Region Droplet ID Droplet Name
143.244.220.237 nyc3 270960839 ubuntu-s-1vcpu-1gb-nyc3-02
$ doctl compute floating-ip delete 143.244.220.237 --trace
Warning: Are you sure you want to delete this floating IP? (y/N) ? y
doctl: 2021/10/26 12:11:41 -> "DELETE /v2/floating_ips/143.244.220.237 HTTP/1.1\r\nHost: api.digitalocean.com\r\nUser-Agent: doctl/1.65.0-release (linux amd64) godo/1.69.0\r\nAccept: application/json\r\nContent-Type: application/json\r\nAccept-Encoding: gzip\r\n\r\n"
$ doctl compute floating-ip get 143.244.220.237
Error: GET https://api.digitalocean.com/v2/floating_ips/143.244.220.237: 404 (request "43546723-48f0-428b-98b9-39b027fe1825") The resource you requested could not be found.
Can you share any more details about your code? Can you still reproduce the issue?
I can confirm there is an issue here, or at least some undocumented new behavior.
The API states:\

This used to work as described, but not anymore. There seems to be a new intermediate state between the first FloatingIPs.Delete and the second FloatingIPs.Delete, here's a screenshot from the dashboard:
So the status of the floating IP is like this now:
-
Releasedon first call toFloatingIPs.Delete -
Removedon second callFloatingIPs.Delete
The crazy thing is, after the first Delete it becomes Released and FloatingIPs.Get fails with 404 which explains what @andrewsomething is seeing with doctl.
could it be related to floating ip's in custom non-default projects?
My walk-around is to ignore the 404 errors when releasing the IP the second time, here's how I'm doing it:
if gerr, ok := err.(*godo.ErrorResponse); ok {
res := gerr.Response
if res != nil {
switch res.StatusCode {
case 404:
return providers.NewNotFoundError("resource not found in DigitalOcean")
}
}
return gerr
}
Edit: this is not a library issue, it must be at API level. I tried with v1.19.0 which is what I was originally using and the latest v1.73.0 presents the same behavior.
Hello @bithavoc,
I passed this on to the internal floating ips team and they could not detect any issue. I also attempted to reproduce this bug this morning and was able to delete floating ips on the first attempt. I will close this issue as not reproducible. Please re-open if you have any future concerns or comments.
thank you