Skip to content

fix: clean up garbage lsp #5172

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

Merged
merged 4 commits into from
Apr 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pkg/controller/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func (c *Controller) handleAddNode(key string) error {
}

var v4IP, v6IP, mac string

portName := util.NodeLspName(key)
if node.Annotations[util.AllocatedAnnotation] == "true" && node.Annotations[util.IPAddressAnnotation] != "" && node.Annotations[util.MacAddressAnnotation] != "" {
macStr := node.Annotations[util.MacAddressAnnotation]
Expand All @@ -161,6 +162,13 @@ func (c *Controller) handleAddNode(key string) error {
klog.Errorf("failed to alloc random ip addrs for node %v: %v", node.Name, err)
return err
}

// Clean up potentially existing logical switch ports to avoid leftover issues from previous failed configurations
if err := c.OVNNbClient.DeleteLogicalSwitchPort(portName); err != nil {
klog.Errorf("failed to delete stale logical switch port %s: %v", portName, err)
return err
}
klog.Infof("deleted stale logical switch port %s", portName)
}

ipStr := util.GetStringIP(v4IP, v6IP)
Expand Down