spectrocloud / cluster-api-provider-vsphere-static-ip

Static IP support for CAPV
Apache License 2.0
26 stars 8 forks source link

Reclaiming Static IP #27

Open acraghav opened 2 years ago

acraghav commented 2 years ago

How is Spectrocloud static IP controller project reclaiming IP addresses when CAPV deletes machines.

From the code it seems like the delete ipclaim isn't called.

// releases static ip back to the ip pool
DeallocateIP(name string, pool IPPool, ownerObj runtime.Object) error

func (m Metal3IPAM) DeallocateIP(name string, pool ipam.IPPool, ownerObj runtime.Object) error { return nil }

Can you please share your thoughts on this.

nwoodmsft commented 2 years ago

I'm also interested by this topic. I was looking at this DeallocateIP function and wondering whether we should proceed to implement it + contribute back the change, but I am not sure if there is more context/history around why this was not implemented previously (e.g. a race condition, timing issue, or another concern that we should be aware of).

In our environment we sometimes have extremely small IP pools available (e.g. 3-5 IPs available) so reclaiming those addresses after cluster deletion is going to be important.

Tagging @abhinavnagaraj and @sadysnaat for their input

Thanks folks!

acraghav commented 2 years ago

@abhinavnagaraj @sadysnaat : can you please allow me to push a PR to a private branch.

root@LAPTOP-5CC3SOCS:~/goroot/src/github.com/metal3-io/cluster-api-provider-vsphere-static-ip# git push -f --set-upstrea m origin deleteipclaim_reclaimproj remote: Permission to spectrocloud/cluster-api-provider-vsphere-static-ip.git denied to acraghav. fatal: unable to access 'https://github.com/spectrocloud/cluster-api-provider-vsphere-static-ip.git/': The requested URL returned error: 403

abhinavnagaraj commented 2 years ago

@acraghav, is this the error you see when you try to push to your fork ?

abhinavnagaraj commented 2 years ago

@acraghav , @nwoodmsft , apologies for the late response ! Our team has been very busy.

The reason we don't face this issue currently is because we have a wrapper service which generates the m3 IPPool while creating the cluster. So when this cluster is deleted this wrapper service knows that those IPs can be reallocated for the next cluster.

abhinavnagaraj commented 2 years ago

There seems to be an issue while setting the IPClaim's ownerRef as VSphereCluster. But otherwise, on deletion of the parent objects - VSphereCluster/VSphereMachine, the corresponding IPClaims and IPAddresses should be garbage collected.

acraghav commented 2 years ago

Thanks @abhinavnagaraj for your feedback. We are taking your latest build and testing our scenario.