Skip to content

Commit

Permalink
append delete static route for sts pod (#1798)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongzhen-ma committed Aug 12, 2022
1 parent 9dc6e15 commit 8d2d0b1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions pkg/controller/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,26 @@ func (c *Controller) handleDeletePod(pod *v1.Pod) error {
return err
}
}

// there's some case which can not delete static route by ipam for sts pod when upgrading from lower version
for _, lsp := range ports {
addrs, err := c.ovnClient.GetPortAddr(lsp)
if err != nil {
if err != ovs.ErrNoAddr {
klog.Errorf("failed to get addr for lsp %s, %v", lsp, err)
}
continue
}
for _, addr := range addrs {
if net.ParseIP(addr) == nil {
continue
}
if err := c.ovnClient.DeleteStaticRoute(addr, util.DefaultVpc); err != nil {
klog.Errorf("failed to delete static route for lsp %s, err %v", lsp, err)
return err
}
}
}
}

var keepIpCR bool
Expand Down

0 comments on commit 8d2d0b1

Please sign in to comment.