Skip to content

Commit

Permalink
Fixup orphan IPAddressAllocation after Node removed
Browse files Browse the repository at this point in the history
Do the clean up work when the Node is being deleted.
  • Loading branch information
DanielXiao committed Aug 23, 2024
1 parent f1b8d77 commit c441c4a
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,15 @@ func (c *Controller) syncNode(key string) error {
case err != nil:
utilruntime.HandleError(fmt.Errorf("unable to retrieve node %v from store: %v", key, err))
default:
// node exists in store, ensure Pod CIDR of this Node is claimed
klog.V(4).Infof("Node %s is found, ensuring Pod CIDR claimed", node.Name)
err = c.nsxIPManager.ClaimPodCIDR(node)
if !node.DeletionTimestamp.IsZero() {
// node is being deleted, ensure Pod CIDR of this Node is released
klog.V(4).Infof("Node %s is being deleted, releasing Pod CIDR %s", node.Name, node.Spec.PodCIDR)
err = c.nsxIPManager.ReleasePodCIDR(node)
} else {
// node exists in store, ensure Pod CIDR of this Node is claimed
klog.V(4).Infof("Node %s is found, ensuring Pod CIDR claimed", node.Name)
err = c.nsxIPManager.ClaimPodCIDR(node)
}
}

return err
Expand Down

0 comments on commit c441c4a

Please sign in to comment.